This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

static compilation and dl_*


Hello,
  i apologize if i write there directly about that issue, but i haven't
beenable to give myself an answer of find it somewhere in web, so maybe you
can point me to some place i can get answer from.

While i was looking for what is placed inside .bss after a static
compilation of a trivial program :

char buf[100] // used just as a point inside .bss

int main(int argv,char **argc)
{
printf("blan\n");
}

i noticed many dl_* variables, doing a fast nm of the static compiled
executable i saw :

000000000807135c T __libc_dlclose
00000000080712fc T __libc_dlopen
0000000008071328 T __libc_dlsym
[...]
000000000805225c T _dl_debug_printf
0000000008052278 T _dl_debug_printf_c
0000000008085970 T _dl_debug_state
0000000008051ed0 t _dl_debug_vdprintf
0000000008052294 T _dl_dprintf
000000000804c300 T _dl_dst_count
[...]
000000000807848c t dl_open_worker
0000000008071240 t dlerror_run
00000000080712ec t do_dlclose
0000000008071290 t do_dlopen
00000000080712b0 t do_dlsym
[...]

And that quite surprised me, since i can't figure out why they are inside
the static image, since dlopen & related can't be called from a static
binary and, moreover, they're not referenced anywhere in my code.

I may recall wrong, but isn't some sort of stub of (f.e.) gconv extensions
done inside static binaries ?
So why isn't something similar done for that functions (that are inside
ld-linux.so too) ? Why they are "included" inside the final executable ?

I was compiling with simple gcc -static -o test test.c the simple code i
pasted above.

Thanks in advance

             twiz


--------------------------------------------------------------
Perla Enrico  -  twiz
emails : twiz at email dot it - twiz at antifork dot org - twi at boiate dot it
- We must believe in something to find if we've grown -
--------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]