I have problem. I have compiled file boot.o:
[BITS 16]
[ORG 0x7C00]
[global start]
[extern _main]
start:
call _main
cli
hlt
and compiled C++ file main.o:
int main(){
//processes
}
Im using this LD file linker.ld for linking:
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
. = 0x100000;
.text ALIGN(4096) :
{
*(.text*)
*(.gnu.linkonce.t*)
}
.rodata ALIGN(4096) :
{
start_ctors = .;
*(.ctor*)
end_ctors = .;
start_dtors = .;
*(.dtor*)
end_dtors = .;
*(.rodata*)
*(.gnu.linkonce.r*)
}
.data ALIGN(4096) :
{
*(.data*)
*(.gnu.linkonce.d*)
}
.bss ALIGN(4096) :
{
*(.COMMON*)
*(.bss*)
*(.gnu.linkonce.b*)
}
}
So I want to start linking and I’m using g++ for windows, and I’m using this commands in cmd: ld -T linker.ld -o kernle.bin main.o boot.o. And is rejecting me error: ld: cannot preform PE operations on non PE output file kernel.bin. Does anybody know how can I repair it? Please help me.
Maybe -oformat bin?
And I doubt you will be able to boot it, anyway… Go read some bootloader tutorials (on osdev.org and brokenthorn.com) and you will get an answer why.