I am trying to replace the standard C and C++ libraries which comes 1. What is the exact difference between the C runtime and the C 2. In a gcc distribution where exactly does the compiler specific Thanks [Good luck. The OS interface library, the standard C library, and the |
On 14 Oct 2003 23:46:56 -0400 in comp.compilers,
ramanathan.ramad...@spirentcom.com (Ramanathan Ramadass) wrote:
Your vendor should be able to provide information about replacing a
>I am trying to replace the standard C and C++ libraries which comes >with a Linux distro with our own(licensed from a 3rd party vendor). We >will be providing the lower level layer which the C/C++ library >uses(i.e. the system calls). What i would like to do is replace the >standard and the runtime libraries which come with gcc with our own. I >am a newbie in this and hence have some basic questions; compiler specific library with theirs, assuming they don't provide a compiler, and maybe even if they do. ;^>
>1. What is the exact difference between the
C
runtime and the
C
If you have gcc installed, 'info gccint' gives you more
>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. information about the compiler collection and its interfaces, and there are web pages and manuals at http://gcc.gnu.org/onlinedocs at the bottom under Current Development. And there really is not a great distinction between C runtime and standard libraries: the C standard library is a subset of the POSIX standard library which is a subset of any *IX system's library. Runtime support may be just another routine in the library, or maybe flagged as such with an _.
>2. In a gcc distribution where exactly does the compiler specific
If you're lucky,
runtime support routines should begin with _.
>magic lie within the runtime libraries? I might have to modify gcc to >use only my libraries but where and how do i begin? 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. 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. Substituting standard libraries should only require specifying the 3rd party header include directory on the compile/cc command line -Iincdir and their standard library and directory on the build/ld command line: -Llibdir -lstd. Alternatively, environment variables CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, and LIBRARY_PATH can be set to provide all the directories. The gcc/gpp/g++ driver programs shouldn't be hard to tweak to add these paths and library, once you get everything working using options or environment variables. Getting any gcc helper routines to call your standard library The interesting part of the job starts with writing tests to You also need to give consideration to what you will do now to Haven't done this kind of stuff with gcc, but have dealt with Thanks. Take care, Brian Inglis Calgary, Alberta, Canada |
Ramanathan Ramadass wrote:
(assuming some unix)
> 1. What is the exact difference between the
C
runtime and the
C
Roughly, the
runtime is libgcc, the stdlib is libc. This can be seen
> 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. 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 The OS interface is a series of calls defined by unistd.h, and usually
> 2. In a gcc distribution where exactly does the compiler specific
(no idea, don't develop with gcc, only use it as systems compiler)
> magic lie within the runtime libraries?
> I might have to modify gcc to use only my libraries but where and how do i
Start to link your binary, and see what calls are missing. Find out
> begin? 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
- Get the libc source
> 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. - objdump small programs using the symbols. Much easier to examine.
> What i would like is to understand the structure of how gcc interfaces
No idea. I looked at libc to implement our own
runtime, but don't use gcc
> with its runtimes. Would appreciate any and all help on this. Pointers to > other articles/links/books will also be very welcome. (or libc)
> [Good luck. The OS interface
library, the standard
C
library, and the
My main frustration is that a symbol on
C language level is not
> magic helper code libraries are rarely easy to separate out, and the > low level details are rarely documented. -John] 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. |
ramanathan.ramad...@spirentcom.com (Ramanathan Ramadass) schreibt:
>1. What is the exact difference between the
C
runtime and the
C
Currently I'm doing a similar job, extending the standard
library of
>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. another compiler for GNU compatibility. I intend to achieve that compatibility by creating a glibc with all those modules, which are not found in the compiler's standard library. Linking with that library in the first place should exclude all multiply existing modules. Some suggestions: Have a look at the glibc and related documentation. The glibc is a
>2. In a gcc distribution where exactly does the compiler specific
I don't know what "magic" you mean, gcc doesn't care for libraries -
>magic lie within the runtime libraries? I might have to modify gcc to >use only my libraries but where and how do i begin? that's the task of ld. But as gcc can be used as a cross compiler, at least the platform specific header files reside in the /lib/gcc-lib/... directories. You can create another target branch for your library there, so that you can specify with --target whether gcc shall compile for the default platform, using the standard glibc, or for your target, using your glibc replacement. IMO the compiler itself deserves no modifications herefore, as long as the target machine has the same instruction set as the build machine.
> Currently i have built the 3rd party vendor's
library and am linking
Locate the missing modules in the glibc package, and add these to your
>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. project. It may become tricky to remove unwanted dependencies from the glibc "internal" header files. DoDi |
End of messages |