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

Martin Velek martin.velek at gmail.com
Tue Jan 29 12:06:11 UTC 2013


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/20130129/7259a01c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FStest.tar.gz
Type: application/x-gzip
Size: 9773 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20130129/7259a01c/attachment.bin>


More information about the arm-gnu mailing list