[PATCH 1/6] ld: don't generate base relocations in PE output for absolute symbols
Thu Mar 4 04:46:59 GMT 2021
On Tue, Mar 02, 2021 at 10:47:03AM +0100, Jan Beulich via Binutils wrote:
> 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.
> 2021-02-XX Jan Beulich <email@example.com>
> * ldexp.c (ldexp_is_final_sym_absolute): New.
> * ldexp.h (ldexp_is_final_sym_absolute): Declare.
> * pe-dll.c (generate_reloc): Skip absolute symbols.
> + /* Nor for absolute symbols. */
> + else if (blhe && ldexp_is_final_sym_absolute (blhe)
> + && (!blhe->linker_def
> + || (strcmp(sym->name, "__image_base__")
> + && strcmp(sym->name, U ("__ImageBase")))))
Space after strcmp.
Australia Development Lab, IBM
More information about the Binutils