Cross compile error question: i686 to powerpc--linux-gnu

William A. Gatliff bgat@saturn.billgatliff.com
Wed Oct 17 10:44:00 GMT 2001


Joe:


Gcc is a "frontend" that invokes the compiler proper, assembler,
linker and other utilities as needed.  That way, you can just do:

$ gcc hello.c

And get the expected results, at least after everything is set up.

> Why does GCC need all of these libraries recompiled to output
> standard C code?  I can understand that the linker and assembler
> might need to know more about the hardware, but why is it so hard to
> get GCC to just spit out the right code to binutils?  The binutils
> has (seemingly) been the most painless up to this point.

It doesn't.  It just looks that way because gcc comes with some
pre-configured stuff in its "specs" file, the file that controls what
gcc does and when.

To see all of what gcc is doing, use the -v option.  To just translate
a file to asm, use -S.  To compile to an object file, use -c.

> Anyway...long story short...if we want to provide our own library
> support, do I NEED to go any further than making the bootstrap
> compiler?  I'm not going to use Linux, I'm not going to use GNU
> (most likely)...so, am I going too far in something I don't need to
> do?

I'm not sure.  There are little "helper functions" inside gcc that
deal with some of the functionality that gcc assumes microprocessors
don't have, like support for arbitrary bit shifts on some targets.
Some of these helper functions are written in C, and need header files
in order to build properly.  So you *may* need to build glibc/newlib,
just to get the header files that gcc needs to build its internal
libraries.

The main offender here is libiberty, although I don't know if you need
what's in there or not (I don't recall exactly *what's* in libiberty
myself).  There are other libraries as well, whose identities will be
exposed by the -v option during compilation and linking.

I know libiberty isn't built until after the all-gcc target, which
means you don't get it in a bootstrap compiler, and if you don't need
it then you don't need to go beyond the bootstrap stage.  I don't
recall when the other libraries are built, but if they come after
all-gcc then you'll probably have to build the complete toolchain to
get them.

> Is there some integration with binutils that's going on here I don't
> understand?

Yes.  Your gcc is acting on the contents of the default "specs" file,
which includes things like "link in these runtime libraries, and pass
these options to as and ld".  That's where the confusion is coming
from.

With -c or -S, gcc is *just* a compiler.  Well, it invokes *just* the
compiler, that is.  But you get the idea.


HTH,

b.g.
-- 
Bill Gatliff
bgat@billgatliff.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list