CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
how can I tell which parts are actually in use, or what my programs might need? I'm trying to get by with the kernel alone, and set init= my program ;)

will ltrace do it? but that would take a while before all the code in some of my programs actually runs...
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Compile your program statically, it'll be bigger but will be a lot easier than pulling apart glibc.
 

Bremen

Senior member
Mar 22, 2001
658
0
0
Removing parts of glibc would run havoc with any program linked to it. Essentially you'd need to recompile everything every time you made a change (at least thats the way I understand how dynamic linking works). So if you needed to put something back into glibc for a program you're compiling it would force you to recompile everything. Static linking may not save as much space, but it will keep you sane.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Part of the reason for using dynamic linking is so that when a library changes you don't need to recompile all the programs that use it, so as long as he had some implementation of every function glibc implements (even if they all just had return 0; in them) they would run, although maybe not correctly.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81


<< Compile your program statically, it'll be bigger but will be a lot easier than pulling apart glibc. >>



i dont have the source code. if I did, i would have done that, or looked at what it calls ;)
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
I ltraced it and got a huge file after a couple minutes (350 meg)... cut it to the first 8 bytes of each line, sorted, and got the following calls:
_IO_put __errno __fxsta __libc_ __xstat calloc close fclose fflush fgets fileno flock fopen free fscanf ftell fwrite getcwd getenv getprio gettime localti lseek malloc memcmp memcpy memmove memset open opendir pthread read readdir realloc setenv setprio sigacti sigadds sigempt signal srandom strlen system time tzset tzset write

how do I find where these are?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Type 'ldd programname' and you'll get a list of libraries it uses like:

ldd /bin/ls
librt.so.1 => /lib/librt.so.1 (0x4001d000)
libc.so.6 => /lib/libc.so.6 (0x4002e000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4014c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)