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: Building a static toolchain ?


On 2010-03-31 23:25, Yann E. MORIN wrote:
- make sure any extra dependencies, usually libgmp and/or libmpfr,
*are* statically linked into the toolchain executables, since not
everybody will have those as .so files on their system, or may have
different, incompatible versions.

Yes, and those *I* was not able to properly build statically (yet!)... :-(

For that, I use something like the attached patch, which should apply cleanly to gcc 4.3.3, but most likely also to later versions.

After building the toolchain, you can check out the dependencies with
ldd, for example:

$ ldd $TOOLCHAIN_ROOT/libexec/gcc/$TARGET_TRIPLET/4.3.3/cc1
         linux-gate.so.1 =>  (0x00a5b000)
         libc.so.6 => /lib/libc.so.6 (0x00110000)
         /lib/ld-linux.so.2 (0x00996000)

So it only links dynamically with glibc, while it contains gmp and mpfr
statically:

$ strings $TOOLCHAIN_ROOT/libexec/gcc/$TARGET_TRIPLET/4.3.3/cc1|grep -E "gmp|mpfr"
real_from_mpfr
mpfr_from_real
|*p+>(__builtin_constant_p (1) && (1) == 0 ? (((S)->_mpfr_exp == ((mp_exp_t)((~((~(unsigned long)0)>>1))+1))) ? 0 : ((S)->_mpfr_sign)) : mpfr_cmp_ui_2exp ((S),(1),0)) < 0
!(((t)->_mpfr_exp) == (((-2147483647L - 1L))+2))
prec >= 2 && prec <= ((mpfr_prec_t)((mpfr_prec_t)(~(mpfr_prec_t)0)>>1))
p >= 2 && p <= ((mpfr_prec_t)((mpfr_prec_t)(~(mpfr_prec_t)0)>>1))
(((k)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+1)) || ((k)->_mpfr_exp) <= 2
(!(((r)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+2)) && !(((r)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+3)))
(((cache->x)->_mpfr_sign) > 0)
! (un < pn || (un == pn && __gmpn_cmp (up, pp, pn) < 0))

Attachment: gcc-4.3.3-static-gmp-mpfr.diff
Description: Text document

--
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]