-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relocation error in 64bit ELF object file #212
Comments
Hi, I'm surprised that worked at all to be honest, VariableName[Rn*scale] type addressing is largely unsupported in 64bit in favour of using RIP relative forms - avoiding relocations as far as possible. I don't think this would even assemble for Windows 64bit as there is no relocation type for it. Firstly I think UASM looks like it should be using the 32S relocation variant. |
Hi, John |
Hi, John |
Yep, clearly when UASM generates the relocation entry it’s just not using the addend field properly – this part is basically unchanged since JWASM days so I’ll need to dig in and have a look at where the reloc is generated and why it ignores the addend. My guess is that it pre-calculates from the EA the symbol address + immediate displacement – what I’d be curious to see, if you patch the relocation to have addend of 0 but change the location/target offset should the result not be exactly the same (at least execution wise) – from a debugger obviously it would imply something different as it probably correlates the symbol’s base address and addend to be an index from that point.
From: TasosKL ***@***.***>
Sent: 05 September 2024 16:42
To: Terraspace/UASM ***@***.***>
Cc: John Hankinson ***@***.***>; Comment ***@***.***>
Subject: Re: [Terraspace/UASM] Relocation error in 64bit ELF object file (Issue #212)
Hi, John
The problem is definitely due to UASM.
I patched the addend field of the relocation entry with a hex editor and it works OK no matter what is
in the code section of the object file. So the problem is in the way the relocation entry is put in the object file,
it omits the addend.
Any ideas?
—
Reply to this email directly, view it on GitHub <#212 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AEAZAVFLXXVRD6UYDIW3K4LZVB3TXAVCNFSM6AAAAABNO7DRVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSGA3TANRUGY> .
You are receiving this because you commented. <https://github.com/notifications/beacon/AEAZAVH42X4CZ5FA4UTXDHDZVB3TXA5CNFSM6AAAAABNO7DRVKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTULACJPM.gif> Message ID: ***@***.*** ***@***.***> >
|
Hi, John
Looking at the history file i found that there is the following change in JWASM: 03/02/2011, v2.05:
Hope this helps. |
Hi, all
Using uasm 2.57 to assemble this code
results in executable code that in both cases loads
AL
with the same value.Searching a bit, I found that it is a relocation problem, that is, using
objdump
on the produced object file gives the following output:
Assembling the same code with GNU as
the executable code loads the correct value in
AL
. The output ofobjdump
iswhich shows that the second relocation entry has an addend of 1.
Can you help?
The text was updated successfully, but these errors were encountered: