Re: Tiny GCC: Pure, Unadulterated, Object Code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 23 Jan 2008, Michael Witten wrote:

   These cross-compilers don't need access to any kind of
   libraries or headers.

   They don't need C libraries, or libstdc++, or libobjc,
   or anything that has absolutely nothing to do whatsoever
   with compilation.


Can I build gcc in this way?


Build gcc with the libc that goes into the target.

Compile your code with one or more of.....

`-nostartfiles'
     Do not use the standard system startup files when linking.  The
     standard system libraries are used normally, unless `-nostdlib' or
     `-nodefaultlibs' is used.

`-nodefaultlibs'
     Do not use the standard system libraries when linking.  Only the
     libraries you specify will be passed to the linker.  The standard
     startup files are used normally, unless `-nostartfiles' is used.
     The compiler may generate calls to `memcmp', `memset', `memcpy'
     and `memmove'.  These entries are usually resolved by entries in
     libc.  These entry points should be supplied through some other
     mechanism when this option is specified.

`-nostdlib'
     Do not use the standard system startup files or libraries when
     linking.  No startup files and only the libraries you specify will
     be passed to the linker.  The compiler may generate calls to
     `memcmp', `memset', `memcpy' and `memmove'.  These entries are
     usually resolved by entries in libc.  These entry points should be
     supplied through some other mechanism when this option is
     specified.

     One of the standard libraries bypassed by `-nostdlib' and
     `-nodefaultlibs' is `libgcc.a', a library of internal subroutines
     that GCC uses to overcome shortcomings of particular machines, or
     special needs for some languages.  (*Note Interfacing to GCC
     Output: (gccint)Interface, for more discussion of `libgcc.a'.)  In
     most cases, you need `libgcc.a' even when you want to avoid other
     standard libraries.  In other words, when you specify `-nostdlib'
     or `-nodefaultlibs' you should usually specify `-lgcc' as well.
     This ensures that you have no unresolved references to internal GCC
     library subroutines.  (For example, `__main', used to ensure C++
     constructors will be called; *note `collect2': (gccint)Collect2.)




John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@xxxxxxxxxx
New Zealand


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux