nasm - ORG Directive

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.
Post Reply
vision
Posts: 12
Joined: Wed Oct 27, 2010 1:32 pm
Location: Warsaw, Poland

nasm - ORG Directive

Post by vision »

Hi!
It was only beginning to learn assembler.

I use NASM to compile the files.
Always, everything was fine, but now I need to compile a file with *.asm to *.o
"nasm-f aout-o kernel.asm kernel.o"
I have a problem, because it shows me nasm error on this line:
"ORG 0x00001000"
I understand that files aout can not have ORG directive?
How to replace the ORG?

PS. Sorry for the mistakes, but I'm Polish; /
Dario
Member
Member
Posts: 117
Joined: Sun Aug 31, 2008 12:39 pm

Re: nasm - ORG Directive

Post by Dario »

$man nasm
FORMAT-SPECIFIC DIRECTIVES
ORG address is used by the bin flat-form binary output format, and
specifies the address at which the output code will eventually be loaded.
So since executable formats are relocatable, they don't need [org] directive, but rather get their respective addresses during the linking phase. In other words, use [org] when outputning your code in flat binary.
____
Dario
Post Reply