* crt source files
@ 2008-08-31 3:24 Tobin Maginnis
2008-08-31 18:33 ` Brian Dessent
0 siblings, 1 reply; 2+ messages in thread
From: Tobin Maginnis @ 2008-08-31 3:24 UTC (permalink / raw)
To: gcc-help
Hi,
I'm trying to find the CRT source files with little luck. They are added
to an executable at load-time and seem to do the following:
collect2 - A hack for object oriented languages (C++) to call a second
compilation to create object constructors. Collect2 calls ld to link the
specified files, then it looks for special constructor function names
and, if found, creates a new temporary ".c" file containing a table of
constructor functions, re-invokes the compiler, and links the program a
second time including the temporary ".o" file.
http://gcc.gnu.org/onlinedocs/gccint/Collect2.html
ld - Called by collect2. It is the linking loader which combines the
list of relocatable object modules
ld-linux.so.2 - Dynamic loader linked (combined) into your program.
Catches calls to library functions (i.e., printf) and see if the
function has already been loaded by a previous program. If so, just jump
to that in-memory page. Otherwise, read the library function into a new
page and jump to it.
crt0.o - C Run-Time Zero launcher. Used with "ar" absolute archive
library file formats.
crt1.o - C Run-Time One launcher. Used with ELF dynamic library formats.
Starts a location zero where the OS will begin execution. Jumps to main()
crti.o - C Run-Time Initialize? launcher. Used for odd processor
architecture initialization.
crtbegin.o - Used to execute functions located in the ".init" section
which call Java static data constructors.
/tmp/ccPzplAb.o - Your temporary relocatable object file.
crtend.o - Used to execute functions located in the ".fini" section
which calls Java data destructors.
crtn.o - Closes any open file descriptors and returns to the operating
system via the exit() service.
I cannot find these files in binutils-2.17.tar.gz, glibc-2.4.tar.gz, or
libtool-2.2.tar.gz
Thank you for ant assistance you can provide.
Regards,
Tobin Maginnis
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: crt source files
2008-08-31 3:24 crt source files Tobin Maginnis
@ 2008-08-31 18:33 ` Brian Dessent
0 siblings, 0 replies; 2+ messages in thread
From: Brian Dessent @ 2008-08-31 18:33 UTC (permalink / raw)
To: Tobin Maginnis; +Cc: gcc-help
Tobin Maginnis wrote:
Note: You seem to be referring to Linux here. These things vary greatly
from target to target so you have to be specific about what you're
talking about.
> collect2 - A hack for object oriented languages (C++) to call a second
Part of gcc, see gcc/collect2.c.
> ld - Called by collect2. It is the linking loader which combines the
Part of binutils. The linker is heavily templatized, see e.g.
ld/emultempl/elf32.em. The best way to see how the pieces fit together
is to simply build binutils and then look at the build logs.
> ld-linux.so.2 - Dynamic loader linked (combined) into your program.
Part of glibc, see libc/elf/dl-*.c.
> crt0.o - C Run-Time Zero launcher. Used with "ar" absolute archive
> library file formats.
>
> crt1.o - C Run-Time One launcher. Used with ELF dynamic library formats.
> Starts a location zero where the OS will begin execution. Jumps to main()
>
> crti.o - C Run-Time Initialize? launcher. Used for odd processor
> architecture initialization.
These are all part of glibc. If you are looking for source files with
the same filename as the crt*.o files you won't find them. They are all
built from common sources, see e.g. libc/csu/libc-start.c and read the
Makefile.
> crtbegin.o - Used to execute functions located in the ".init" section
> which call Java static data constructors.
> /tmp/ccPzplAb.o - Your temporary relocatable object file.
>
> crtend.o - Used to execute functions located in the ".fini" section
> which calls Java data destructors.
These are part of gcc. Again, you won't find source files with these
filenames as they are built from a common file compiled with different
combinations of things #defined, see gcc/crtstuff.c.
> crtn.o - Closes any open file descriptors and returns to the operating
> system via the exit() service.
Part of glibc, as above.
> I cannot find these files in binutils-2.17.tar.gz, glibc-2.4.tar.gz, or
> libtool-2.2.tar.gz
I don't know why you'd look in libtool, as that has nothing to do with
any of the above. It is simply an optional portability helper for the
build environment that is typically used in conjunction with autoconf
and automake in order to write portable build systems. It is mostly
just shell scripts and m4 macros, although it does include a small C
library (libltdl) that abstracts away the differences between the
various dlopen()-type APIs of many platforms.
Brian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-30 23:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-31 3:24 crt source files Tobin Maginnis
2008-08-31 18:33 ` Brian Dessent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).