[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LLVM/lldb FTBFS with undefined reference to `__atomic_load_8'g




On Sun, Dec 08, 2013 at 22:21:14PM +0100, Aurelien Jarno wrote:

> On Wed, Dec 04, 2013 at 06:12:53PM +0100, Sylvestre Ledru wrote:
> > Le 04/12/2013 04:19, YunQiang Su a écrit :
> > > On Wed, Dec 4, 2013 at 12:34 AM, Sylvestre Ledru <sylvestre@debian.org> wrote:
> > >> Hello,
> > >>
> > >> Under both mips & mipsel, lldb (from both llvm-toolchain-3.3 and -3.4)
> > >> fails to build from sources with:
> > >>
> > >> /usr/include/c++/4.8/bits/atomic_base.h:496: undefined reference to `__atomic_load_8'
> > > All of 3.3/3.4/3.5 can be built successfully on mips64el.
> > I am not familiar with the mips*. What could explain the difference
> > between mips64el and the 2 others?
> >


>

> From the name it seems that it is trying to load a 8-bytes word > atomically. We can't provide that on a 32-bit architecture, and I think > other 32-bit architectures might have the same problem. Or maybe LLVM > wrongly detects the machine as 64-bit (as it has a 64-bit kernel), and > thus try to use 64-bit atomic functions.

Hi,

The problem appears while linking liblldb.so.

In a class Address there is a member variable std::atomic<lldb::addr_t> m_offset
where addr_t is defined as uint64_t.

When loading and storing variables of this type, GCC generates calls to library
functions __atomic_load_8 and __atomic_store_8. These functions are implemented in
library libatomic, and GCC added support for libatomic starting from version 4.8.

So, to avoid this error it is needed to link liblldb.so whit libatomic.

After I add "-latomic" in LDFLAGS for llbd, lldb compiled successfully for me.



Regards,
Dejan Latinović



Reply to: