This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
H.J. Lu wrote: > > This is what I'm trying to solve: > > > > $ cat t1.c > > int main(void) { return 0; } > > $ cat t2.c > > int main(void) { return 0; } > > > > void abort(void) { while(1); } > > void atexit(void *x) { return; } > > void exit(int x) { _exit(x); } > > > > void *__libc_stack_end; > > $ gcc -static t1.c -o t1 > > $ gcc -static t2.c -o t2 > > $ ls -l t1 t2 > > -rwxrwxr-x 1 zack zack 222102 Aug 18 09:12 t1 > > -rwxrwxr-x 1 zack zack 6215 Aug 18 09:12 t2 > > > > I want t1 to not be 220k. The problem appears to be that the > > implementations of abort and atexit suck in all kinds of stuff > > transitively - mainly via libio. I thought, late last night, that it > > had to do with pthreads being referenced despite those being weak > > symbols, but I was wrong. > > > > Add -Wl,-Map,map. You should see what/why they are included in "map". Yes, that works beautifully, thank you. The problem is nothing to do with weak symbols. It's very simple: - abort flushes all open FILEs, so it pulls in stdio - atexit and exit refer to malloc, and the malloc checking code pulls in stdio - __libc_stack_end is defined only in dl-support.c, which pulls in the rest of the static libdl, which uses stdio and - stdio is 100k by itself - the wide char support in stdio references the gconv infrastructure and the static libdl, which (with everything that uses) is another 100k I spent a lot of time today bashing at this, but there is no easy fix. I guess this is just a "libio should be smaller" whine. Note that an awful lot of places in there know when a stream is wide; it seems to me that this ought to be hidden in the jump table. There's no reason why not to redirect _IO_setb instead of having _IO_setb and _IO_wsetb, for example. zw
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |