[Bug binutils/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-29 Thread usaonmonday at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

Andrey Sotnikov  changed:

   What|Removed |Added

 CC||usaonmonday at gmail dot com

--- Comment #11 from Andrey Sotnikov  ---
After my system updated (I suspect glibc 2.39), I started seeing these errors
during compilation:

/home/user/binutils-env/bin/ld: error: .libs/synctrace.o: multiple definition
of 'pthread_cond_wait'
/home/user/binutils-env/bin/ld: .libs/synctrace.o: previous definition here
/home/user/binutils-env/bin/ld: error: .libs/synctrace.o: multiple definition
of 'pthread_cond_timedwait'
/home/user/binutils-env/bin/ld: .libs/synctrace.o: previous definition here
/home/user/binutils-env/bin/ld: error: .libs/synctrace.o: multiple definition
of 'pthread_join'
/home/user/binutils-env/bin/ld: .libs/synctrace.o: previous definition here
/home/user/binutils-env/bin/ld: error: .libs/synctrace.o: multiple definition
of 'sem_wait'
/home/user/binutils-env/bin/ld: .libs/synctrace.o: previous definition here
collect2: error: ld returned 1 exit status

The culprit commit is
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=66f76c545b293f8b89fef0f996a3a48fa59fae61

Checked with GCC 13 and 14.

The failing command line was

gcc -shared -fPIC -DPIC .libs/synctrace.o -march=native -mtune=native
-Wl,--version-script
-Wl,../../../binutils-gdb/gprofng/libcollector/libgprofng.ver
-Wl,--no-as-needed -Wl,-lrt -Wl,-ldl -Wl,-soname -Wl,libgp-sync.so -o
.libs/libgp-sync.so

-fuse-ld=bfd does help.

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


[Bug binutils/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-29 Thread usaonmonday at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #13 from Andrey Sotnikov  ---
$ ld --version
GNU gold (GNU Binutils 2.41.50) 1.16
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.

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


[Bug binutils/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-29 Thread usaonmonday at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #15 from Andrey Sotnikov  ---
$ ld --version
GNU gold (GNU Binutils 2.42.0.20240530) 1.16

Same result. The full ld's command line captured with strace:

/home/user/binutils-env/bin/ld -plugin
/home/user/gcc-env/lib/gcc/x86_64-linux-gnu/14/liblto_plugin.so
-plugin-opt=/home/user/gcc-env/lib/gcc/x86_64-linux-gnu/14/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc1r18nR.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 -shared -o .libs/libgp-sync.so /lib/crti.o
/home/user/gcc-env/lib/gcc/x86_64-linux-gnu/14/crtbeginS.o
-L/home/user/gcc-env/lib/gcc/x86_64-linux-gnu/14 -L/lib -L/usr/lib
-L/home/user/gcc-env/lib -L/home/user/binutils-env/lib .libs/synctrace.o
--version-script ../../../binutils-gdb/gprofng/libcollector/libgprofng.ver
--no-as-needed -lrt -ldl -soname libgp-sync.so -lgcc --push-state --as-needed
-lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state
/home/user/gcc-env/lib/gcc/x86_64-linux-gnu/14/crtendS.o /lib/crtn.o

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


[Bug ld/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-30 Thread usaonmonday at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #17 from Andrey Sotnikov  ---
(In reply to H.J. Lu from comment #16)
> You were using gold, not ld.  Please pass -fuse-ld=bfd to GCC.

I am not sure I understand. I used ld. I verified with strace that there were
no other processes spawned. It just seems that ld was gold.

I mentioned -fuse-ld=bfd in my original post. It helped if I ran just the gcc
command line that linked .libs/libgp-sync.so. However, I am not sure how I
could pass -fuse-ld=bfd using configure/make. Adding -fuse-ld=bfd to CFLAGS and
LDFLAGS passed it to the libtool command line, but then libtool ignored it when
it actually invoked gcc for linking. It's probably a bug in the autotool
scripts.

Anyway, this being sad, my workaround was to rebuild the original binutils I
used to build the final binutils with --enable-gold=no. So, I'm good and don't
need support. I am merely passing on the information about the problem. It's up
to you, guys, what to do with it.

Best.
Andrey.

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


[Bug ld/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-06-01 Thread usaonmonday at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #19 from Andrey Sotnikov  ---
(In reply to H.J. Lu from comment #18)
> This is a different bug.  Please try
> 
> https://sourceware.org/pipermail/binutils/2024-June/134459.html

Thank you. Great job! 👍

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