Is it possible to pass command line arguments to GNU LD to create a section, define size and place it in a specific memory?
Asked Answered
P

1

10

I want to create a section in RAM, allocate a specific size and place it an an address? Is it possible to do all these operations without passing a linker script "file" or w/o modifying the existing linker script ?

.myspace :
{
        . = 0x10000;
        . = . + STACK_SIZE;
} > ram

Is it possible to do all the operation done by linker script in command line with GNU LD/GCC ?

Paleoecology answered 11/6, 2014 at 6:45 Comment(0)
L
3

Seems like a way outdated answer, but anyway.

It's not possible to reserve the section size via ld command line options, but if the next section starts at the end of your special section, you can try something like this:

ld --section-start=.myspace=0x10000 -Ttext=0x11000 ...
Laubin answered 25/5, 2018 at 5:49 Comment(2)
What about --defsym=symbol=expression ?Cannibalize
I take it, --defsym works only if the symbol was declared with checking for DEFINED(symbol). And in default ld script it is not true for sections and many other things. Anyway, if it's possible to override some symbols it may be used.Laubin

© 2022 - 2024 — McMap. All rights reserved.