bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/32153] New: [2.43 regression]: ld: Failed to link llvm bitcode m


From: a.horodniceanu at proton dot me
Subject: [Bug ld/32153] New: [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file
Date: Sun, 08 Sep 2024 17:23:26 +0000

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

            Bug ID: 32153
           Summary: [2.43 regression]: ld: Failed to link llvm bitcode
                    module: Expected at most one ThinLTO module per
                    bitcode file
           Product: binutils
           Version: 2.43.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: a.horodniceanu at proton dot me
  Target Milestone: ---

Since commit a6f8fe0a9e9cbe871652e46ba7c22d5e9fb86208
(https://sourceware.org/bugzilla/show_bug.cgi?id=32083) the following started
failing:
---------
$ cat a.c
int main () {}
$ clang -c -flto=thin a.c
$ /usr/bin/gcc-14 -Wl,-v a.o -o a
-Wl,-plugin,/usr/lib/llvm/18/lib64/LLVMgold.so
collect2 version 14.2.1 20240905 040b979a08843806ea930a8d839dd94301323ebe
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld -plugin
/usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccsKV00t.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie
-z now -o a /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/14
-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v a.o -plugin
/usr/lib/llvm/18/lib64/LLVMgold.so -lgcc --push-state --as-needed -lgcc_s
--pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o
GNU ld (GNU Binutils) 2.43.50.20240815
/tmp/binutils-broken/ld/.libs/ld-new: error: Failed to link module a.o:
Expected at most one ThinLTO module per bitcode file
collect2: error: ld returned 1 exit status
---------

The command has been extracted from the ldc (LLVM D compiler) link invocation:
--------
$ cat a.d
void main () {}
$ CC=gcc-14 ldc2 -flto=thin a.d -v
<snip>
/usr/bin/gcc-14 a.o /usr/lib/ldc2/1.39/lib64/ldc_rt.dso.o -o a
-Wl,-plugin,/usr/lib/llvm/18/lib64/LLVMgold.so -Wl,-plugin-opt=thinlto
-Wl,-plugin-opt=mcpu=x86-64 -Wl,-plugin-opt=O0
-Wl,-plugin-opt=-function-sections -Wl,-plugin-opt=-data-sections
-L/usr/lib/ldc2/1.39/lib64 -L/usr/lib/clang/18/lib/linux -lphobos2-ldc-shared
-ldruntime-ldc-shared -Wl,-rpath,/usr/lib/ldc2/1.39/lib64 -Wl,--gc-sections
-lrt -ldl -lpthread -lm -m64
/tmp/binutils-broken/ld/.libs/ld-new: error: Failed to link module a.o:
Expected at most one ThinLTO module per bitcode file
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc-14 failed with status: 1
--------

To reproduce you need a newish version of gcc, one that contains
https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617277.html. The specific
version of gcc that I had:
--------
$ gcc-14 --version
gcc-14 (Gentoo Hardened 14.3.9999 p, commit
d676863b64b58bf73a7f26eea70f81aeba517b13) 14.2.1 20240905
040b979a08843806ea930a8d839dd94301323ebe
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--------

The commit that introduced the regression mentions an accompanying gcc fix:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116361 but even with it applied
the issue persists.

H.J., since you're the author of the commit, do you think that your fix is the
issue or is there some other problem?

-- 
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]