[LLVMdev] [lld] Linker script findings.
Stephen Checkoway
s at pahtak.org
Thu Jan 10 11:46:39 PST 2013
On Jan 7, 2013, at 9:44 AM, Shankar Easwaran <shankare at codeaurora.org> wrote:
> Also the linker script functionality is only needed by ELF and not anything else. It should be contained only within ELF.
I don't have an opinion on where it is needed, but I've found linker scripts to be useful in other contexts. Here's a simple one I wrote that has no relation to ELF:
OUTPUT_FORMAT(binary)
OUTPUT(flash.bin)
SECTIONS
{
.text :
{
. = 0x2000;
LONG(0xAABBCCDD);
LONG(Init);
LONG(Store);
LONG(Erase);
LONG(Write);
*(.text)
*(.rodata)
}
}
(The documentation seemed to imply that I could write .text 0x2000 : AT(0), but that never worked for me, so I just stripped off 0x2000 bytes of 0 at the beginning.)
Maybe there's a way to do that without linker scripts, but this was very easy.
All of this is to say if it's not a lot of extra work, linker scripts should be supported outside of ELF.
--
Stephen Checkoway
More information about the llvm-dev
mailing list