avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Link Time Optimization vs __builtin_unreachable() and


From: Bob Paddock
Subject: Re: [avr-gcc-list] Link Time Optimization vs __builtin_unreachable() and .signature?
Date: Tue, 19 Jun 2012 09:10:41 -0400

> Can you be more specific what you mean with "after"?

Alas it is not as simple as the __builtin_unreachable when I look at
the .map and .sym files, as I thought yesterday.

A working build has this:
Size after:
   text    data     bss
  66435     775    3954

Build with LTO enabled has this:
Size after:
   text    data     bss
  14527      88    2151

LTO diff between with_lto.map and no_lto.map shows 71 sections have
been removed:
+
+Discarded input sections
+
+ .text          0x00000000        0x0 ../!Program/Object/Main/main.o
(symbol from plugin)
+ .text          0x00000000        0x0
../!Program/Object/Backlight/backlight.o (symbol from plugin)
+ .text          0x00000000        0x0
../!Program/Object/Buttons/buttons.o (symbol from plugin)
+ .text          0x00000000        0x0
../!Program/Object/ByteStuffing/byte_stuffing.o (symbol from plugin)
+ .text          0x00000000        0x0
../!Program/Object/HARDWARE_PROGRAM/reset_hardware.o (symbol from
plugin)
...

Tables of strings and tables of function pointers have also been removed.

If main(), and many other used functions, are being removed little
wonder the program doesn't work with LTO.

I no longer understand what LTO was meant to do (I'm sure throwing
away vast amounts of needed code and tables was not its purpose), so
I'll give up on it for now.

If you have any interest in looking at this code, let me know and I'll
put it on a web site for you to download.

Here is the LTO Report, if it is of any help:

Using built-in specs.
COLLECT_GCC=j:\Apps\avr-gcc-4.7.1-rc1-mingw32\bin\avr-gcc.exe
COLLECT_LTO_WRAPPER=j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/lto-wrapper.exe
Target: avr
Configured with: ../../gcc.gnu.org/gcc-4_7-branch/configure
--target=avr --prefix=/local/gnu/install/gcc-4.7-mingw32
--host=i386-mingw32 --build=i686-linux-gnu --enable-languages=c,c++
--disable-nls --disable-shared --with-dwarf2 : (reconfigured)
../../gcc.gnu.org/gcc-4_7-branch/configure --target=avr
--prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32
--build=i686-linux-gnu --enable-languages=c,c++ --disable-nls
--disable-shared --with-dwarf2
Thread model: single
gcc version 4.7.1 20120606 (prerelease) (GCC)
COMPILER_PATH=j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/bin/
LIBRARY_PATH=j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/avrxmega7/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/avrxmega7/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-v' '-mmcu=atxmega128a1' '-I' '.'
'-mcall-prologues' '-D' 'USE_DEBUGGING=0' '-Werror' '-Wextra'
'-Winline' '-pedantic' '-D' 'atxmega128a1' '-gdwarf-2' '-D'
'F_CPU=4000000UL' '-D' ... 'Version' '-I' '../!PROGRAMSoutput/Object'
'-I' '..' '-I' '../..' '-std=gnu99' '-MMD' '-MP' '-MF'
'../!PROGRAMSoutput/Dep/PROGRAMS.elf.d' '-o'
'../!PROGRAMSoutput/Object/PROGRAMS.elf' '-flto' '-flto-report'
 j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/collect2.exe
-plugin 
j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/liblto_plugin-0.dll
-plugin-opt=j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/lto-wrapper.exe
-plugin-opt=-fresolution=J:\Temp\ccUXfBhU.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -flto -m avrxmega7 -o
../!PROGRAMSoutput/Object/PROGRAMS.elf
j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/avrxmega7/crtx128a1.o
-Lj:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/avrxmega7
-Lj:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/avrxmega7
-Lj:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1
-Lj:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc
-Lj:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib
../!PROGRAMSoutput/Object/Main/main.o
../!PROGRAMSoutput/Object/Main/signature.o  ...
../!PROGRAMSoutput/Object/./HARDWARE_PROGRAM/sp_ReadFuseByte.o
../!PROGRAMSoutput/Object/./HARDWARE_PROGRAM/sp_ReadCalibrationByte.o
../!PROGRAMSoutput/Object/./HARDWARE_PROGRAM/sp_commoncmd.o
../!PROGRAMSoutput/Object/./EEPROM/eerd_byte.o
../!PROGRAMSoutput/Object/./EEPROM/eerd_word.o
../!PROGRAMSoutput/Object/./EEPROM/eewr_byte.o
../!PROGRAMSoutput/Object/./EEPROM/eewr_word.o
../!PROGRAMSoutput/Object/./EEPROM/eewr_block.o
../!PROGRAMSoutput/Object/./EEPROM/eerd_block.o
-Map=../!PROGRAMSoutput/Object/PROGRAMS.map --cref -lm
--defsym=REBOOT_COUNTER=0x802000 --section-start=.noinit=0x802004
--section-start=.data=0x802204 --section-start=.eeprom=0x00810000
--section-start=.BOOT=0x21F80 -lgcc -lc -lgcc
 j:\Apps\avr-gcc-4.7.1-rc1-mingw32\bin\avr-gcc.exe @J:\Temp\ccwd0GrH.args
