[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Linker optimization
From: |
Bob Hansen |
Subject: |
[avr-gcc-list] Linker optimization |
Date: |
Wed, 26 Jun 2002 08:41:10 -0400 |
If I create a file test1.c that reads
int main( void )
{
}
and compile the file with
avr-gcc -Os -Wl,-Map=test1.map,--cref -mmcu=at90s8515 -o test1.elf test1.c
the generated map file indicates that the .text segment is 0x60 bytes, and
main is 0x04 bytes long. Cool.
If I then alter test1.c to be
void foo( void )
{
foo();
}
int main( void )
{
}
and compile the file with
avr-gcc -Os -Wl,-Map=test1.map,--cref -mmcu=at90s8515 -o test1.elf test1.c
the generated map file indicates that the .text segment is 0x64 bytes, and
foo() is 4 bytes long and linked into the program.
Is there some linker flag that I should be including to tell the linker to
ditch any unused functions? I noticed a while back that all of my unused
library functions were still making it into the finished executable and
taking up useless space.
Thanks,
-Bob Hansen
avr-gcc-list at http://avr1.org
- [avr-gcc-list] Linker optimization,
Bob Hansen <=