Arm-none-eabi-gcc: SECTIONS: incomprehensible syntax * <archivename> .a:

I couldn't find a clear answer to a very specific problem, even after reading several pages of manual and tutorials. I am working on a linker script for the tool chain mentioned in the title. During development, I linked a static library reference (archived, .a) to a location in my RAM. I might not have accomplished this task by treating it like a regular .o file like in the following example:

SECTIONS {
  outputa 0x10000 :
    {
    all.o
    foo.o (.input1)
    }
  outputb :
    {
    foo.o (.input2)
    foo1.o (.input1)
    }
  outputc :
    {
    *(.input1)
    *(.input2)
    }
}

      

After a long journey, I found a clue in another Question . This led me to my current solution:

...
    .ramlib : ALIGN(4)
        {
            *liblpcspifilib_M3.a: (*);
        } > RamLoc40  AT>MFlashA512
...

      

Pay attention to the colon syntax. This will link all content liblpcspifilib

as a block to Ram. However, without the ":" it won't link anything. Even after I found out how to solve the problem, I couldn't find any other information about this behavior.

Can someone explain this to me?

+3


source to share


1 answer


For some reason, this information is hard to find in the official GNU docs, so I guess this is some kind of extension. Here on page 50 it tells us:



You can also specify files in archives by writing a pattern matching the archive, a colon, then a pattern matching the file, with no spaces around the colon.

‘archive:file’ matches file within archive
‘archive:’ matches the whole archive
‘:file’ matches file but not one in an archive

      

+1


source







All Articles