avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] [RFC] Patch adding support for atmega2560-2561


From: Björn Haase
Subject: Re: [avr-libc-dev] [RFC] Patch adding support for atmega2560-2561
Date: Mon, 19 Sep 2005 15:14:52 +0200
User-agent: KMail/1.7.1

David Brown wrote on Montag, 19. September 2005 09:53 :
> An alternative idea might be to use individual sections such as
> ".text1_foo" for the stub for function foo(), and make use of the
> "--gc-sections" option in the linker to remove any such section that is not
> used.  I'm thinking of the same idea as the "-ffunction-sections" switch in
> gcc which can be used with "--gc-sections" to avoid linking in functions
> that are not used.  I haven't tried the "-ffunction-sections" switch, and
> don't even know if it is implemented for the avr port, but perhaps the same
> idea can be used.
Your idea indeed works! However, one will to have to change the binutil's 
default linker scripts and avr-libc's crt file a bit, such that the 
--gc-sections switch actually works: One will probably have to replace the 
sections .init1 up to .init9 by .init 1 up to .init 9 (note the white space 
between the numbers). Otherwise, e.g. .init2 will be considered to be an 
unused section and would be thrown away. If it's subsection 2 of the .init 
section that does not happen. Also one would have to add 
-Wl,--entry=__vectors to the linker options such that the reset vector is 
taken as a starting point.

Positive side-effect would also be that with -ffunction-sections unused 
functions that are not declared static could be removed by the linker.

Yours,

Bjoern




reply via email to

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