[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH RFC] configure: fix clang failure for libatomic
From: |
Peter Maydell |
Subject: |
Re: [Qemu-ppc] [PATCH RFC] configure: fix clang failure for libatomic |
Date: |
Tue, 25 Apr 2017 10:32:28 +0100 |
On 25 April 2017 at 10:16, Nikunj A Dadhania <address@hidden> wrote:
> Peter Maydell <address@hidden> writes:
>
>> On 25 April 2017 at 09:58, Nikunj A Dadhania <address@hidden> wrote:
>>> /tmp/atomic-1660e0.o: In function `main':
>>> /tmp/atomic.c:(.text+0x28): undefined reference to `__atomic_load_8'
>>> /tmp/atomic.c:(.text+0x40): undefined reference to `__atomic_store_8'
>>> /tmp/atomic.c:(.text+0x69): undefined reference to
>>> `__atomic_compare_exchange_8'
>>> /tmp/atomic.c:(.text+0x7d): undefined reference to `__atomic_exchange_8'
>>> /tmp/atomic.c:(.text+0x91): undefined reference to
>>> `__atomic_fetch_add_8'
>>> clang-3.9: error: linker command failed with exit code 1 (use -v to see
>>> invocation)
>>>
>>> With -latomic, the linker succeeds in getting the binary.
>>
>> What host is this on ?
>
> $ uname -a
> Linux abhimanyu 4.9.13-200.fc25.x86_64 #1 SMP Mon Feb 27 16:48:42 UTC 2017
> x86_64 x86_64 x86_64 GNU/Linux
Hmm, I can repro that, but there's a problem even if we do link against
libatomic. If you disassemble the resulting binaries, gcc produces
what we want:
f0 48 01 45 e8 lock add %rax,-0x18(%rbp)
and other inline atomic instructions.
clang on the other hand produces
e8 33 fe ff ff callq 400610 <address@hidden>
which is an expensive call to an out of line subroutine.
We need to figure out how to get clang to just emit the inline
operations.
thanks
-- PMM
Re: [Qemu-ppc] [PATCH RFC] configure: fix clang failure for libatomic, Richard Henderson, 2017/04/25