https://sourceware.org/bugzilla/show_bug.cgi?id=30281
--- Comment #2 from Vladimir Mezentsev <vladimir.mezentsev at oracle dot com> --- 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 { 2 global: 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': <artificial>:(.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.