https://sourceware.org/bugzilla/show_bug.cgi?id=24748
Bug ID: 24748 Summary: 2.32+: bisected build notes-related segfault compiling libstdc++ targetting x86-32 Product: binutils Version: 2.33 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: nix at esperi dot org.uk Target Milestone: --- Created attachment 11873 --> https://sourceware.org/bugzilla/attachment.cgi?id=11873&action=edit Output of a GCC 9.1 libstdc++ 32-bit biarch x86_64 libstdc++ compilation of strstream.cc The attached .s file (generated during GCC 9.1 libstdc++ stage2 build from strstream.C) yields assertion failures or dereferences of nearly-null pointers when assembled with an x86-64-native gas --32 from binutils 2.32 or trunk. I've bisected this to commit 2e48456f0236d39b6de98feb7168f56cef155912 Author: Nick Clifton <ni...@redhat.com> Date: Fri Jul 6 11:46:14 2018 +0100 Fix the relocs created to adjust notes created by the assembler. * write.c (maybe_generate_build_notes): Bias reloc offsets by the number of notes already generated. Reverting this commit makes the crashes described below go away. Obviously, this crash only happens when gas is configured with --enable-generate-build-notes. I suspect this option is not exactly ready for prime-time given the number of spurious test failures that occur when it's turned on because of test results that have not been updated to expect .gnu.build-attributes sections to be present. The segfault on trunk looks like: /tmp/as -v -I /usr/src/gcc/9.1.0-212/libstdc++-v3/../libgcc -I /usr/local/tmp/shai-build-trees/gcc-65011/x86_64-pc-linux-gnu/32/libstdc++-v3/include/x86_64-pc-linux-gnu -I /usr/local/tmp/shai-build-trees/gcc-65011/x86_64-pc-linux-gnu/32/libstdc++-v3/include -I /usr/src/gcc/9.1.0-212/libstdc++-v3/libsupc++ -I /usr/local/tmp/shai-build-trees/gcc-65011/x86_64-pc-linux-gnu/32/libstdc++-v3/include/backward --32 -o strstream.o strstream.s [...] Program received signal SIGSEGV, Segmentation fault. 0x000000000042820a in write_relocs (abfd=0x4c8640, sec=0x4e0f30, xxx=<optimized out>) at ../../gas/write.c:1244 1244 while ((r = *rp) != NULL) (gdb) print rp $1 = (struct reloc_list **) 0x4c87a0 (gdb) print *rp $2 = (struct reloc_list *) 0x6165727473727473 (gdb) print **rp Cannot access memory at address 0x6165727473727473 In 2.32, we instead get an assertion failure: /usr/bin/as: BFD (GNU Binutils) 2.32.0.20190624 assertion fail /usr/src/binutils/2.32-168/bfd/elf.c:3588 ... or, under GDB, a crash: GNU assembler version 2.32.0 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.32.0.20190628 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7cfafa0 in bfd_install_relocation (abfd=0x4c8640, reloc_entry=reloc_entry@entry=0x862b98, data_start=data_start@entry=0x861a90, data_start_offset=0, input_section=input_section@entry=0x7b5d78, error_message=error_message@entry=0x7fffffffd358) at ../../binutils/bfd/reloc.c:1026 1026 if (howto && howto->special_function) (gdb) bt #0 0x00007ffff7cfafa0 in bfd_install_relocation (abfd=0x4c8640, reloc_entry=reloc_entry@entry=0x862b98, data_start=data_start@entry=0x861a90, data_start_offset=0, input_section=input_section@entry=0x7b5d78, error_message=error_message@entry=0x7fffffffd358) at ../../binutils/bfd/reloc.c:1026 #1 0x0000000000427fca in install_reloc (sec=sec@entry=0x7b5d78, reloc=reloc@entry=0x862b98, fragp=fragp@entry=0x861a10, file=0x44bb27 " defined", line=0) at ../../binutils/gas/write.c:1173 #2 0x0000000000428bf7 in write_relocs (abfd=0x4c8640, sec=0x7b5d78, xxx=<optimized out>) at ../../binutils/gas/write.c:1324 #3 0x00007ffff7cfc38f in bfd_map_over_sections (abfd=0x4c8640, operation=operation@entry=0x4289f0 <write_relocs>, user_storage=user_storage@entry=0x0) at ../../binutils/bfd/section.c:1374 #4 0x000000000042ab4b in write_object_file () at ../../binutils/gas/write.c:2452 #5 0x00000000004043ae in main (argc=<optimized out>, argv=<optimized out>) at ../../binutils/gas/as.c:1386 (gdb) print howto $1 = (reloc_howto_type *) 0x7f00f7dc87a8 (gdb) print howto->special_function Cannot access memory at address 0x7f00f7dc87c0 -- 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