Using avr-gcc, avr-ld
I'm attempting to severely reduce the size of the output file by using fdata-sections -ffunction-sections and gc-sections. When compiled without these options I have an output of ~63KB, and with these options its ~30KB, so it seems great.
Unfortunately, after loading and testing the output I notice it doesn't work correctly. Garbage collection seems to have removed far more than I expected, and examining the .map I notice some key data is nonexistent.
Any idea on what at link time is causing these data/functions to be discarded? (I realize this may be too hopeful of a question with how little detail I provided, if any information is needed please ask and I'd do my best to provide it)
Is there a way to trace what symbols were tossed by garbage collection as they were "unused"?
Without using -fdata-sections -ffunction-sections -gc-sections, can I trace a symbol dependencies? (To verify gc-sections only collected what it should) - I noticed this this as an option, but it would be very painful for me to use the method suggested by Verax
EDIT: compiler and linker lines
avr-ld -mavrxmega6 -gc-sections -Tlinkerscript files libgcc.a -o firmware.elf
avr-gcc -Wall -Wstrict-prototypes -g -ffunction-sections -fdata-sections -Os -mmcu=atxmega256a3 -fno-jump-tables -std=gnu99 -fpack-struct -fno-common -mcall-prologues -c -o file.o file.c