Trying to reduce generated 4.9.2 footprint

Ricardo Telichevesky ricardo@teli.org
Sun Apr 12 22:41:00 GMT 2015


Hi,

     Using native gcc compiler from x86_64 RHEL6.6 ... and trying to build 4.9.2 with a small footprint, only care about c and c++ languages...  I tried to follow the instructions in the installation regarding BOOT_CFLAGS, CFLAGS_FOR_TARGET, STAGE1_TFLAGS ...
in my shell script I have:

../src/configure --prefix=/opt/gcc --enable-languages=c,c++ --enable-threads --enable-libgomp   --enable-lto --enable-threads=posix  --enable-tls --with-fpmath=sse --disable-bootstrap

and then

make BOOT_CFLAGS=-O2 CFLAGS_FOR_TARGET=-O2 STAGE1_TFLAGS=-O2

I tried both with and without --disable-bootstrap for configure and also with

make BOOT_CFLAGS=-O2 CFLAGS_FOR_TARGET=-O2 STAGE_CFLAGS=-O2

with little results.  I kind of figured out that the -g flags substantially increase the size of the resulting /opt/gcc

Eventually, I untar'd the gcc-4.9.2.tar.bz2, tried to find as many -g as I could, recompiled, and got a reduction from 400MBytes to about 130MBytes ... not bad, but I see in the log file that still the -g flag insidiously comes back from deep inside the libraries and other places... I believe I can 
make it smaller, but I was wondering if there was any kind of "magic formula" to RELIABLY avoid the pesky -g flag to show up over and over again. I don't need to debug the compiler or any of the libraries at all, but is there any danger in getting rid of the -g flags? Also, can I get rid of the 
/opt/gcc/share that seems to contain only docs?

Thanks for any help,

     Ricardo



More information about the Gcc mailing list