Seen on x86_64-linux with current gcc-9. gcctestdir/collect-ld: internal error in set_section_addresses, at /home/alan/src/binutils-gdb/gold/output.cc:4441 collect2: error: ld returned 1 exit status Makefile:9426: recipe for target 'incremental_copy_test' failed
Hi, Is it a dup of PR23539 ? Cheers, Romain
It may well be the same underlying bug, but .note.gnu.property was not generated by my gcc-9 compiler for any of the incremental_copy_test objects. (I don't have an Intel CET capable CPU.)
The issue comes from `.rodata` section, as it isn't directly emitted in gcc-9, when using the `-fmerge-constants` flag. Looking at copy_test_v1.o, produced by gcc-9: $ readelf --sections copy_test_v1.o ... [ 7] .rodata.str1.1 PROGBITS 0000000000000000 0000000000000100 0 000000000000002a 0000000000000001 0 1 [0000000000000032]: ALLOC, MERGE, STRINGS [ 8] .rodata.str1.8 PROGBITS 0000000000000000 0000000000000130 0 0000000000000065 0000000000000001 0 8 [0000000000000032]: ALLOC, MERGE, STRINGS ... Now one by gcc-8: $ readelf --sections copy_test_v1.o ... [ 7] .rodata.str1.8 PROGBITS 0000000000000000 0000000000000100 0 000000000000004c 0000000000000001 0 8 [0000000000000032]: ALLOC, MERGE, STRINGS [ 8] .rodata.str1.1 PROGBITS 0000000000000000 000000000000014c 0 000000000000001f 0000000000000001 0 1 [0000000000000032]: ALLOC, MERGE, STRINGS [ 9] .rodata PROGBITS 0000000000000000 0000000000000170 0 000000000000000b 0000000000000000 0 8 [0000000000000002]: ALLOC ... This is the output of `gold` using the `--debug=incremental` flag on the gcc-9 object: gcctestdir/collect-ld: Free_list::allocate(00000018, 8, 00000540) gcctestdir/collect-ld: set_section_list_addresses: 00000540 00000018 .rela.plt gcctestdir/collect-ld: set_section_list_addresses: 000005a8 0000001b .init gcctestdir/collect-ld: set_section_list_addresses: 000005d0 00000020 .plt gcctestdir/collect-ld: set_section_list_addresses: 000005f0 00000470 .text gcctestdir/collect-ld: set_section_list_addresses: 00000a60 0000000d .fini gcctestdir/collect-ld: set_section_list_addresses: 000001c8 0000001c .interp gcctestdir/collect-ld: set_section_list_addresses: 00000a70 00000130 .rodata gcctestdir/collect-ld: set_section_list_addresses: 00000ba0 000000e4 .eh_frame gcctestdir/collect-ld: Free_list::allocate(00000092, 8, 00000a6d) gcctestdir/collect-ld: set_section_list_addresses: 00000c88 00000092 .rodata gcctestdir/collect-ld: Free_list::allocate(00000200, 8, 00000d1a) gcctestdir/collect-ld: set_section_list_addresses: 00001ad8 00000200 .dynamic gcctestdir/collect-ld: set_section_list_addresses: 00000eb8 00000040 .got gcctestdir/collect-ld: set_section_list_addresses: 00000ef8 00000020 .got.plt gcctestdir/collect-ld: set_section_list_addresses: 00000f18 00000030 .data gcctestdir/collect-ld: set_section_list_addresses: 00000f48 00000000 .tm_clone_table gcctestdir/collect-ld: set_section_list_addresses: 00000f48 00000008 .fini_array gcctestdir/collect-ld: set_section_list_addresses: 00000f50 00000008 .init_array gcctestdir/collect-ld: internal error in set_section_addresses, at /mnt/hdd/hdd_workspace/binutils-project/build/gold/../../binutils-gdb/gold/output.cc:4453 collect2: error: ld returned 1 exit status The output using the same flag on `gold`, but instead using the gcc-8 object: gcctestdir/collect-ld: Free_list::allocate(00000018, 8, 00000540) gcctestdir/collect-ld: set_section_list_addresses: 00000540 00000018 .rela.plt gcctestdir/collect-ld: set_section_list_addresses: 000005a8 0000001b .init gcctestdir/collect-ld: set_section_list_addresses: 000005d0 00000020 .plt gcctestdir/collect-ld: set_section_list_addresses: 000005f0 00000470 .text gcctestdir/collect-ld: set_section_list_addresses: 00000a60 0000000d .fini gcctestdir/collect-ld: set_section_list_addresses: 000001c8 0000001c .interp gcctestdir/collect-ld: set_section_list_addresses: 00000a70 00000108 .rodata gcctestdir/collect-ld: set_section_list_addresses: 00000b78 000000e4 .eh_frame gcctestdir/collect-ld: Free_list::allocate(00000200, 8, 00000c5c) gcctestdir/collect-ld: set_section_list_addresses: 00000c60 00000200 .dynamic gcctestdir/collect-ld: set_section_list_addresses: 00000e90 00000040 .got gcctestdir/collect-ld: set_section_list_addresses: 00000ed0 00000020 .got.plt gcctestdir/collect-ld: set_section_list_addresses: 00000ef0 00000030 .data gcctestdir/collect-ld: set_section_list_addresses: 00000f20 00000000 .tm_clone_table gcctestdir/collect-ld: set_section_list_addresses: 00000f20 00000008 .fini_array gcctestdir/collect-ld: set_section_list_addresses: 00000f28 00000008 .init_array gcctestdir/collect-ld: set_section_list_addresses: 00000f30 00000030 .bss The gcc-9 object output shows two `.rodata` sections being created, and this seems to be the underlying issue.
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f12650bff1a591357c26e0ef6d7be0323f76fdb8 commit f12650bff1a591357c26e0ef6d7be0323f76fdb8 Author: Cary Coutant <ccoutant@gmail.com> Date: Sun Dec 13 15:19:41 2020 -0800 Fix incremental linking with rodata merge sections. When processing the incremental update, incoming .rodata merge sections do not match the corresponding section in the base file, because the SHF_MERGE flag had not been masked out of the latter. gold/ PR gold/24123 * layout.cc (Layout::init_fixed_output_section): Mask out flags that should be ignored when matching sections.
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f22318ef0db86d623e11efbd8936430f38484f69 commit f22318ef0db86d623e11efbd8936430f38484f69 Author: Cary Coutant <ccoutant@gmail.com> Date: Sun Dec 13 16:50:13 2020 -0800 Re-enable incremental tests that were failing with GCC 9+. gold/ PR gold/23539 PR gold/24123 * testsuite/Makefile.am (incremental_copy_test): Re-enable for GCC 9+. (incremental_comdat_test_1): Likewise. * testsuite/Makefile.in: Regenerate.
Fixed on trunk.