NASM targets - odd behavior

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
lacrymology

NASM targets - odd behavior

Post by lacrymology »

I have a number of source files, but for simplicity I will only mention a few (the minimum needed).

Anyway, I am using NASM, gcc, and GNU ld to build my code which takes the following form:

loader.asm
stage2.asm
Kernel.cpp
Out.cpp

Basically, the loader sets up a20 and all that nonsense and loads a file named stage2.bin which then calls the main function contained in Kernel.cpp which then calls Out.displayBitmap() which shows my OS logo. This is the bear minimum functionality.

While building stage2 in Linux using NASM as the aout target and linking it together with ld to the Kernel.cpp and Out.cpp files everything is peachy. However, when I do the same thing using Cygwin, ld complains that the format of stage2.o (the intermediate file to be linked) is not recognized. I am 99.8% certain that the build scripts are the same (although I have not implemented source control yet), so I am curious what the situation may be. My line to build stage2.o is:

Code: Select all

nasm -f aout -o bin/stage2.o stage2.asm
my gcc compile lines are:

Code: Select all

c++ -c Kernel.cpp -o bin/Kernel.o -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions

Code: Select all

c++ -c Video.cpp -o bin/Video.o -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
and my linker line looks like:

Code: Select all

ld -Ttext=0x9000 -o myos stage2.o Kernel.o Video.o -e 0x0
Any help would be appreciated.

-m
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:NASM targets - odd behavior

Post by Pype.Clicker »

natively, cygwin works in COFF while linux uses ELF (with a backward compatibility to A.OUT) binary format ... this is probably where you're having problems ...
Post Reply