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

Bug#530388: g++-4.3: g++ linker driver leaves undefined references to GCC intrinsics on shared objects on armel



forwarded 530388 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40134
tags 530388 + upstream
thanks

if you use the atomic builtins explicitely, please make sure that you link
explicitely with -lgcc_s -lgcc on armel and hppa. see the upstream report for
more details.

Alberto Luaces schrieb:
> Package: g++-4.3
> Version: 4.3.3-10
> Severity: important
> 
> When linking a shared object file from one or several object files
> that use GCC's intrinsic atomic functions like
> __sync_bool_compare_and_swap, __sync_sub_and_fetch,
> __sync_add_and_fetch..., g++ linker driver leaves that symbols as
> undefined to the library created, so later attempts to use the library
> will fail. It behaves correctly when using gcc for linking,
> however. Here I send a simple testcase:
> 
> debian-armel:~# cat foo.c
> void doit(void **p, void *val, void *val2)
> {
>   __sync_bool_compare_and_swap(p, val, val2);
> }
> debian-armel:~# gcc foo.c -c
> debian-armel:~# g++ -shared foo.o -o libfoo.so
> debian-armel:~# nm -D libfoo.so | grep sync
>          U __sync_bool_compare_and_swap_4
> debian-armel:~# gcc -shared foo.o -o libfoo.so
> debian-armel:~# nm -D libfoo.so | grep sync
> debian-armel:~#
> 
> *Linking:
> 
> debian-armel:~# g++ -shared foo.o -o libfoo.so
> debian-armel:~# cat dummymain.c
> int main(){return 0;}
> debian-armel:~# g++ dummymain.c libfoo.so
> /usr/bin/ld: a.out: hidden symbol `__sync_bool_compare_and_swap_4' in /usr/lib/gcc/arm-linux-gnueabi/4.3.3/libgcc.a(linux-atomic.o) is referenced by DSO
> /usr/bin/ld: final link failed: Nonrepresentable section on output
> collect2: ld returned 1 exit status



Reply to: