Bug in dynamic linker ld 2.37.20211103-150100.7.29

H.J. Lu hjl.tools@gmail.com
Fri Jun 10 19:38:29 GMT 2022


commit 17c6c3b99156fe82c1e637e1a5fd9f163ac788c8
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri May 7 12:05:12 2021 +0200

    x86-64/ELF: clear src_mask for all reloc types

    x86-64 uses rela relocations. The comment next to the field's declaration
    says "Non-zero values for ELF USE_RELA targets should be viewed with
    suspicion ..." And indeed the fields being non-zero causes section
    contents to be accumulated into the final relocated values in addition to
    the relocations' addends, which is contrary to the ELF spec.

But for_main.o from

https://lists.gnu.org/archive/html/bug-binutils/2022-06/msg00064.html

has

  28: e8 fc ff ff ff        call   29 <main+0x29> 29: R_X86_64_PLT32
for_rtl_init_
  2d: e8 fc ff ff ff        call   2e <main+0x2e> 2e: R_X86_64_PLT32 MAIN__
  32: e8 fc ff ff ff        call   33 <main+0x33> 33: R_X86_64_PLT32
for_rtl_finish_

This is clearly wrong since addend is 0.  This is a bug in the
compiler which was
used to generate it.   If you have to use the buggy compiler, you need to use
binutils 2.36 or older.

-- 
H.J.


More information about the Binutils mailing list