ld: don't generate base relocations in PE output for absolute symbols
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Mar 2021 15:55:01 +0000 (16:55 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Mar 2021 15:55:01 +0000 (16:55 +0100)
commit6fa7408d72b3805536e3579ba46b48f07f2e780a
tree4bf2a749afaa5ad0866b5659d2f4f6534fad2d5d
parent1178743e4c05d9c0daad5a105277fbc42872c9ea
ld: don't generate base relocations in PE output for absolute symbols

It is the very nature of absolute symbols that they don't change even
if the loader decides to put the image at other than its link-time base
address. Of the linker-defined (and PE-specific) symbols __image_base__
(and its alias) needs special casing, as it'll still appear to be
absolute at this point.

A new inquiry function in ldexp.c is needed because PE base relocations
get generated before ldexp_finalize_syms() runs, yet whether a
relocation is needed depends on the ultimate property of a symbol.
ld/ChangeLog
ld/ldexp.c
ld/ldexp.h
ld/pe-dll.c
ld/testsuite/ld-pe/pe.exp
ld/testsuite/ld-pe/reloc.d [new file with mode: 0644]
ld/testsuite/ld-pe/reloc.s [new file with mode: 0644]