OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 10:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: exporting nasm code as win64 causes it to add extra junk
PostPosted: Fri May 08, 2020 10:57 am 
Offline

Joined: Fri May 08, 2020 10:03 am
Posts: 1
I have created a custom bootloader and created the kernel in c++ following the osdev wiki. When I try to compile the assembly with
Code:
nasm.exe -f win64 boot.asm -o boot.obj
, compile the kernel.cpp to kernel.obj, and link it with
Code:
~\tdm-gcc64\c++.exe -T linker.ld -o Boot.img -ffreestanding -nostdlib boot.obj kernel.obj
it will have extra "This program cannot be run in DOS mode" I also don't know how to set it to start at 0x7c00 as
Code:
org 0x7c00
doesn't work unless in binary format. Any help will be appreciated.


Top
 Profile  
 
 Post subject: Re: exporting nasm code as win64 causes it to add extra junk
PostPosted: Fri May 15, 2020 2:45 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5134
You're using a compiler targeted towards Windows, so it creates Windows EXE files by default. Does your linker script tell it you want a flat binary?

I strongly recommend using a cross-compiler. It's much easier to get help with your compiler when you're using the same compiler that everyone else is using.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 813 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group