My question is with locating library .a files in linker scripts. A normal linker script is arranged with .text, .data, .rodata, and .bss sections.
.text :
{
*(.text .text.*)
*(.rodata .rodata*) /* global const uint32_t i = 10 for example */
} > rom
.data :
{
*(.data .data.*)
} > ram AT > rom
.bss (NOLOAD) :
{
*(.bss .bss.*)
} > ram
What I would like to know is can .text, .data, .rodata, and .bss sections in a library such as libc.a be placed in separate areas from the rest of the sections? Placing .text in a different area is accomplished with *\libc.a:*
but how are .data, .rodata, and .bss relocated?
.text1 :
{
*\libc.a:* //.text from libc.a is placed into rom1 instead of rom
} > rom1
I anticipated the answer for placing .data, .rodata, and .bss could be with similar syntax but the syntax below is wrong because libc.a sections are still in ram and rom instead of ram1 and rom1.
.text1 :
{
*\libc.a:*(.text .text.*) // libc.a.text still resides in rom
*\libc.a:*(.rodata .rodata.*) // libc.a.rodata still resides in rom
} > rom1
.data1 :
{
*\libc.a:*(.data .data.*) // libc.a.data still resides in ram
} > ram1 AT > rom1
.bss1 (NOLOAD) :
{
*\libc.a:*(.bss .bss.*) // libc.a.bss still resides in ram
} > ram1
Are there any hints to separate .data, .rodata, and .bss from an .a file into their own sections?
a
insomelib.a
stands for archive. It's simply an uncompressed archive of object files. As such it doesn't really contain any segments by itself. – Some programmer dude