[Bug ld/32153] New: [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file

2024-09-08 Thread a.horodniceanu at proton dot me
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

/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. 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.


[Bug ld/32153] [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file

2024-09-08 Thread a.horodniceanu at proton dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=32153

Andrei Horodniceanu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

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


[Bug ld/32153] [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file

2024-09-08 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=32153

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

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


[Bug ld/32083] lto1: fatal error: multiple prevailing defs for ‘func’

2024-09-08 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=32083

Sam James  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=32153

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


[Bug ld/32153] [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file

2024-09-08 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=32153

Sam James  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=32083

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


[Bug binutils/32154] New: Binutils: libiberty: WINAPI functions used with chars instead of trivial chars.

2024-09-08 Thread carlo.bramix at libero dot it
https://sourceware.org/bugzilla/show_bug.cgi?id=32154

Bug ID: 32154
   Summary: Binutils: libiberty: WINAPI functions used with chars
instead of trivial chars.
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: carlo.bramix at libero dot it
  Target Milestone: ---

While doing my test with the experimental support for aarch64-w64-ming32, I
found few mistakes into libiberty, when the environment is configured as
UNICODE.
The problems come out because because some Windows API functions are called
with plain chars strings, while they should be trivial chars.
Hopefully, the fix is very simple to do.
In other words, something like:

conout_handle = CreateFile("CONOUT$",

must be replaced with:

conout_handle = CreateFile(TEXT("CONOUT$"),

so that it can work when CreateFile() is set to CreateFileW() rather than
CreateFileA() and viceversa.
Hopefully, there are just few points laking this.

Attached patch fixes these mistakes.

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


[Bug binutils/32154] Binutils: libiberty: WINAPI functions used with chars instead of trivial chars.

2024-09-08 Thread carlo.bramix at libero dot it
https://sourceware.org/bugzilla/show_bug.cgi?id=32154

--- Comment #1 from Carlo Bramini  ---
Created attachment 15696
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15696&action=edit
Fix for this issue.

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


[Bug ld/32153] [2.43 regression]: ld: Failed to link llvm bitcode module: Expected at most one ThinLTO module per bitcode file

2024-09-08 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=32153

--- Comment #1 from H.J. Lu  ---
This is very similar to

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116361

LLVM could implement LDPT_REGISTER_CLAIM_FILE_HOOK_V2:

https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617277.html

/* Callback used by a linker to check if the plugin can claim FILE.
   Writes the result in CAN_BE_CLAIMED.  If KNOWN_USED != 0, the object
   is known by the linker to be included in link output, or an older API
   version is in use that does not provide that information.  Otherwise,
   the linker is only determining whether this is a plugin object and
   only the symbol table is needed by the linker.  In this case, the
   object should not be included in link output and this function will
   be called by the linker again with KNOWN_USED != 0 after the linker
   decides the object should be included in link output. */

This change:

diff --git a/bfd/plugin.c b/bfd/plugin.c
index f6c6fdbee69..b481c35115f 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -597,7 +597,7 @@ static bfd_cleanup
 bfd_plugin_object_p (bfd *abfd)
 {
   if (ld_plugin_object_p)
-return ld_plugin_object_p (abfd, false);
+return ld_plugin_object_p (abfd, true);

   if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
 return NULL;

works for this test.  I don't think that it will work for all cases.

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


[Bug admin/31881] binutils-gdb Git repository is flooded by automatic commits

2024-09-08 Thread rostiprodev at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31881

--- Comment #23 from Rostislav Krasny  ---
Hi,

Is there any update regarding this ticket?

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