[arm-gnu] ffunction-sections and linker script input section bug?

Martin Velek martin.velek at gmail.com
Wed Jan 30 09:57:43 UTC 2013


Hello,

problem solved. EXCLUDE_FILE is relevant only to the closest input section.
I had to modify it in this way:
*(EXCLUDE_FILE (*liblibrary.a:) .text EXCLUDE_FILE (*liblibrary.a:) .text.*
EXCLUDE_FILE (*liblibrary.a:) .gnu.linkonce.t.*)

Best
Martin

On Tue, Jan 29, 2013 at 1:06 PM, Martin Velek <martin.velek at gmail.com>wrote:

> Hello,
>
> I am using NXP LPC2478 with connected ext. NOR flash 16MB  for storing
> code of huge libraries. The LPC2478 contains 512KB flash "onboard". My idea
> was to divide the frequently running code into internal flash, the rest
> into ext. NOR flash. I did not want to set attribute to every function, so
> that I have created a main program and a static library.
>
> my linker script contains:
>
> MEMORY
> {
>   rom (rx) : ORIGIN = 0x0, LENGTH = 504K
>   ram (rwx) : ORIGIN = 0x40000000, LENGTH = 64K
>   extnor (rx) : ORIGIN = 0x80000000, LENGTH = 16M
> }
>
>   .text :
>   {
> ....
>   *(EXCLUDE_FILE (*liblibrary.a:) .text .text.* .gnu.linkonce.t.*)
> ....
> }
>
>  ..cs3.extnor : ALIGN (8)
>   {
> ...
>     *liblibrary.a:(.text .text.* .gnu.linkonce.t.*)
> ...
>     . = ALIGN (8);
>   } >extnor
>
>
>
> It works as expected (code from the library is placed from 0x80000000)
> until I compile the library with -ffunction-sections. Thereafter the linker
> ignores input section .cs3.extnor and places everything into .text.
>
> Is it a bug or I have misunderstood documentation?
>
> Best Regards,
> Martin Velek
>
>
> P.S.
> I have tried the latest Codebench (trial) for reproducing the issue. There
> are two projects, library - static library, testFS - main program. Both
> contain two configuration - DebugOK and DebugNOT_OK. You can the check
> function placement from Debug[OK|NOT_OK]/testFS.map. If you recreate the
> board, you will lost the content.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20130130/3952eeab/attachment.html>


More information about the arm-gnu mailing list