[llvm-bugs] [Bug 49226] [lld] Errors about duplicate gcov symbols after 8f91f38

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 18 15:20:04 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49226

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |i at maskray.me
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Fangrui Song <i at maskray.me> ---
This is assuredly a
rustlib/x86_64-unknown-linux-gnu/lib/libprofiler_builtins-a2dfa79aebcd4dda.rlib
issue.

[task 2021-02-17T15:08:41.732Z] 15:08:41     INFO -            >>> defined at
GCDAProfiling.c:653
(../../src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:653)
[task 2021-02-17T15:08:41.732Z] 15:08:41     INFO -            >>>           
GCDAProfiling.o:(__gcov_dump) in archive
/builds/worker/fetches/rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/libprofiler_builtins-a2dfa79aebcd4dda.rlib
[task 2021-02-17T15:08:41.732Z] 15:08:41     INFO -            >>> defined at
GCDAProfiling.c
[task 2021-02-17T15:08:41.732Z] 15:08:41     INFO -            >>>           
GCDAProfiling.c.o:(.text.__gcov_dump+0x0) in archive
/builds/worker/fetches/clang/lib/clang/12.0.0/lib/linux/libclang_rt.profile-x86_64.a

I guess libprofiler_builtins-a2dfa79aebcd4dda.rlib probably shadows some
definitions in libclang_rt.profile-x86_64.a . Some had been working, until
ld.lld started to follow GNU ld behavior and made this trick stop working.

Historically common symbols don't have greatly defined behaviors.

Any object file with common symbols (SHN_COMMON or (rare) STT_COMMON) may
observed changed behaviors with the LLD patch.

LLD<12, gold, macOS ld64 and GNU ld before 1999-12 have the --no-fortran-common
behavior.
LLD>=12, GNU ld since 1999-12 have the --fortran-common behavior.

clang 11 and gcc 10 default to -fno-common, so you probably will not observe
SHN_COMMON from C code with newer compilers.

It is indeed unfortunate that LLD changed the behavior to convenience some
legacy PowerPC users and I do hope one day we can forget common symbols. But
the linker does not really provide promise here.


libprofiler_builtins-a2dfa79aebcd4dda.rlib likely has some common symbols. You
can inspect them with readelf -Ws. Converting them from common symbols to
regular definitions is the appropriate fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210218/f5658417/attachment.html>


More information about the llvm-bugs mailing list