This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: File size increases significantly after objcopy
- From: Peter Barada <peter at the-baradas dot com>
- To: cjaiprakash at hcltech dot com
- Cc: binutils at sources dot redhat dot com, cjaiprakash at hcltech dot com
- Date: Thu, 25 Nov 2004 10:53:39 -0500 (EST)
- Subject: Re: File size increases significantly after objcopy
- References: <267988DEACEC5A4D86D5FCD780313FBB020AB76F@exch-03.noida.hcltech.com>
> I am building colilo for a coldfire (v4e) target. I am facing a strange
>problem. If i build colilo with -O0 option and convert the ELF binary to
>bnary, srec format following are the resulting file sizes
>
>-rwxr-xr-x 1 cjaiprakash coldfire 93K Nov 25 18:58 colilo.bin
>-rwxr-xr-x 1 cjaiprakash coldfire 123K Nov 25 18:58 colilo.elf
>-rw-r--r-- 1 cjaiprakash coldfire 279K Nov 25 18:58 colilo.s19
>-rw-r--r-- 1 cjaiprakash coldfire 279K Nov 25 18:58 colilo.srec
>
>But when i build the colilo with -O2 option file size increase
>significantly, following are the sizes
>-rwxr-xr-x 1 cjaiprakash coldfire 17M Nov 25 19:01 colilo.bin
>-rwxr-xr-x 1 cjaiprakash coldfire 107K Nov 25 19:01 colilo.elf
>-rw-r--r-- 1 cjaiprakash coldfire 49M Nov 25 19:01 colilo.s19
>-rw-r--r-- 1 cjaiprakash coldfire 49M Nov 25 19:01 colilo.srec
>
>ELF binary size is ok but why the file sizes for bin, srec are so huge?
Two things.
1) Build link map so you can see what got sucked into the link.
2) Dump the object header (onjdump -h) and see what sections are in
colilo.elf. I'll bet in the -O2 case there are one or more *extra*
sections that are getting linked to zero since the linker control file
didn't specify where they are suppoesed to go.
--
Peter Barada
peter@the-baradas.com