Using built-in specs.
COLLECT_GCC=j:\Apps\avr-gcc-4.7.1-rc1-mingw32\bin\avr-gcc.exe
Target: avr
Configured with: ../../gcc.gnu.org/gcc-4_7-branch/configure
--target=avr --prefix=/local/gnu/install/gcc-4.7-mingw32
--host=i386-mingw32 --build=i686-linux-gnu --enable-languages=c,c++
--disable-nls --disable-shared --with-dwarf2 : (reconfigured)
../../gcc.gnu.org/gcc-4_7-branch/configure --target=avr
--prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32
--build=i686-linux-gnu --enable-languages=c,c++ --disable-nls
--disable-shared --with-dwarf2
Thread model: single
gcc version 4.7.1 20120606 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-c' '-mmcu=atxmega128a1' '-v'
'-mmcu=atxmega128a1' '-mcall-prologues' '-D' 'USE_DEBUGGING=0'
'-Werror' '-Wextra' '-Winline' '-pedantic' '-D' 'atxmega128a1'
'-gdwarf-2' '-D' 'F_CPU=4000000UL' ... '-D' 'FLASH_PAGE_SIZE=512'
'-Os' '-funsigned-char' '-fpack-struct' '-flto-report' '-dumpdir'
'../!PROGRAMSoutput/Object/' '-dumpbase' 'PROGRAMS.elf.wpa'
'-fltrans-output-list=J:\Temp\ccQbAVNV.ltrans.out' '-fwpa'
'-fresolution=J:\Temp\ccUXfBhU.res'
 j:/apps/avr-gcc-4.7.1-rc1-mingw32/lib/gcc/../../libexec/gcc/avr/4.7.1/lto1.exe
-quiet -dumpdir ../!PROGRAMSoutput/Object/ -dumpbase PROGRAMS.elf.wpa
-mmcu=atxmega128a1 -mmcu=atxmega128a1 -mcall-prologues -auxbase main
-gdwarf-2 -Os -Werror -Wextra -Winline -pedantic -version
-funsigned-char -fpack-struct -flto-report
-fltrans-output-list=J:\Temp\ccQbAVNV.ltrans.out -fwpa
-fresolution=J:\Temp\ccUXfBhU.res @J:\Temp\ccwzzI0Y
GNU GIMPLE (GCC) version 4.7.1 20120606 (prerelease) (avr)
        compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 4.7.1 20120606 (prerelease) (avr)
        compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GIMPLE type table: size 16381, 833 elements, 3406 searches, 113
collisions (ratio: 0.033177)
GIMPLE type hash table: size 8191, 3410 elements, 18779 searches,
26853 collisions (ratio: 1.429948)
GIMPLE canonical type table: size 16381, 268 elements, 960 searches,
13 collisions (ratio: 0.013542)
GIMPLE canonical type hash table: size 2039, 902 elements, 2187
searches, 1587 collisions (ratio: 0.725652)
WPA statistics
[WPA] # of input files: 70
[WPA] # of input cgraph nodes: 551
[WPA] # of function bodies: 0
[WPA] GIMPLE type table is empty
GIMPLE type hash table is empty
GIMPLE canonical type table is empty
GIMPLE canonical type hash table is empty
[WPA] # of output files: 1
[WPA] # of output cgraph nodes: 64
[WPA] # callgraph partitions: 0
[WPA] Compression: 318085 input bytes, 1284092 uncompressed bytes
(ratio: 4.036946)
[WPA] Size of mmap'd section decls: 228426 bytes
[WPA] Size of mmap'd section function_body: 41212 bytes
[WPA] Size of mmap'd section statics: 1400 bytes
[WPA] Size of mmap'd section cgraph: 14118 bytes
[WPA] Size of mmap'd section vars: 4669 bytes
[WPA] Size of mmap'd section refs: 4685 bytes
[WPA] Size of mmap'd section asm: 0 bytes
[WPA] Size of mmap'd section jmpfuncs: 11139 bytes
[WPA] Size of mmap'd section pureconst: 2316 bytes
[WPA] Size of mmap'd section reference: 0 bytes
[WPA] Size of mmap'd section symtab: 0 bytes
[WPA] Size of mmap'd section opts: 0 bytes
[WPA] Size of mmap'd section cgraphopt: 0 bytes
[WPA] Size of mmap'd section inline: 10120 bytes
COMPILER_PATH=j:/apps/avr-gcc-4.7.1-rc1-mingw32/lib/gcc/../../libexec/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/lib/gcc/../../libexec/gcc/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../libexec/gcc/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/bin/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/bin/
LIBRARY_PATH=j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/avrxmega7/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/avrxmega7/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/;j:/apps/avr-gcc-4.7.1-rc1-mingw32/bin/../lib/gcc/avr/4.7.1/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-c' '-mmcu=atxmega128a1' '-v'
'-mmcu=atxmega128a1' '-mcall-prologues' '-D' 'USE_DEBUGGING=0'
'-Werror' '-Wextra' '-Winline' '-pedantic' '-D' 'atxmega128a1'
'-gdwarf-2' '-D' 'F_CPU=4000000UL'... '-Os' '-funsigned-char'
'-fpack-struct' '-flto-report' '-dumpdir' '../!PROGRAMSoutput/Object/'
'-dumpbase' 'PROGRAMS.elf.wpa'
'-fltrans-output-list=J:\Temp\ccQbAVNV.ltrans.out' '-fwpa'
'-fresolution=J:\Temp\ccUXfBhU.res'
 j:\Apps\avr-gcc-4.7.1-rc1-mingw32\bin\avr-gcc.exe @J:\Temp\cc6TAHso.args
