Data segment at the beginning of the binary
Posted: Sun Oct 01, 2006 10:07 am
Hello !
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.
My main code is :
And my link.ld file is :
But when i use character constants (like 'A'), my kernel boots without any problem.
Can someone say me where is the problem ?
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.
My main code is :
Code: Select all
#include <VgaText.h> //My VGA Text driver
extern "C" void kernel_main()
{
VGA::Text::Init();
VGA::Text::PutString("Hello, World !");
while(true);
}
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Can someone say me where is the problem ?