[LLVMdev] build failure on ARM linux
xerxes at zafena.se
Wed Jul 1 12:33:31 PDT 2009
Den 2009-07-01 17:43, Owen Anderson skrev:
> Why is his configure not catching this? It tests for the linkability
> of these functions on the target arch, and should be detecting their
> absence if that is actually the case.
After some testing today i can assure that __sync_val_compare_and_swap
do exists and are implemented on the ARM/Linux system with gcc 4.3.3,
configure should have no problem finding the implementations.
I have written a small to test the __sync_val_compare_and_swap
implementation and to demonstrate one corner-case where the
__sync_val_compare_and_swap are simply not linked into a shared library
when using g++ to do the linking, it also outputs the same error like
the broken llvm compilation.
My testcase for ARM can be downloaded here:
Output from the testcase when run on native ARM hardware, Ubuntu Jaunty
on a sheeva plug, with gcc 4.3.3 :
xerxes at debian:~/test/atomic_hidden_symbol_testcase$ ./compileandtest.sh
fails using g++ to create the shared library
/usr/bin/ld: my_atomic_main: hidden symbol
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
./compileandtest.sh: line 6: ./my_atomic_main: No such file or directory
works using gcc to create the shared library
start of test
before b = CAFEBABE
after b = C0FFEE11 c = CAFEBABE __sync_val_compare_and_swap works!
So to compare with the failed compile of llvm:
Something fishy went wrong during the linking of libCompileDriver.so
since that shared library got __sync_val_compare_and_swap_4 left
unreferenced like a .o file.
Unfortunally I have not been able to do a sucessfull linking of llvm's
libCompileDriver.so with gcc like what i did to solve my testcase, the
symbols are still not linked in.
Should libCompileDriver be compiled and linked as a .so ? it are the
only library in the llvm suite that gets linked to a shared library...
> On Jul 1, 2009, at 12:50 AM, Xerxes Rånby wrote:
>> llvm/lib/System/Atomic.cpp contains the call to
>> __sync_val_compare_and_swap that lowers to the missing
>> __sync_val_compare_and_swap_4 GCC intrinsic.
>> The same file contains several other __sync_* calls and all these has
>> to be implemented if we want to be able to compile llvm on linux/ARM
>> with GCC versions below < 4.4
I got this one wrong: GCC 4.3.3 should be OK to compile llvm on
ARM/Linux since it do have the __sync_* call implementation,
Like Andrew have pointed out what we are observing are probably the GCC
bug that makes ARM fail to link in __sync_* when creating shared librarys.
More information about the llvm-dev