This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


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

Re: Which libgcc?


>>>>> "Kenneth" == Kenneth Porter <kenneth_porter@kensingtonlabs.com> writes:

    Kenneth> I'm learning to drive gcc (under NT4) and I've gotten to
    Kenneth> the point where I'm learning how to link. I've figured
    Kenneth> out that I need to link with libgcc to provide the
    Kenneth> compiler support functions, but the ecosSWtools directory
    Kenneth> contains 10 different instances of libgcc.a, all under

    Kenneth> ecosSWtools-990319\H-i586-cygwin32\lib\gcc-lib\powerpc-eabi\2.9-ecosSWto
    Kenneth> ols-990319

    Kenneth> libgcc.a
    Kenneth> \ca\libgcc.a
    Kenneth> \le\libgcc.a
    Kenneth> \le\ca\libgcc.a
    Kenneth> \lin\libgcc.a
    Kenneth> \nof\libgcc.a
    Kenneth> \nof\ca\libgcc.a
    Kenneth> \nof\le\libgcc.a
    Kenneth> \nof\le\ca\libgcc.a
    Kenneth> \sol\libgcc.a

    Kenneth> What are the differences between these? Where do I find
    Kenneth> this documented?

You have discovered something called multilibs, which I am afraid is
one of the more obscure aspects of the compiler. A given gcc
executable, say for the PowerPC architecture, can cope with some
variations of that architecture. For example it can generate code for
either little-endian or big-endian mode, there is no need to build two
separate compilers. Such variations require slightly different
libgcc.a support libraries, so libgcc.a is multilibbed.

Of the list you give, I suspect that "ca" is related to System V.4
calling conventions; "le" controls endianness; "nof" indicates no
hardware floating point support; I am not sure about "sol" about
"lin", probably something to do with Solaris and Linux respectively.
So if you are generating little-endian executables for a PowerPC
variant which does not have hardware floating-point, you will want
\nof\le\libgcc.a

Fortunately you do not need to know about any of this because the
compiler will pick up the right version automatically - as long as you
do not confuse it. The basic rule is that you need to use compatible
flags when compiling and linking. If you specify a particular
processor variant at compile-time, e.g. -mcpu=860, then specify the
same cpu at link-time. If you want little-endian code specify -mlittle
at both compile and link time. As long as you remember this the
compiler will just do the right thing.

There may be some more detailed information about multilibs in the
compiler documentation, but a quick search did not reveal anything
obvious. If anybody wants to know more then the gcc mailing list would
probably be the right forum. Archives are available at:
http://gcc.gnu.org/ml/gcc/

Bart Veer // eCos net maintainer


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