https://sourceware.org/bugzilla/show_bug.cgi?id=27659
Bug ID: 27659 Summary: BFD (GNU Binutils for Debian) 2.36.1 internal error, aborting at ../../bfd/elfcode.h:224 in bfd_elf32_swap_symbol_out Product: binutils Version: 2.36.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: costamagnagianfranco at yahoo dot it Target Milestone: --- Created attachment 13333 --> https://sourceware.org/bugzilla/attachment.cgi?id=13333&action=edit segfault with 2.35.2 Hello, as said in the title, bfd linker segfaults while trying to link a clang-12 (but also previous clang versions are affected) on armhf. Short story, from bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980957 echo '#include <stdio.h> int main() { if (1==1) { printf("true"); }else{ printf("false"); return 42; } return 0;}' > foo.c Testing linking ... rm foo bar.cc clang-$VERSION -flto foo.c -o foo clang: error: unable to execute command: Segmentation fault clang: error: linker command failed due to signal (use -v to see invocation) autopkgtest [02:17:39]: ERROR: testbed failure: testbed auxverb failed with exit code 254 I can say something about this: a) this happens only on armhf, not on amd64 nor on i386 (not sure about the others, sorry) binutils from sid: 2.35.2 + patches from stable branch 1) bfd FAILS with segfault (attached the backtrace) 2) bfd SUCCEED if I copy the .o files from usr/lib to the current directory and I launch them from here 3) gold SUCCEED binutils from experimental: 2.36.1 + patches from stable branch 1) bfd FAILS with segfault 2) bfd FAILS if I copy the .o files from usr/lib to the current directory and I launch them from here /usr/bin/ld: BFD (GNU Binutils for Debian) 2.36.1 internal error, aborting at ../../bfd/elfcode.h:224 in bfd_elf32_swap_symbol_out 3) gold SUCCEED So, 2.36.1 seems to be regressing with respect to 2.35.2, but in any case, the segfault is on the very same place of code. e.g.: binutils from experimental /usr/bin/ld -EL -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo crt1.o crti.o crtbegin.o -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10 -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../arm-linux-gnueabihf -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../lib -L/usr/lib/llvm-12/bin/../lib -L/lib/arm-linux-gnueabihf -L/lib/../lib -L/usr/lib/arm-linux-gnueabihf -L/usr/lib/../lib -L/usr/lib/arm-linux-gnueabihf/../../lib -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../.. -L/usr/lib/llvm-12/bin/../lib -L/lib -L/usr/lib -plugin ./LLVMgold.so -plugin-opt=mcpu=generic foo-a6d584.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o Segmentation fault /usr/bin/ld -EL -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo -L. crt1.o crti.o crtbegin.o -L. -L/usr/lib -plugin ./LLVMgold.so -plugin-opt=mcpu=generic foo-a6d584.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o /usr/bin/ld: BFD (GNU Binutils for Debian) 2.36.1 internal error, aborting at ../../bfd/elfcode.h:224 in bfd_elf32_swap_symbol_out /usr/bin/ld: Please report this bug. /usr/bin/ld -EL -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo -L. crt1.o crti.o crtbegin.o -L. -L/usr/lib -plugin ./LLVMgold.so -plugin-opt=mcpu=generic foo-a6d584.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o /usr/bin/ld: BFD (GNU Binutils for Debian) 2.36.1 internal error, aborting at ../../bfd/elfcode.h:224 in bfd_elf32_swap_symbol_out /usr/bin/ld: Please report this bug. /usr/bin/ld.gold -EL -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo crt1.o crti.o crtbegin.o -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10 -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../arm-linux-gnueabihf -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../../../lib -L/usr/lib/llvm-12/bin/../lib -L/lib/arm-linux-gnueabihf -L/lib/../lib -L/usr/lib/arm-linux-gnueabihf -L/usr/lib/../lib -L/usr/lib/arm-linux-gnueabihf/../../lib -L/usr/bin/../lib/gcc/arm-linux-gnueabihf/10/../../.. -L/usr/lib/llvm-12/bin/../lib -L/lib -L/usr/lib -plugin ./LLVMgold.so -plugin-opt=mcpu=generic foo-a6d584.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o echo $? 0 (experimental_armhf-dchroot)locutusofborg@amdahl:~/bar$ /usr/bin/ld -EL -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o foo /usr/lib/arm-linux-gnueabihf/crt1.o /usr/lib/arm-linux-gnueabihf/crti.o /usr/lib/gcc/arm-linux-gnueabihf/10/crtbegin.o -L. -L/usr/lib -plugin ./LLVMgold.so -plugin-opt=mcpu=generic foo-a6d584.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/arm-linux-gnueabihf/10/crtend.o /usr/lib/arm-linux-gnueabihf/crtn.o /usr/bin/ld: BFD (GNU Binutils for Debian) 2.36.1 internal error, aborting at ../../bfd/elfcode.h:224 in bfd_elf32_swap_symbol_out /usr/bin/ld: Please report this bug. I'm also attaching the directory with the sources and object files -- You are receiving this mail because: You are on the CC list for the bug.