This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [crosstool-ng] build failure with powerpc-unknown-linux-uclibc sample


On Tue, 16 Mar 2010 12:28:41 +0100
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Ah, ah, you're right. In
> targets/powerpc-unknown-linux-uclibc/build/build-cc/powerpc-unknown-linux-uclibc/libgomp/config.log,
> I found :

Ok, so here is my understanding of the problem.

On powerpc, libgcc uses the copysignl() function :

thomas@surf:~/projets/crosstool-ng/targets/powerpc-unknown-linux-uclibc/build/build-cc$ ../build-binutils/binutils/readelf -a gcc/libgcc_s.so|grep copysign
[...]
    97: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND copysignl
   431: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND copysignl

This libgcc_s.so library is linked with libc.so.0, but not with libm:

thomas@surf:~/projets/crosstool-ng/targets/powerpc-unknown-linux-uclibc/build/build-cc$ ../build-binutils/binutils/readelf -d gcc/libgcc_s.so
[...]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]
 0x00000001 (NEEDED)                     Shared library: [ld-uClibc.so.0]
 0x0000000e (SONAME)                     Library soname: [libgcc_s.so.1]
[...]

With glibc, this is not a problem since copysignl() is part of libc.
But on uClibc, copysignl() is part of libm.

There are two fixes available :

 * Bernhard fix, which links libgcc with libm
   http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00237.html

 * OpenWRT fix, which (from my understanding) adds copysignl() to the
   main uClibc's libc
   https://dev.openwrt.org/browser/trunk/toolchain/uClibc/patches-0.9.30.1/450-powerpc_copysignl.patch

However, none of them seems to be the good (tm) solution, since Joseph
S. Myers (from CodeSourcery) says (at
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00291.html) :

   The bug here is that libgcc_s contains a reference to a libm function, not 
   that it does not link to libm.  Linking libgcc against libm is a bad
   idea and various code in libgcc specifically tries to avoid any
   dependence on libm function.  You should fix the bug of the
   reference to copysignl rather than making libgcc link with libm.

However, I have no idea where the reference to copysignl() is created
in gcc code.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]