Page 1 of 1

nasm - ORG Directive

Posted: Fri Dec 24, 2010 8:04 am
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; /

Re: nasm - ORG Directive

Posted: Fri Dec 24, 2010 11:02 am
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.