https://sourceware.org/bugzilla/show_bug.cgi?id=32690

            Bug ID: 32690
           Summary: ld internal error (internal error binutils/ld/ldlang.c
                    6618) with LTO
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

I'm sorry for the lack of a source testcase.

```
$ ./test.sh
+ x86_64-pc-linux-gnu-gcc -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true
-DELF_PLT_UNWIND_LIST_OPTIONS=true -O3 -ggdb3 -fno-lto -std=gnu17 -O3 -pipe
-fcf-protection=none -Wl,-O1 -Wl,-z -Wl,pack-relative-relocs -flto=jobserver
-fno-lto -Wl,--undefined-version -o ld-new ldgram.o ldlex-wrapper.o lexsup.o
ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o
ldfile.o ldcref.o plugin.o ldbuildid.o eaix5ppc.o eaix5rs6.o eaixppc.o
eaixrs6.o ealpha.o ealphavms.o earcelf.o earclinux.o earclinux_nps.o
earcv2elf.o earcv2elfx.o earm_wince_pe.o earmelf.o earmelf_fbsd.o
earmelf_fuchsia.o earmelf_haiku.o earmelf_linux.o earmelf_linux_eabi.o
earmelf_linux_fdpiceabi.o earmelf_nacl.o earmelf_nbsd.o earmelf_phoenix.o
earmelf_vxworks.o earmelfb.o earmelfb_fbsd.o earmelfb_fuchsia.o
earmelfb_linux.o earmelfb_linux_eabi.o earmelfb_linux_fdpiceabi.o
earmelfb_nacl.o earmelfb_nbsd.o earmnto.o earmpe.o eavr1.o eavr2.o eavr25.o
eavr3.o eavr31.o eavr35.o eavr4.o eavr5.o eavr51.o eavr6.o eavrtiny.o
eavrxmega1.o eavrxmega2.o eavrxmega3.o eavrxmega4.o eavrxmega5.o eavrxmega6.o
eavrxmega7.o ecrisaout.o ecriself.o ecrislinux.o ecskyelf.o ecskyelf_linux.o
ed10velf.o ed30v_e.o ed30v_o.o ed30velf.o eelf32_dlx.o eelf32_sparc.o
eelf32_sparc_sol2.o eelf32_sparc_vxworks.o eelf32_spu.o eelf32_tic6x_be.o
eelf32_tic6x_elf_be.o eelf32_tic6x_elf_le.o eelf32_tic6x_le.o
eelf32_tic6x_linux_be.o eelf32_tic6x_linux_le.o eelf32am33lin.o eelf32bfin.o
eelf32bfinfd.o eelf32cr16.o eelf32crx.o eelf32epiphany.o eelf32epiphany_4x4.o
eelf32fr30.o eelf32frv.o eelf32frvfd.o eelf32ft32.o eelf32ip2k.o eelf32iq10.o
eelf32iq2000.o eelf32lm32.o eelf32lm32fd.o eelf32lppc.o eelf32lppclinux.o
eelf32lppcnto.o eelf32lppcsim.o eelf32m32c.o eelf32mb_linux.o
eelf32mbel_linux.o eelf32mcore.o eelf32mep.o eelf32metag.o eelf32microblaze.o
eelf32microblazeel.o eelf32moxie.o eelf32mt.o eelf32or1k.o eelf32or1k_linux.o
eelf32ppc.o eelf32ppc_fbsd.o eelf32ppchaiku.o eelf32ppclinux.o eelf32ppcnto.o
eelf32ppcsim.o eelf32ppcvxworks.o eelf32ppcwindiss.o eelf32rl78.o eelf32rx.o
eelf32rx_linux.o eelf32tilegx.o eelf32tilegx_be.o eelf32tilepro.o eelf32vax.o
eelf32visium.o eelf32xstormy16.o eelf32xtensa.o eelf32z80.o eelf_i386.o
eelf_i386_be.o eelf_i386_fbsd.o eelf_i386_haiku.o eelf_i386_ldso.o
eelf_i386_sol2.o eelf_i386_vxworks.o eelf_iamcu.o eelf_s390.o eh8300elf.o
eh8300elf_linux.o eh8300helf.o eh8300helf_linux.o eh8300hnelf.o eh8300self.o
eh8300self_linux.o eh8300snelf.o eh8300sxelf.o eh8300sxelf_linux.o
eh8300sxnelf.o ehppaelf.o ehppalinux.o ehppanbsd.o ehppaobsd.o ei386aout.o
ei386beos.o ei386bsd.o ei386go32.o ei386lynx.o ei386moss.o ei386msdos.o
ei386nto.o ei386pe.o ei386pe_posix.o em32relf.o em32relf_linux.o em32rlelf.o
em32rlelf_linux.o em68hc11elf.o em68hc11elfb.o em68hc12elf.o em68hc12elfb.o
em68kelf.o em68kelfnbsd.o em9s12zelf.o emcorepe.o emn10200.o emn10300.o
emoxiebox.o emsp430X.o emsp430elf.o ends32belf.o ends32belf16m.o
ends32belf_linux.o ends32elf.o ends32elf16m.o ends32elf_linux.o enios2elf.o
enios2linux.o ens32knbsd.o epc532macha.o epdp11.o epjelf.o epjlelf.o
eppcmacos.o epruelf.o escore3_elf.o escore7_elf.o esh.o eshelf.o eshelf_fd.o
eshelf_linux.o eshelf_nbsd.o eshelf_nto.o eshelf_uclinux.o eshelf_vxworks.o
eshl.o eshlelf.o eshlelf_fd.o eshlelf_linux.o eshlelf_nbsd.o eshlelf_nto.o
eshlelf_vxworks.o eshpe.o etic30coff.o etic3xcoff.o etic3xcoff_onchip.o
etic4xcoff.o etic54xcoff.o ev850.o ev850_rh850.o evanilla.o evaxnbsd.o
exgateelf.o ez80.o ez8001.o ez8002.o eaarch64cloudabi.o eaarch64cloudabib.o
eaarch64elf.o eaarch64elf32.o eaarch64elf32b.o eaarch64elfb.o eaarch64fbsd.o
eaarch64fbsdb.o eaarch64haiku.o eaarch64linux.o eaarch64linux32.o
eaarch64linux32b.o eaarch64linuxb.o eaarch64pe.o eelf32_x86_64.o eelf32b4300.o
eelf32bmip.o eelf32bmipn32.o eelf32briscv.o eelf32briscv_ilp32.o
eelf32briscv_ilp32f.o eelf32bsmip.o eelf32btsmip.o eelf32btsmip_fbsd.o
eelf32btsmipn32.o eelf32btsmipn32_fbsd.o eelf32ebmip.o eelf32ebmipvxworks.o
eelf32elmip.o eelf32elmipvxworks.o eelf32l4300.o eelf32lmip.o eelf32loongarch.o
eelf32lr5900.o eelf32lr5900n32.o eelf32lriscv.o eelf32lriscv_ilp32.o
eelf32lriscv_ilp32f.o eelf32lsmip.o eelf32ltsmip.o eelf32ltsmip_fbsd.o
eelf32ltsmipn32.o eelf32ltsmipn32_fbsd.o eelf32mipswindiss.o eelf64_aix.o
eelf64_ia64.o eelf64_ia64_fbsd.o eelf64_ia64_vms.o eelf64_s390.o eelf64_sparc.o
eelf64_sparc_fbsd.o eelf64_sparc_sol2.o eelf64alpha.o eelf64alpha_fbsd.o
eelf64alpha_nbsd.o eelf64bmip.o eelf64bpf.o eelf64briscv.o eelf64briscv_lp64.o
eelf64briscv_lp64f.o eelf64btsmip.o eelf64btsmip_fbsd.o eelf64hppa.o
eelf64loongarch.o eelf64lppc.o eelf64lppc_fbsd.o eelf64lriscv.o
eelf64lriscv_lp64.o eelf64lriscv_lp64f.o eelf64ltsmip.o eelf64ltsmip_fbsd.o
eelf64mmix.o eelf64ppc.o eelf64ppc_fbsd.o eelf64rdos.o eelf64tilegx.o
eelf64tilegx_be.o eelf_mipsel_haiku.o eelf_x86_64.o eelf_x86_64_cloudabi.o
eelf_x86_64_fbsd.o eelf_x86_64_haiku.o eelf_x86_64_sol2.o ehppa64linux.o
ei386pep.o emmo.o deffilep.o pdb.o pe-dll.o ldelf.o ldelfgen.o pep-dll.o
-Wl,--as-needed libbfd.so libctf.so libbfd.so libsframe.so -liberty libiberty.a
-lz -lzstd -Wl,-rpath -Wl,/tmp/foo
/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld:
internal error
/var/tmp/portage/sys-devel/binutils-9999/work/binutils/ld/ldlang.c 6618
collect2: error: ld returned 1 exit status
```

```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/15
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python
--enable-objc-gc --enable-languages=c,c++,d,go,objc,obj-c++,fortran,ada,m2,rust
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 15.0.9999 p, commit
2f8447a89b5426413f54aa0153448c0e1c45a4c8' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point
--enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-libada --disable-cet --disable-systemtap --enable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --with-zstd --with-isl
--disable-isl-version-check --enable-default-pie --enable-host-pie
--enable-host-bind-now --enable-default-ssp --disable-fixincludes
--with-build-config='bootstrap-O3 bootstrap-lto'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250212 (experimental)
cfdb961588ba318a78e995d2e2cde43130acd993 (Gentoo Hardened 15.0.9999 p, commit
2f8447a89b5426413f54aa0153448c0e1c45a4c8)

$ ld --version
GNU ld (Gentoo 9999 p1) 2.44.50.20250213
Copyright (C) 2025 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.
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to