bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/31615] New: Hang when linking vorbis-tools


From: sam at gentoo dot org
Subject: [Bug ld/31615] New: Hang when linking vorbis-tools
Date: Sat, 06 Apr 2024 15:33:48 +0000

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

            Bug ID: 31615
           Summary: Hang when linking vorbis-tools
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

I noticed that building vorbis-tools-1.4.2 hangs and took > 10 minutes before I
killed it.

During the build, the hanging command is:
```
x86_64-pc-linux-gnu-gcc -O2 -Wall -ffast-math -fsigned-char -O3 -march=native
-mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe
-fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never
-frecord-gcc-switches -Wa,-O2 -Wa,-mtune=znver2 -Wstrict-aliasing
-Wfree-nonheap-object -Werror=lto-type-mismatch -Werror=strict-aliasing
-Werror=odr -Wstrict-aliasing -Wfree-nonheap-object -Werror=lto-type-mismatch
-Werror=strict-aliasing -Werror=odr -Wbuiltin-declaration-mismatch -ggdb3
-Wformat -Wformat-security -Waddress -Warray-bounds -Wfree-nonheap-object
-Wint-to-pointer-cast -Wmain -Wnonnull -Wodr -Wreturn-type
-Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstring-compare -Wuninitialized
-Wvarargs -Wl,-O1 -Wl,-z -Wl,pack-relative-relocs -flto=jobserver
-Wl,--defsym=__gentoo_check_ldflags__=0 -ggdb3 -o oggenc flac.o easyflac.o
oggenc.o audio.o encode.o platform.o resample.o skeleton.o  -Wl,--as-needed
../share/libutf8.a ../share/libgetopt.a -lvorbisenc -lvorbis -lFLAC -logg -lm
```

Reduced is:
```
gcc -o oggenc flac.o easyflac.o oggenc.o audio.o encode.o platform.o resample.o
skeleton.o  -Wl,--as-needed libutf8.a libgetopt.a libvorbisenc.so.2.0.12
libvorbis.so.0.4.9 libFLAC.so.12.1.0 libogg.so.0.8.5 -lm
```

* Appending -fuse-ld=mold makes it complete (I used mold as I used LTO so
needed the plugin support which lld didn't have here.)
* Dropping -Wl,--as-needed makes it complete.

gdb says:
```
0x00007fce71af2674 in _bfd_generic_link_add_one_symbol (info=0x5630c7418ea0
<link_info>, abfd=0x5630c86a12e0, name=0x5630c9014ef8 "ldexp", flags=<optimized
out>,
    section=0x7fce72114388 <_bfd_std_section+840>, value=0,
string=0x5630c9014ee0 "ldexp@@GLIBC_2.2.5", copy=false, collect=false,
hashp=0x7ffdfb92ea80)
    at /usr/src/debug/sys-devel/binutils-9999/binutils/bfd/linker.c:1477
1477          action = link_action[(int) row][prev];
(gdb) bt
#0  0x00007fce71af2674 in _bfd_generic_link_add_one_symbol (info=0x5630c7418ea0
<link_info>, abfd=0x5630c86a12e0, name=0x5630c9014ef8 "ldexp", flags=<optimized
out>,
    section=0x7fce72114388 <_bfd_std_section+840>, value=0,
string=0x5630c9014ee0 "ldexp@@GLIBC_2.2.5", copy=false, collect=false,
hashp=0x7ffdfb92ea80)
    at /usr/src/debug/sys-devel/binutils-9999/binutils/bfd/linker.c:1477
#1  0x00007fce71b3bfe2 in _bfd_elf_add_default_symbol (abfd=<optimized out>,
info=<optimized out>, h=0x5630c88fcc30, name=<optimized out>,
sym=0x5630c8e01400,
    sec=0x7fce72114158 <_bfd_std_section+280>, value=<optimized out>,
poldbfd=0x7ffdfb92ea68, dynsym=<synthetic pointer>)
    at /usr/src/debug/sys-devel/binutils-9999/binutils/bfd/elflink.c:2023
#2  elf_link_add_object_symbols (abfd=<optimized out>, info=<optimized out>) at
/usr/src/debug/sys-devel/binutils-9999/binutils/bfd/elflink.c:5419
#3  bfd_elf_link_add_symbols (abfd=<optimized out>, info=<optimized out>) at
/usr/src/debug/sys-devel/binutils-9999/binutils/bfd/elflink.c:6339
#4  0x00005630c72b5f9a in load_symbols (entry=entry@entry=0x5630c84d8370,
place=place@entry=0x7ffdfb92eb70) at
/usr/src/debug/sys-devel/binutils-9999/binutils/ld/ldlang.c:3129
#5  0x00005630c72a89a0 in open_input_bfds (s=0x5630c84d8370, os=<optimized
out>, mode=(OPEN_BFD_FORCE | OPEN_BFD_RESCAN))
    at /usr/src/debug/sys-devel/binutils-9999/binutils/ld/ldlang.c:3621
#6  0x00005630c72a8941 in open_input_bfds (s=0x5630c84d8350, os=<optimized
out>, mode=OPEN_BFD_RESCAN) at
/usr/src/debug/sys-devel/binutils-9999/binutils/ld/ldlang.c:3569
#7  0x00005630c72a7932 in lang_process () at
/usr/src/debug/sys-devel/binutils-9999/binutils/ld/ldlang.c:8248
#8  0x00005630c72afcb8 in main (argc=63, argv=<optimized out>) at
/usr/src/debug/sys-devel/binutils-9999/binutils/ld/ldmain.c:511
```

perf but perhaps not so insightful ;) says:
``
   100.00%  ld       libbfd-2.42.50.20240406.gentoo-sys-devel-binutils-mt.so 
[.] _bfd_generic_link_add_one_symbol
     0.00%  ld       [kernel.kallsyms]                                       
[k] stackleak_erase
     0.00%  ld       [kernel.kallsyms]                                       
[k] arch_perf_update_userpage
     0.00%  ld       [kernel.kallsyms]                                       
[k] perf_ibs_handle_irq
     0.00%  ld       [kernel.kallsyms]                                       
[k] perf_ibs_start
```

```
$ ld --version | head -1
GNU ld (Gentoo 9999 p1) 2.42.50.20240406
```

I can try reduce it to C if needed but it will take more time. I have attached
a reproducible tarball with object files. Tell me if need to do anything else.
Thanks.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]