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

            Bug ID: 47123
           Summary: lld fails to build on targets that need -latomic
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedb...@nondot.org
          Reporter: jist...@redhat.com
                CC: llvm-bugs@lists.llvm.org, smithp...@googlemail.com

In Rust CI, while trying to upgrade to LLVM 11 rc1, arm-unknown-linux-gnueabi
failed to link lld due to missing symbols for Timer.cpp:

https://github.com/rust-lang/rust/pull/73526#issuecomment-671549737

> [100%] Linking CXX executable ../../bin/lld
> /x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/8.3.0/../../../../arm-unknown-linux-gnueabi/bin/ld:
>  ../../lib/liblldCommon.a(Timer.cpp.o): in function 
> `lld::ScopedTimer::stop()':
> Timer.cpp:(.text._ZN3lld11ScopedTimer4stopEv+0x44): undefined reference to 
> `__atomic_fetch_add_8'
> /x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/8.3.0/../../../../arm-unknown-linux-gnueabi/bin/ld:
>  ../../lib/liblldCommon.a(Timer.cpp.o): in function `lld::Timer::millis() 
> const':
> Timer.cpp:(.text._ZNK3lld5Timer6millisEv+0x8): undefined reference to 
> `__atomic_load_8'
> /x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/8.3.0/../../../../arm-unknown-linux-gnueabi/bin/ld:
>  ../../lib/liblldCommon.a(Timer.cpp.o): in function `lld::Timer::print(int, 
> double, bool) const':
> Timer.cpp:(.text._ZNK3lld5Timer5printEidb+0x2c0): undefined reference to 
> `__atomic_load_8'
> /x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/8.3.0/../../../../arm-unknown-linux-gnueabi/bin/ld:
>  ../../lib/liblldCommon.a(Timer.cpp.o): in function `lld::Timer::print()':
> Timer.cpp:(.text._ZN3lld5Timer5printEv+0x34): undefined reference to 
> `__atomic_load_8'

This can be solved by linking libatomic on targets that need it. I've tried to
add this in https://reviews.llvm.org/D85691, but it seems that the use of
atomics for Timer at all is controversial.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to