Author Topic: Position Independent Code  (Read 5964 times)

Offline Tima203

  • Jr. Member
  • *
  • Posts: 2
Position Independent Code
« on: November 01, 2020, 08:48:23 PM »
Hello,

I downloaded NASM 2.15 but the .plt relocations and .got relocations have
terrible offsets and addends even when they are relative to the program
counter. For example, when using the WRT ..plt and WRT ..got directives,
their corresponding relocations have zero for their offsets and addends
which is incorrect. This is my first time using NASM for Windows. I
previously used the NASM 2.11.05 for Linux with no problem.

I hope you fix this soon.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Position Independent Code
« Reply #1 on: November 01, 2020, 10:04:47 PM »
Hi Tima203,

Welcome to the forum.

I am not a Windows user, so probably can't help you, I thought that "wrt plt" and "wrt got" were for Linux. All I see in the Friendly Manual is "wrt imagebase"... I hope a Windows user can help you. I really don't know...

Best,
Frank


Offline Tima203

  • Jr. Member
  • *
  • Posts: 2
Re: Position Independent Code
« Reply #2 on: November 01, 2020, 10:33:20 PM »

I found the problem. I am writing a cross-platform linker that runs on
the Windows Operating System but outputs programs and libraries for
Linux64. The problem was that the offset was being updated while
writing the .plt and .got sections. I have updated the code for the linker
and it seems to be working fine.

Thanks for your concern.