Re: Writing a custom libc



Eric Sosman wrote:
Ian Collins wrote:

Levi Campbell wrote:

where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.


Eh? Not including stuff you don't use is the linker's job.

The linker isn't always up to the task. For example,
a program that never uses any of the <locale.h> functions
but uses <ctype.h> might drag in a whole bunch of the locale
machinery, because the <ctype.h> facilities are sensitive to
the locale changes the program will never perform. Also, the
use of shared libraries tends to make library inclusion an
all-or-nothing proposition -- although in this case, the amount
of space used in the entire system usually decreases even if
the amount "used" by a single program seems to be greater than
if it incorporated only the "necessary" functions.

If the O.P. has actually measured the amount of "extra
stuff" and found that it can't be tolerated (highly unlikely;
if he'd measured anything he'd probably have mentioned it),
there are a couple of possible strategies. First, he could
see whether his system supports "static linking," following the
model implicit in Ian Collins' post. If that's not enough, he
can get hold of the glibc source and start throwing things out
until he's got a smaller (maybe), less functional (surely), and
non-conforming (probably) library that works for his program
but for few others. And I bet it won't save him much, either.

--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxx

You *do* realize you've given me the answer don't you? All I have to do
is write a new locale that can handle braille and patch the aclocal.m4
and Makefile to a) skip the threading and use sockets. b) use the
braille-enabled locale as the default.

thanks!

.



Relevant Pages

  • Re: static linking broken
    ... a program that is part of a package may validly assume that libraries ... Fortunately not too many apps need the static linking. ...
    (comp.os.linux.development.apps)
  • Re: FAQ?, dynamic-link.h problem
    ... > Aborted' when using the jazz MIDI editing program. ... That means you are trying to run a statically linked program, ... The program has been linked against a buggy glibc (that did not expect ... (something that non-development libraries shouldn't have). ...
    (Fedora)
  • Using 2 glibc libraries at the same time
    ... I'm trying to run an application using a glibc ... libraries and RTL are located at /lib/2.2.4. ... Before the fork, ...
    (comp.os.linux.misc)
  • Re: static linking broken
    ... Here is the complete list for glibc 2.3.3 (well it's a compile list ... getgrnam getgrnam_r getgrouplist gethostbyaddr gethostbyname ... My experimentation shows that the library loading code is ... No shared libraries loaded at this time. ...
    (comp.os.linux.development.apps)
  • Re: static linking broken
    ... or on my "libraries under maintenance" system. ... | getgrnam getgrnam_r getgrouplist gethostbyaddr gethostbyname ... | glibc due to /etc/nsswitch.conf, ...
    (comp.os.linux.development.apps)