Having trouble with gcc/binutils
Posted: Sun Dec 23, 2007 5:51 am
Hi,
I want to port my kernel to x86-64, so i built gcc/bintuils with "x86_64-pc-elf" support according to the wiki. Now my problem is that my kernel grows > 1MB. It seems that it depends on the physical address I link to. If I link it to say 0x100000 it has > 1MB if i link it to 0x1 it has only several KB's.
Has someone an idea how to fix it?
GCC-version 4.2.2 (tried 4.2.1 too same error)/ binutils-version 2.18 built with Cygwin 3.4.4 on Vista64
My Linkerscript:
Buildscript:
I want to port my kernel to x86-64, so i built gcc/bintuils with "x86_64-pc-elf" support according to the wiki. Now my problem is that my kernel grows > 1MB. It seems that it depends on the physical address I link to. If I link it to say 0x100000 it has > 1MB if i link it to 0x1 it has only several KB's.
Has someone an idea how to fix it?
GCC-version 4.2.2 (tried 4.2.1 too same error)/ binutils-version 2.18 built with Cygwin 3.4.4 on Vista64
My Linkerscript:
Code: Select all
OUTPUT_FORMAT("elf64-x86-64")
INPUT(loader.o kernel.o idt.o video.o atomic.o)
ENTRY(start)
addr = 0x100000;
SECTIONS
{
. = addr;
start_kernel_ = .;
.text ALIGN(0x1000) :
{
code = .;
*(.text)
*(.rodata)
}
.data ALIGN(0x1000) :
{
data = .;
*(.data)
_ctors_start = .; /* constructors */
*(.ctor*)
_ctors_end = .;
}
.bss ALIGN(0x1000) :
{
bss = .;
*(.bss)
}
end_kernel_ = .;
/DISCARD/ : { *(.comment .note.GNU-stack .eh_frame) }
}
Code: Select all
yasm -m amd64 -f elf64 src/loader.asm
x86_64-pc-elf-g++ -O0 -c src/*.cpp -Wall -nostdinc -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-stack-protector -nostartfiles -I./src/include
x86_64-pc-elf-ld -T link.txt -o kernel.sys -nostdlib -Map kernelmap.map