egcs-1.1.2 cross compiler problems

Mumit Khan khan@xraylith.wisc.EDU
Fri Apr 30 23:15:00 GMT 1999


Teemu Torma <tot@trema.com> writes:
> I have tried for the first time to set egcs to work as a cross
> compiler to be able to compile sparc-sun-solaris2.5.1 binaries under
> sparc-sun-solaris2.7.  This same setup worked out-of-the-box with gcc
> 2.7.2.3.
> 
> The configuration was done as:
> 
> ../egcs-1.1/configure --target=sparc-sun-solaris2.5.1 --srcdir=../egcs-1.1 --
> prefix=/usr/gnu --with-cpu=supersparc --enable-version-specific-runtime-libs 
> --enable-shared --with-gnu-as --with-gnu-ld
> 
> I encountered two fatal problems with this setup:
> 
[...]
> 2. When building a cross compiler, libgcc2.c does automatically
>    #define inhibit_libc.  At least __eprintf will be missing and
>    causing link failures.
> 

This issue has been raised in the past, albeit with no resolution on what
the right thing to do is. The typical cross build setup, and the libgcc2
inhibit_libc macro, is really for embedded systems where there's a good
chance you don't have certain parts of the standard library (such as I/O);
this however creates problems for quasi-embedded systems such as Windows32
where we have the entire thing. 

I tend to patch gcc configuration locally to do one of two things:
  
  - pass inhibit_libc from top level (Cygnus used to do this in their
    releases way back). 

  - just patch libgcc2.c for the targets you're interested in and allow
    the inclusion of the code that will normally be #ifdef'd out.

Note that g77 front-end uses assert and it in turn needs __eprintf, and
cross-builds fail there too. 

To do this right, the configuration utility needs to check if stdio.h is
available for the target system and define inhibit_libc accordingly. One
way is to run a test *after* xgcc is built, and then build libgcc.a. I 
believe Ian Taylor had suggested along these lines as well when we were
last discussing it in egcs list. I'm not motivated enough to figure out 
how to graft this onto the current autoconfiguration/build procedure
however.

Regards,
Mumit




More information about the Gcc-bugs mailing list