followup on question about gcc compiling and linking

Mike Frysinger vapier@gentoo.org
Tue Dec 13 18:26:00 GMT 2005


On Tue, Dec 13, 2005 at 06:26:10PM +0000, Mike Frysinger wrote:
> On Tue, Dec 13, 2005 at 11:10:06AM -0500, Robert P. J. Day wrote:
> > On Tue, 13 Dec 2005, Mike Frysinger wrote:
> > > there prob is but i dont know of one ... wouldnt mind starting a
> > > little file to doc these though ...
> > 
> > good idea, i'd read it.  let me know when it's done.  :-)
> 
> attached

be nice if i actually attached it ...
-mike
-------------- next part --------------
Mini FAQ about the misc libc/gcc crt files.


Some definitions:
PIC - position independent code (-fPIC)
PIE - position independent executable (-fPIE -pie)
crt - C runtime



crt0.o
  Older style of the initial runtime code ?  No one generates this anymore.
crt1.o
  Newer style of the initial runtime code.  Contains the _start symbol which
  sets up the env with argc/argv/libc _init/libc _fini before jumping to the
  libc main.  glibc calls this file 'start.S'.
crti.o
  Defines the function prolog; _init in the .init section and _fini in the
  .fini section.  glibc calls this 'initfini.c'.
crtn.o
  Defines the function epilog.  glibc calls this 'initfini.c'.
Scrt1.o
  Used in place of crt1.o when generating PIEs.
gcrt1.o
  Used in place of crt1.o when generating code with profiling information.
  Compile with -pg.  Produces output suitable for the gprof util.
mcrt1.o
  Like gcrt1.o, but is used with the prof utility.  glibc installs this as
  a dummy file as it's useless on linux systems.

crtbegin.o
  Compilier constructor code ?
crtbeginS.o
  Used in place of crtbegin.o when generating PIEs.
crtbeginT.o
  Used in place of crtbegin.o when generating static executables.
crtend.o
  Compilier deconstructor code ?
crtendS.o
  Used in place of crtendS.o when generating PIEs.



General linking order:
crt1.o crti.o crtbegin.o [-L paths] [user objects] [gcc libs] [C libs] [gcc libs] crtend.o crtn.o

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


More information about the crossgcc mailing list