Reputation: 148
My linker script is like this:
SECTIONS {
.uninit : {
PROVIDE(_uninit_start = .);
PROVIDE(_stack_start = .);
. += CONFIG_STACK_SIZE * CONSTS_HARTS_NUMBER;
PROVIDE(_stack_end = .);
. = ALIGN(4K);
PROVIDE(_uninit_end = .);
}
}
However, the output sections are like this:
[ 7] .bss NOBITS 0000000080357000 00158000
0000000000034000 0000000000000000 WA 0 0 4096
[ 8] .uninit PROGBITS 000000008038b000 0018c000
0000000001020000 0000000000000000 WA 0 0 1
If I use objcopy
to copy the elf file to the binary file, the output size would be much larger than it should be.
Now my question is: how can I set a NOBITS flag for my custom section in the linker script?
Upvotes: 2
Views: 1362
Reputation: 369
Just use NOLOAD linker directive.
SECTIONS {
.uninit (NOLOAD) : {
...
Upvotes: 1
Reputation: 21954
You can not specify section attributes in linker scripts, only in assembly:
.section .uninit,"wa",@nobits
Upvotes: 1