Using built-in specs.
COLLECT_GCC=j:\Apps\avr-gcc-4.7.1-rc1-mingw32\bin\avr-gcc.exe
Target: avr
Configured with: ../../gcc.gnu.org/gcc-4_7-branch/configure
--target=avr --prefix=/local/gnu/install/gcc-4.7-mingw32
--host=i386-mingw32 --build=i686-linux-gnu --enable-languages=c,c++
--disable-nls --disable-shared --with-dwarf2 : (reconfigured)
../../gcc.gnu.org/gcc-4_7-branch/configure --target=avr
--prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32
--build=i686-linux-gnu --enable-languages=c,c++ --disable-nls
--disable-shared --with-dwarf2
Thread model: single
gcc version 4.7.1 20120606 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-c' '-mmcu=atxmega128a1' '-v'
'-mmcu=atxmega128a1' '-mcall-prologues' '-D' 'USE_DEBUGGING=0'
'-Werror' '-Wextra' '-Winline' '-pedantic' '-D' 'atxmega128a1'
'-gdwarf-2' '-D' 'F_CPU=4000000UL' ... '-Os' '-funsigned-char'
'-fpack-struct' '-flto-report' '-dumpdir' '../!PROGRAMSoutput/Object/'
'-dumpbase' 'PROGRAMS.elf.ltrans0' '-fltrans' '-o'
'J:\Temp\ccQbAVNV.ltrans0.ltrans.o'
 j:/apps/avr-gcc-4.7.1-rc1-mingw32/lib/gcc/../../libexec/gcc/avr/4.7.1/lto1.exe
-quiet -dumpdir ../!PROGRAMSoutput/Object/ -dumpbase
PROGRAMS.elf.ltrans0 -mmcu=atxmega128a1 -mmcu=atxmega128a1
-mcall-prologues -auxbase-strip J:\Temp\ccQbAVNV.ltrans0.ltrans.o
-gdwarf-2 -Os -Werror -Wextra -Winline -pedantic -version
-funsigned-char -fpack-struct -flto-report -fltrans @J:\Temp\cc6XKiH8
-o J:\Temp\cc2Llre7.s
GNU GIMPLE (GCC) version 4.7.1 20120606 (prerelease) (avr)
        compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 4.7.1 20120606 (prerelease) (avr)
        compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GIMPLE type table: size 16381, 457 elements, 469 searches, 11
collisions (ratio: 0.023454)
GIMPLE type hash table: size 1021, 474 elements, 2024 searches, 784
collisions (ratio: 0.387352)
GIMPLE canonical type table: size 16381, 163 elements, 585 searches, 7
collisions (ratio: 0.011966)
GIMPLE canonical type hash table: size 1021, 527 elements, 1344
searches, 519 collisions (ratio: 0.386161)
LTRANS statistics
[LTRANS] # of input files: 1
[LTRANS] # of input cgraph nodes: 86
[LTRANS] # of function bodies: 57
[LTRANS] GIMPLE type table is empty
GIMPLE type hash table is empty
GIMPLE canonical type table is empty
GIMPLE canonical type hash table is empty
[LTRANS] Size of mmap'd section decls: 429084 bytes
[LTRANS] Size of mmap'd section function_body: 111628 bytes
[LTRANS] Size of mmap'd section statics: 39 bytes
[LTRANS] Size of mmap'd section cgraph: 2076 bytes
[LTRANS] Size of mmap'd section vars: 1703 bytes
[LTRANS] Size of mmap'd section refs: 4151 bytes
[LTRANS] Size of mmap'd section asm: 0 bytes
[LTRANS] Size of mmap'd section jmpfuncs: 0 bytes
[LTRANS] Size of mmap'd section pureconst: 0 bytes
[LTRANS] Size of mmap'd section reference: 68 bytes
[LTRANS] Size of mmap'd section symtab: 0 bytes
[LTRANS] Size of mmap'd section opts: 0 bytes
[LTRANS] Size of mmap'd section cgraphopt: 505 bytes
[LTRANS] Size of mmap'd section inline: 0 bytes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]