Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I have now another problem : when i use strings in my program (like "Hello world !"), the compiler makes me an 1M binary file, and place the strings at the beginning of the program, before the AOUT kludge needed by GRUB, so I can't use my kernel.
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys :
{
code = .;
*(.text)
*(.rodata*) <- Include the string data
}
.data :
{
data = .;
*(.data)
}
.bss :
{
bss = .;
*(.bss)
}
end = .;
}
I wrote:The rodata section (read-only data) includes all constant global data that the executable uses. As string literals are constant by definition, they also get put into this section. If your linker-script doesn't include the rodata section, the linker can't add the strings to the binary and all strings pointers are invalid.