Link script question
Posted: Thu Mar 14, 2013 6:08 am
In Beginner Mistakes, it's mentioned that the .rodata section is supposed to be located within the .text section. My linker script places it in its own section, like so:
Is there any reason .rodata must/should be in .text?
Everything compiles and runs, I'm just wondering why the page is so specific.
EDIT: I reread the page, and it mentions some problems, but it's not clear if they occur if .rodata is not included in the link script, or if it's not in the .text section.
Code: Select all
OUTPUT_FORMAT(elf64-x86-64)
ENTRY(kmain)
SECTIONS
{
. = 0x30000;
.text : { *(.text) }
.rodata : { *(.rodata) }
.data : { *(.data) }
.bss : { *(.bss) }
}
Everything compiles and runs, I'm just wondering why the page is so specific.
EDIT: I reread the page, and it mentions some problems, but it's not clear if they occur if .rodata is not included in the link script, or if it's not in the .text section.