https://sourceware.org/bugzilla/show_bug.cgi?id=30155
Bug ID: 30155 Summary: ld: Segfault in _bfd_nearby_section with custom linker scripts Product: binutils Version: 2.41 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- The following fails: $ cat t1.ld SECTIONS { a : { b = .; } } INSERT BEFORE .text.start $ cat t2.ld SECTIONS { a = .; .text.start 0 : { c = .; } } $ echo nop | aarch64-none-elf-as -o t.o $ aarch64-none-elf-ld --version GNU ld (GNU Binutils) 2.40.50.20230222 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. $ aarch64-none-elf-ld t.o -T t1.ld -T t2.ld Segmentation fault (core dumped) Looking in GDB the backtrace is as follows: (gdb) r Starting program: /data_sdb/toolchain/bu/dbg-aarch64/bin/aarch64-none-elf-ld t.o -T t1.ld -T t2.ld Program received signal SIGSEGV, Segmentation fault. 0x00005555555e33a8 in _bfd_nearby_section (obfd=0x5555559fa4c0, s=0x5555559eed90 <_bfd_std_section+560>, addr=0) at /home/alecop01/toolchain/src/binutils-gdb/bfd/linker.c:2986 2986 next = s->owner->sections; (gdb) bt #0 0x00005555555e33a8 in _bfd_nearby_section (obfd=0x5555559fa4c0, s=0x5555559eed90 <_bfd_std_section+560>, addr=0) at /home/alecop01/toolchain/src/binutils-gdb/bfd/linker.c:2986 #1 0x00005555555e35fa in fix_syms (h=0x555555a067e0, data=0x5555559fa4c0) at /home/alecop01/toolchain/src/binutils-gdb/bfd/linker.c:3056 #2 0x00005555555df598 in bfd_link_hash_traverse (htab=0x5555559fc850, func=0x5555555e3522 <fix_syms>, info=0x5555559fa4c0) at /home/alecop01/toolchain/src/binutils-gdb/bfd/linker.c:671 #3 0x00005555555e3657 in _bfd_fix_excluded_sec_syms (obfd=0x5555559fa4c0, info=0x5555559f3980 <link_info>) at /home/alecop01/toolchain/src/binutils-gdb/bfd/linker.c:3068 #4 0x00005555555b48f9 in finish_default () at /home/alecop01/toolchain/src/binutils-gdb/ld/ldemul.c:303 #5 0x00005555555bcad5 in gldaarch64elf_finish () at eaarch64elf.c:325 #6 0x00005555555b43db in ldemul_finish () at /home/alecop01/toolchain/src/binutils-gdb/ld/ldemul.c:108 #7 0x00005555555a8909 in lang_process () at /home/alecop01/toolchain/src/binutils-gdb/ld/ldlang.c:8206 #8 0x00005555555ad42c in main (argc=6, argv=0x7fffffffbe68) at /home/alecop01/toolchain/src/binutils-gdb/ld/ldmain.c:501 -- You are receiving this mail because: You are on the CC list for the bug.