Reputation: 26
Premise:
I want to compile my Rust code with a custom linker script, cargo uses this script, and compiles and links my binary without any errors.
Problem:
I want to have a custom section in "SECTIONS" of my linker script that looks something like this:
.reserved_block : {
. = ALIGN(8);
__object_buffer = .;
KEEP(*(.reserved_block))
. = . + 16K;
LONG(0);
} : reserved
I defined reserved PHDR, before my SECTIONS label in my linker script, like this:
PHDRS
{
reserved PT_LOAD FLAGS(5);
}
When I examine my binary under readelf command I get this for my .reserved_block section:
[19] .reserved_block PROGBITS 00000000004587fb 000587fb
0000000000004009 0000000000000000 WA 0 0 1
Can you suggest what I'm missing in my understanding of linker script syntax for LD, so that I have this behaviour?
I tried to add my custom script, and didn't get expected behaviour
Upvotes: 0
Views: 38