https://sourceware.org/bugzilla/show_bug.cgi?id=22592
Alan Modra <amodra at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-12-12 CC| |amodra at gmail dot com Summary|Segfaults when compiling |dyn_reloc count error for |cifs-utils with "-pie" on |sparc PIE |Gentoo Linux (sparc) | Ever confirmed|0 |1 --- Comment #1 from Alan Modra <amodra at gmail dot com> --- /home/alan/build/gas/sparc-linux/ld/ld-new: warning: libk5crypto.so.3, needed by usr/lib/libkrb5.so.3.3, not found (try using -rpath or -rpath-link) /home/alan/build/gas/sparc-linux/ld/ld-new: warning: libcom_err.so.2, needed by usr/lib/libkrb5.so.3.3, not found (try using -rpath or -rpath-link) /home/alan/build/gas/sparc-linux/ld/ld-new: warning: libkrb5support.so.0, needed by usr/lib/libkrb5.so.3.3, not found (try using -rpath or -rpath-link) /home/alan/build/gas/sparc-linux/ld/ld-new: warning: libresolv.so.2, needed by usr/lib/libkrb5.so.3.3, not found (try using -rpath or -rpath-link) usr/lib/libkrb5.so.3.3: undefined reference to `k5_get_error@krb5support_0_MIT' usr/lib/libkrb5.so.3.3: undefined reference to `krb5_c_is_keyed_cksum@k5crypto_3_MIT' [snip] lots more undefined reference errors. Hmm, OK, let's try with the following ~/build/gas/sparc-linux/ld/ld-new --eh-frame-hdr -m elf32_sparc -dynamic-linker /lib/ld-linux.so.2 -relax -pie -o cifs.upcall usr/lib/Scrt1.o usr/lib/crti.o usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/crtbeginS.o -z relro -z now -O1 --as-needed cifs.upcall.o data_blob.o asn1.o spnego.o usr/lib/libtalloc.so.2.1.9 lib/libkeyutils.so.1 usr/lib/libkrb5.so.3.3 usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/libgcc.a --as-needed usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/libgcc_s.so.1 lib/libc.so.6 usr/lib/libc_nonshared.a lib/ld-linux.so.2 usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/libgcc.a usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/libgcc_s.so.1 --no-as-needed usr/lib/gcc/sparc-unknown-linux-gnu/6.4.0/crtendS.o usr/lib/crtn.o --unresolved-symbols=ignore-all and the link succeeds. Running the above under valgrind shows there is a problem. ==6987== Invalid write of size 1 ==6987== at 0x42FD13: bfd_putb32 (libbfd.c:690) ==6987== by 0x4455AD: bfd_elf32_swap_reloca_out (elfcode.h:436) ==6987== by 0x443FBC: sparc_elf_append_rela (elfxx-sparc.c:754) ==6987== by 0x443FBC: _bfd_sparc_elf_finish_dynamic_symbol (elfxx-sparc.c:4541) ==6987== by 0x45B3D8: elf_link_output_extsym (elflink.c:9826) ==6987== by 0x42F2F0: bfd_hash_traverse (hash.c:656) ==6987== by 0x46A132: bfd_elf_final_link (elflink.c:12196) ==6987== by 0x41862D: ldwrite (ldwrite.c:581) ==6987== by 0x4038A1: main (ldmain.c:448) ==6987== Address 0x5e7f323 is 3 bytes after a block of size 1,744 alloc'd ==6987== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==6987== by 0x4B1F3C: _objalloc_alloc (objalloc.c:143) ==6987== by 0x4347E0: bfd_alloc (opncls.c:949) ==6987== by 0x434D2D: bfd_zalloc (opncls.c:998) ==6987== by 0x4409E8: _bfd_sparc_elf_size_dynamic_sections (elfxx-sparc.c:2681) ==6987== by 0x46434F: bfd_elf_size_dynamic_sections (elflink.c:6829) ==6987== by 0x420F4F: gldelf32_sparc_before_allocation (eelf32_sparc.c:1296) ==6987== by 0x4148FB: lang_process (ldlang.c:7378) ==6987== by 0x403846: main (ldmain.c:432) The error is repeated for offsets from 0 to 11 after the 1744 block. So we have a dynamic reloc being written past the end of the alloc'd buffer. It's a GOT reloc, thus there is an error in counting (or output of) GOT relocs. I don't intend to track down exactly where the sparc backend goes wrong, but the above analysis ought to help someone else do that. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils