Code: Select all
PROVIDE(init_start = .);
/* Code and data which can be discarded after initialization. */
.idata ALIGN(0x1000) : {
*(.mbheader) /* Must be at the start of the resulting image. */
*(.idata)
}
.icode ALIGN(0x1000) : {
*(.icode)
}
PROVIDE(init_end = .);
Code: Select all
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 1] .idata PROGBITS 00100000 001000 000020 00 WA 0 0 32
[ 2] .icode PROGBITS 00101000 004000 000040 00 0 0 1
[ 3] .text PROGBITS 00102000 002000 000115 00 AX 0 0 8
[ 4] .rodata PROGBITS 00103000 003000 00000f 00 A 0 0 1
[ 5] .data PROGBITS 00104000 004000 000000 00 WA 0 0 4
[ 6] .bss NOBITS 00104000 004000 005000 00 WA 0 0 32
Now, the issue here is that .idata should have the flags WA (alloc & writable) and .icode should have AX (alloc & executable). I've looked through the documentation for ld but I've found nothing about how to setup section flags. Does anyone know?
My kernel still works without this I just like things to be correct.
Cheers,
Paul Barker
EDIT: Putting a function written in c in .icode solves this. The assembler doesn't set the propper flags but gcc does.