[Bug gprofng/30281] error: multiple definition of `pwrite@GLIBC_2.2'; on i586-linux-gnu

2023-03-28 Thread vladimir.mezentsev at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #2 from Vladimir Mezentsev  
---
See also Bug 30006 - Failure to build binutils-2.40 gprofng using gold

I use OL9 and gcc-11:
% uname -a
Linux localhost.localdomain 5.15.0-0.30.1.el9uek.x86_64 #2 SMP Mon Mar 21
14:34:58 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux

% gcc --version
gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2.2.0.3)
Copyright (C) 2021 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.

This small test demonstrates a problem:
% cat -n my.ver 
 1  GLIBC_2.1 {
 2global:
 3  myfunc;
 4  } ;
 5  

% cat -n x.c
 1  #ifdef USE_ASM
 2  __asm__(".symver myfunc_2_1,myfunc@GLIBC_2.1");
 3  #else
 4  __attribute__ ((__symver__ ("myfunc@GLIBC_2.1")))
 5  #endif
 6  int myfunc_2_1 () { return 1; }
 7  
 8  int myfunc () { return 1; }
 9  


I need to create a library with two functions: myfunc and myfunc@GLIBC_2.1:

1. "-fuse-ld=gold" failed:
 % gcc -fuse-ld=gold -shared  x.c  -fPIC -DPIC -Wl,--version-script
-Wl,./my.ver -o libx.so 
/bin/ld.gold: error: /tmp/cc9P7FqS.o: multiple definition of 'myfunc'
/bin/ld.gold: /tmp/cc9P7FqS.o: previous definition here
collect2: error: ld returned 1 exit status

2. "-fuse-ld=bfd -flto=auto" (or -flto=1) failed:
 % gcc -fuse-ld=bfd -flto=auto -shared  x.c  -fPIC -DPIC -Wl,--version-script
-Wl,./my.ver -o libx.so 
/bin/ld.bfd: /tmp/cc5Hhpvl.ltrans0.ltrans.o: in function `myfunc':
:(.text+0xb): multiple definition of `myfunc'
collect2: error: ld returned 1 exit status

3. "-DUSE_ASM -fuse-ld=bfd -flto=auto" passed:
 % gcc -DUSE_ASM -fuse-ld=bfd -flto=auto -shared  x.c  -fPIC -DPIC
-Wl,--version-script -Wl,./my.ver -o libx.so 

4. -fuse-ld=bfd without -flto passed too:
 % gcc -DUSE_ASM -fuse-ld=bfd -shared  x.c  -fPIC -DPIC -Wl,--version-script
-Wl,./my.ver -o libx.so 
 % gcc -fuse-ld=bfd -shared  x.c  -fPIC -DPIC -Wl,--version-script -Wl,./my.ver
-o libx.so 


 It looks like a compiler/ld bug.
The workaround is to configure a build with "-fuse-ld=bfd" and without -flto.

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


[Bug gprofng/30281] error: multiple definition of `pwrite@GLIBC_2.2'; on i586-linux-gnu

2023-03-28 Thread vladimir.mezentsev at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

Vladimir Mezentsev  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #1 from Vladimir Mezentsev  
---
I don't have SUSE Linux.
But I can reproduce the similar problem on OL9.
When I build libgp-sync.so (synctrace.) with -flto=auto or -flto=1, I see:
<>/synctrace.c:669: multiple definition of `pthread_cond_wait'
/bin/ld: /tmp/ccw8LL6P.ltrans0.ltrans.o: in function `pthread_cond_timedwait':
<>/synctrace.c:720: multiple definition of `pthread_cond_timedwait'
/bin/ld: /tmp/ccw8LL6P.ltrans0.ltrans.o: in function `pthread_join':
<>/synctrace.c:768: multiple definition of `pthread_join'
/bin/ld: /tmp/ccw8LL6P.ltrans0.ltrans.o: in function `sem_wait':
<>/synctrace.c:816: multiple definition of `sem_wait'
collect2: error: ld returned 1 exit status

It looks like a compiler bug.
But I don't know yet what a real problem is.

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