This is the mail archive of the mailing list for the glibc 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]

Re: Statically linked binary way way too big

On 16 October 2002 03:54, Martin v. Loewis wrote:
> > int main() {
> >         return 0;
> > }
> >
> > Based on release announcements ("we don't want
> > to hear about size") and discussions with Linus
> > seen in archive I know that glibc does not try
> > to minimize library size, but nearly half a megabyte
> > can never be right.
> Why do you say this? How do you determine which size would be right,
> and which would not?

Say that again? It's ok for this program to occupy 400k?

> > Is there some problems with linker? Does it discard
> > all unused sections?
> No, and yes.
> Did you try to study *why* the image gets that large? Please add

Yes. I did objdump --disassemble.

> -Wl,--verbose to your compiler options to have the linker print all
> object files it incorporates into the executable. If you doubt that
> any of these object files rightfully belong into the executable,
> please post
> a) a complete list of object files that are incorporated into the
>    executable, and
> b) a list of object files that you think should not be there.

Test was done at home with recent gcc/glibc.
I'll do what you ask as soon as I install latest gcc/glibc here at work.
Hopefully in an hour...

> If you think that all object files linked into the executable are
> needed, but some of them are too large, please post a list of those
> as well.

This last sentence makes me think that you imply ld does _not_
discard unused functions from individual object modules.

So it may easily link in module a with functions a1() and a2()
because program needs a1(), and then link in module b,
because a2() needs something from it. Despite the fact that a2()
never called. Can ld do that?

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