Related articles |
---|
GCC C/C++ runtime library question ramanathan.ramadass@spirentcom.com (2003-10-14) |
Re: GCC C/C++ runtime library question Brian.Inglis@SystematicSw.ab.ca (Brian Inglis) (2003-10-18) |
Re: GCC C/C++ runtime library question marcov@stack.nl (Marco van de Voort) (2003-10-18) |
Re: GCC C/C++ runtime library question vbdis@aol.com (2003-10-18) |
From: | Marco van de Voort <marcov@stack.nl> |
Newsgroups: | comp.compilers |
Date: | 18 Oct 2003 15:32:33 -0400 |
Organization: | Eindhoven University of Technology, The Netherlands |
References: | 03-10-078 |
Keywords: | GCC, C++, library |
Posted-Date: | 18 Oct 2003 15:32:33 EDT |
Ramanathan Ramadass wrote:
(assuming some unix)
> 1. What is the exact difference between the C runtime and the C
> standard libraries i.e where does one end and the other begin;
> specifically w.r.t gcc? While i am going through a lot of text(both
> online and book form) i am not 100% clear on this.
Roughly, the runtime is libgcc, the stdlib is libc. This can be seen
e.g. on *BSD that use different libc's. (so what the default libc
might be, is platform dependant)
Besides these there are the ELF startup code files (crt*), the .o
files in /usr/lib
The OS interface is a series of calls defined by unistd.h, and usually
a real ugly macro to inline some syscall. You can never be sure that a
call with a certain name (in the stdlib) really exists in the
library. It might be a header only thing and via some macro wrapper
get magically turned into some other call.
> 2. In a gcc distribution where exactly does the compiler specific
> magic lie within the runtime libraries?
(no idea, don't develop with gcc, only use it as systems compiler)
> I might have to modify gcc to use only my libraries but where and how do i
> begin?
Start to link your binary, and see what calls are missing. Find out
what these calls are, and how they interact (e.g. by objdump -D small
static binaries)
> Currently i have built the 3rd party vendor's library and am linking with
> it but for some symbols i still have to go to the gcc runtimes. I am
> running "nm" and extracting the object modules using "ar" for all the
> unresolved symbols; which seems to be a roundabout way of doing things.
- Get the libc source
- objdump small programs using the symbols. Much easier to examine.
> What i would like is to understand the structure of how gcc interfaces
> with its runtimes. Would appreciate any and all help on this. Pointers to
> other articles/links/books will also be very welcome.
No idea. I looked at libc to implement our own runtime, but don't use gcc
(or libc)
> [Good luck. The OS interface library, the standard C library, and the
> magic helper code libraries are rarely easy to separate out, and the
> low level details are rarely documented. -John]
My main frustration is that a symbol on C language level is not
guaranteed a symbol in the source. This makes POSIX useless if you
don't use C, and, together with liberal use of preprocessor macro's in
Unix headers in general hinders a lot of automatic conversion.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.