This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld linker script and non-contiguous memory region


Hi all,

How can I write a linker script to tell the linker to place sections around a "hole" in my memory region?
Is it possible?

For example:
I define a memory region
MEMORY?
{
/* 0x0 -> 0x4000 */
FLASH (rx) : ORIGIN = 0x0, LENGTH = 16K
}

Now I define an output section for my code
SECTIONS?
{
.text :
{
*(.text*)
} > FLASH
}

Now I want to make sure that the linker never places?
anything inside of the area 0x2000 -> 0x3000. How could I express that?

I could for example define the memory as two regions (starting at 0x0 length 8K and 0x3000 length 4K) instead,
but then I would have to manually place code from different object files/sections into the two regions to fill it optimally (?).

Is there a way to make the linker take care of this for me?



NOTE: the above linker script is simplified for demonstration purposes

Best regards


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]