This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Executable has doubled in size!
- From: wayne_thomson at agilent dot com
- To: gcc at gnu dot org
- Cc: simon_love at agilent dot com, helena_garry at agilent dot com
- Date: Thu, 27 Jun 2002 08:48:26 +0200
- Subject: Executable has doubled in size!
Hi,
I initially tried sending this to gnu@gnu.org and was informed to send it help-gcc@gnu.org, but did not get any response.
So I thought I'd try my luck with gcc@gnu.org.
After compiling the same source code using g++ for I960 and StrongArm architectures, I noticed a significant difference in the size of the object file produced:
true access7_B.07.30.EX; GCC_EXEC_PREFIX=/tsdtools/tools/layered/vwI960Tornado1.0.1/host/parisc-hpux9/lib/gcc-lib/ /tsdtools/tools/layered/vwI960Tornado1.0.1/host/parisc-hpux9/bin/cc960 -O3 -Wall -pedantic -ansi -fno-builtin -mca -msoft-float -mstrict-align -fvolatile -nostdinc -DCPU=I960CA -DVX -DVXWORKS -DVX_IGNORE_GNU_LIBS -DHOST_HP -DP7WRAP -DI75_IFPC -DP7_PAP -I/tsdtools/tools/layered/vwI960Tornado1.0.1/target/h -I/tsdtools/tools/layered/vwI960Tornado1.0.1/target/h/rpc -c -I/projects/access7 -I/projects -pipe -o ../pap/i7599_e4254a.o -x c++ -DI75_DATASTORE ../pap/i7599.c
produces the following object file:
273359 Apr 17 07:59 ../pap/i7599_e4254a.o
whereas:
true access7_B.07.30.EX; GCC_EXEC_PREFIX=/tsdtools/tools/layered/vwArmTornado1.0.1/host/parisc-hpux10/lib/gcc-lib/ /tsdtools/tools/layered/vwArmTornado1.0.1/host/parisc-hpux10/bin/ccarm -mcpu=strongarm110 -mapcs-32 -ansi -O2 -Wall -fno-builtin -mno-sched-prolog -fvolatile -nostdinc -mlongcall -fno-schedule-insns -fno-schedule-insns2 -DCPU=ARMSA110 -DVX -DVXWORKS -DVX_IGNORE_GNU_LIBS -DHOST_HP -DP7WRAP -DI75_IFPC -DI75_IFPCS -DP7_PAP -I/tsdtools/tools/layered/vwArmTornado1.0.1/target/h -I/tsdtools/tools/layered/vwArmTornado1.0.1/target/src/config -I/tsdtools/tools/layered/vwArmTornado1.0.1/target/src/drv -I/tsdtools/tools/layered/vwArmTornado1.0.1/target/h/rpc -c -I/projects/access7 -I/projects -pipe -o ../pap/i7599_e7568a.o -x c++ -DI75_DATASTORE ../pap/i7599.c
produces the following object file:
5023 Apr 17 08:01 ../pap/i7599_e7568a.o
The I960 compilation uses gcc version cygnus-2.7.2-960126 and the Strong Arm compilation uses gcc version 2.7.9-970819.
After some investigation, I realised that the size difference is the result of where the global variables have been placed. For the I960 compilation, they have been placed in the data segment:
text data bss dec hex filename
236 267812 2 268050 41712 i7599_e4254a.o
but the Strong Arm compilation has placed the global data in the bss segment:
text data bss dec hex filename
272 4 259844 260120 3f818 i7599_e7568a.o
Why the difference between the two versions of gcc?
Is there an option to force the uninitialised global data into the bss section for the I960 compilation?
I've found some articles on the web indicating:
"g++ places unitialised data into the data section, which results in big object code..."
and
"...the larger object file is the result of the conserve-space feature added to g++."
Is the behaviour of g++ different for varying architectures?
I've tried the "-fno-common" option with no effect.
Any help/guidance would be appreciated - the eventual size of our code is important.
Thanks,
Wayne Thomson
Telecoms System Division
Agilent Technologies Ltd
South Queensferry
West Lothian
EH30 9TG
Telephone: 0131 331 6772
Telnet: 313 3772
E-Mail: wayne_thomson@agilent.com