crosstool bloat

David Karlton dkarlton@themediamall.com
Mon Sep 19 15:28:00 GMT 2005


Dave Korn wrote:
> ----Original Message----
> 
>>From: David Karlton
>>Sent: 19 September 2005 16:00
> 
> 
> 
>>You guys are my heroes. 
> 
> 
>   LOL, save it for when/if we actually figure out what's going on!
> 
> 
>>Program Header:
>>     PHDR off    0x00000034 vaddr 0x00400034 paddr 0x00400034 align 2**2
>>          filesz 0x000000e0 memsz 0x000000e0 flags r-x
>>   INTERP off    0x00000114 vaddr 0x00400114 paddr 0x00400114 align 2**0
>>          filesz 0x0000000d memsz 0x0000000d flags r--
>>0x70000000 off    0x00000144 vaddr 0x00400144 paddr 0x00400144 align 2**2
>>          filesz 0x00000018 memsz 0x00000018 flags r--
>>     LOAD off    0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**16
>>          filesz 0x00000ac0 memsz 0x00000ac0 flags r-x
>>     LOAD off    0x00010000 vaddr 0x10000000 paddr 0x10000000 align 2**16
>>          filesz 0x00000090 memsz 0x000000a0 flags rw-
> 
> 
>   Heh, gotcha!  Look at these two sections from the other (non-bloated)
> version:
> 
> 
> 
>>     LOAD off    0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**12
>>          filesz 0x00000950 memsz 0x00000950 flags r-x
>>     LOAD off    0x00001000 vaddr 0x10000000 paddr 0x10000000 align 2**12
>>          filesz 0x00000080 memsz 0x000000a0 flags rw-
> 
> 
>   Notice how the LOAD offset for the second one has jumped from 0x1000 to
> 0x10000 (4kB->64kB) owing to the alignment requirement having changed from
> 2^12 to 2^16.

Nice find!  (And yes, I understood what you meant by "first one" and 
"second one.")

>   I believe this confirms Mike's guess about the binutils version which was
> stuffing executables with excess zero padding.  That would also explain why
> zipping them works out at the same size: lots of continuous zeros zip down
> to almost nothing.
> 
> 
> 
> 
>>  DYNAMIC off    0x0000015c vaddr 0x0040015c paddr 0x0040015c align 2**2
>>          filesz 0x000003a6 memsz 0x000003a6 flags rwx
>>     NOTE off    0x00000124 vaddr 0x00400124 paddr 0x00400124 align 2**2
>>          filesz 0x00000020 memsz 0x00000020 flags r--
> 
> 
> 
>>Sections:
>>Idx Name          Size      VMA       LMA       File off  Algn
>>   0 .interp       0000000d  00400114  00400114  00000114  2**0
>>                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> 
> 
> [snip]  These are all pretty-much the same size, give or take a few dozen
> bytes, and the new .MIPS.stubs section which is also only a few dozen bytes,
> so there isn't any new code or data in the executable; it really is just
> padding, that should have been omitted.  I do remember hearing of this bug
> before, although Mike seems more knowledgeable about it.  What version of
> binutils are you using?  If there's a more recent release, try it; if not,
> you should probably have a go with CVS HEAD, because I'm pretty sure the bug
> got fixed.
> 
> 
>     cheers,
>       DaveK

Here's the contents of

/opt/crosstool/gcc-3.3.4-glibc-2.3.2/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu.crosstoolconfig.txt

AR=
BINUTILS_DIR=binutils-2.15
BINUTILS_EXTRA_CONFIG=
BUILD=i686-pc-linux-gnu
BUILD_DIR=/home/dkarlton/crosstool-0.38/build/mipsel-unknown-linux-gnu/gcc-3.3.4-glibc-2.3
.2
CC=
DEJAGNU=
EXTRA_TARGET_CFLAGS=
GCC_BUILD=
GCC_CORE_DIR=gcc-3.3.4
GCC_DIR=gcc-3.3.4
GCC_EXTRA_CONFIG=
GCC_HOST=
GCC_LANGUAGES=c,c++
GDB_DIR=
GLIBC_ADDON_OPTIONS==linuxthreads,
GLIBC_DIR=glibc-2.3.2
GLIBC_EXTRA_CC_ARGS=
GLIBC_EXTRA_CONFIG=
GLIBC_EXTRA_ENV=
JUST_DOWNLOAD=
KERNELCONFIG=/home/dkarlton/crosstool-0.38/mipsel.config
LINUX_DIR=linux-2.4.26
LINUX_SANITIZED_HEADER_DIR=
NO_DOWNLOAD=
PREFIX=/opt/crosstool/gcc-3.3.4-glibc-2.3.2/mipsel-unknown-linux-gnu
PTXDIST_DIR=
SHARED_MODE=--enable-shared
SRC_DIR=/home/dkarlton/crosstool-0.38/build/mipsel-unknown-linux-gnu/gcc-3.3.4-glibc-2.3.2
TARBALLS_DIR=/home/dkarlton/downloads
TARGET=mipsel-unknown-linux-gnu
TARGET_CFLAGS=-O2 -finline-limit=10000
TOP_DIR=/home/dkarlton/crosstool-0.38
USE_SYSROOT=


So it looks like binutils-2.15.  Is this a potential culprit?

dk


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list