(original) (raw)
MEMORY
{
flash (rx) : ORIGIN = 0x20000, LENGTH = 0x8000
ram (rwx) : ORIGIN = 0x20005000, LENGTH = 0x00003000
}
REGION\_ALIAS("REGION\_TEXT", flash);
REGION\_ALIAS("REGION\_RAM", ram);
SECTIONS
{
.text :
{
...
} > REGION\_TEXT
\_etext = .;
.data :
{
...
} > REGION\_RAM AT > REGION\_TEXT
}
But the MEMORY entries don't seem to be evaluated and ">", "AT", and "REGION\_ALIAS" don't seem to be hooked up either. Command line options like "-Tdata=org=0x20005000" or "--section-start=.data= 0x20005000" are also not working.
However, the following linker script gets us close:
SECTIONS
{
. = 0x20000;
.text :
{
...
}
\_etext = .;
. = 0x20005000;
\_data = .;
.data :
{
...
}
}
The only problem is the resulting elf and binary files are HUGE (e.g. elf is 500mb vs 50k) as the linker seems to be filling the space between the end of text and the beginning of data. A "llvm-readobj -s" on the resulting elf is nearly identical to one created with binutils except binults-ld puts .data at Address: 0x20005000 Offset: 0xD000 and llvm-lld has data at Address: 0x20005000 Offset: 0x1FFED000 (based on start address of 0x18000.)
Any thoughts on a supported linker flag or linker script option that can help here? Or a source file to dive into to get something working? I'd be willing to take a pass at completing the MEMORY section implementation if that's the most sane way to move forward but would love a pointer in the right direction.
Thanks,
Ed