[llvm-commits] [llvm] r96569 - in /llvm/trunk: Makefile Makefile.config.in Makefile.rules autoconf/configure.ac configure test/Makefile test/Unit/lit.cfg test/Unit/lit.site.cfg.in tools/llvm-shlib/ unittests/Makefile.unittest

Jeffrey Yasskin jyasskin at google.com
Thu Feb 18 08:46:57 PST 2010


On Thu, Feb 18, 2010 at 2:53 AM, Xerxes Rånby <xerxes at zafena.se> wrote:
> Jeffrey Yasskin wrote:
>> Author: jyasskin
>> Date: Wed Feb 17 22:43:02 2010
>> New Revision: 96569
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=96569&view=rev
>> Log:
>> Roll back the shared library, r96559.  It broke two darwins and arm, mysteriously.
>>
>>
> Hi
> The failure on arm:
>
> llvm[1]: Linking Debug Shared Library LLVM2.7svn.so
> /wd/buildbot/llvm-arm-linux/llvm/Debug/lib/libLLVMSystem.a(Atomic.o): In function `llvm::sys::AtomicAdd(unsigned int volatile*, unsigned int)':
> /wd/buildbot/llvm-arm-linux/llvm/lib/System/Atomic.cpp:86: undefined reference to `__sync_add_and_fetch_4'
> /wd/buildbot/llvm-arm-linux/llvm/Debug/lib/libLLVMSystem.a(Atomic.o): In function `llvm::sys::AtomicIncrement(unsigned int volatile*)':
> /wd/buildbot/llvm-arm-linux/llvm/lib/System/Atomic.cpp:60: undefined reference to `__sync_add_and_fetch_4'
> /wd/buildbot/llvm-arm-linux/llvm/Debug/lib/libLLVMSystem.a(Atomic.o): In function `llvm::sys::AtomicDecrement(unsigned int volatile*)':
> /wd/buildbot/llvm-arm-linux/llvm/lib/System/Atomic.cpp:73: undefined reference to `__sync_sub_and_fetch_4'
> /wd/buildbot/llvm-arm-linux/llvm/Debug/lib/libLLVMSystem.a(Atomic.o): In function `llvm::sys::CompareAndSwap(unsigned int volatile*, unsigned int, unsigned int)':
> /wd/buildbot/llvm-arm-linux/llvm/lib/System/Atomic.cpp:47: undefined reference to `__sync_val_compare_and_swap_4'
> collect2: ld returned 1 exit status
>
> I have seen something similar about one year ago when we tried to make
> libCompileDriver a shared library:
> http://markmail.org/message/cblcpfmsfab65vue
>
> The issue are that the symbol __sync_add_and_fetch_4 and friends do
> exists in libstdc++ but only in the static version.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40133
> Quoted Mikael Pettersson from
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40133#c8
> "
> 1. g++ links shared libraries with -shared-libgcc, which apparently is
> important whenever exceptions are possible.
> 2. -shared-libgcc by definition excludes the static libgcc from the link
> command.
> 3. Since the __sync__ procedures are only present in the static libgcc,
> it follows that they cannot be used by -shared-libgcc objects like
> libstdc++.so.
> "
>
> A workaround might be to specify -lgcc to force linking in the static
> libstdc++ that contains the missing symbols.
>
> Good news are that it looks like this bug should have been resolved in
> gcc trunk.
> I will do some tests with r96559 applied on arm to see if this can be
> workaround by
>
> a: make the linking work by specifying -lgcc during linking.
> or
> b: upgrade gcc and libstdc++ on the buildbot to a newer version.
>
> Cheers
> Xerxes

Thanks for the explanation of the problem! To work around it, I'm
going to remove -Wl,--no-undefined from the ARM build. I think the
shared library should still find the __sync primitives defined in the
main executable, and we'll get assurance that the library is complete
from builds on non-ARM platforms.




More information about the llvm-commits mailing list