ld seems to disregard section relative specifiers on symbols
Julian Waters
tanksherman27@gmail.com
Sat Sep 7 05:27:22 GMT 2024
Hi Jan,
Thanks for looking into this! I think I can also provide further strange
differences compared to clang. If the code above is compiled by gcc to an
object file, disassembling the file will yield a secrel attribute with a
value of .tls$, while disassembling a clang compiled object file will yield
the attribute with the local symbol:
Compiled by gcc (Meaning it was assembled by as):
0000000000000000 <sectionrelative>:
0: b8 00 00 00 00 mov eax,0x0
1: IMAGE_REL_AMD64_SECREL .tls$
5: c3 ret
Compiled by clang (Meaning it was assembled by the clang integrated
assembler):
0000000000000000 <sectionrelative>:
0: b8 00 00 00 00 mov eax,0x0
1: IMAGE_REL_AMD64_SECREL local
5: c3 ret
6: 66 2e 0f 1f 84 00 00 cs nop WORD PTR [rax+rax*1+0x0]
d: 00 00 00
The IMAGE_REL_AMD64_SECREL entries are different in the 2 disassembly
snippets above (cs nop WORD PTR in clang can probably be ignored). However
this difference seems to not be the reason that the linked programs produce
different results, as assembling with as and then linking with clang still
gives the correct result of 8
Thanks for your patience!
best regards,
Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20240907/2a2e7c1d/attachment.htm>
More information about the Binutils
mailing list