Statically linked binary way way too big

Martin v. Loewis martin@v.loewis.de
Tue Oct 15 22:56:00 GMT 2002


Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> writes:

> 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?

> Is there some problems with linker? Does it discard
> all unused sections?

No, and yes.

> Oh, and here is the source code of that program:
> 
> int main() {
>         return 0;
> }

Did you try to study *why* the image gets that large? Please add
-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.

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.

Regards,
Martin



More information about the Libc-alpha mailing list