Page 1 of 1
ld does not recognize nasm output format
Posted: Wed Aug 20, 2003 12:41 pm
by Freanan
I want to use a start-routine in assembler to set up idt and jump to the c-main-function.
I use
Code: Select all
nasmw -o start.o start.asm -f aout
to assemble the startup stuff (also tried -f obj instead of aout) and
Code: Select all
gcc -c -ffreestanding -o kernel.o kernel.c
to compile the main file.
Both things worked, but linking it together with
Code: Select all
ld -Ttext 0x1000 --oformat binary -o kernel.bin start.o kernel.o
does not work, instead i get a message, that the format of start.o is not recognized.
But i remember that this worked back when i had a linux system...
What do i have to do to link my kernel?
Do i have to install linux again... or is there any possibility to link it under windows?
Thanks.
Re:ld does not recognize nasm output format
Posted: Wed Aug 20, 2003 12:57 pm
by pini
I'm compiling asm code to elf with nasm, and ld never complained about that.
Re:ld does not recognize nasm output format
Posted: Fri Aug 22, 2003 4:14 pm
by K.J.
nasmw -o start.o start.asm -f aout
Try:
nasmw -o start.o -f aout start.asm
K.J.
Re:ld does not recognize nasm output format
Posted: Sat Aug 23, 2003 2:13 am
by Freanan
K.J. wrote:
nasmw -o start.o start.asm -f aout
Try:
nasmw -o start.o -f aout start.asm
K.J.
Tried it, but it did not make any diference.
Since i have a new DevC++ with new gcc and ld, i cannot even build .bins from gcc-only-kernel files!
I always get 'PE operation in non-PE file'.
So i can only code in assembler until i get linux again >:(!
Re:ld does not recognize nasm output format
Posted: Sat Aug 23, 2003 2:56 am
by Therx
I use NASM under windows with ld and it works but instead of:-
-f aout
I use:-
-f coff
Try that
Pete
Re: ld does not recognize nasm output format
Posted: Tue Feb 08, 2011 5:07 am
by nwp
I have the same problem. Here are some nasm options and the corresponding ld errors:
-f aout/rdf -> file format not recognized
-f coff/win32/win64 -> error: COFF format does not support any special symbol types
-f elf/elf32/elf64 -> cannot perform PE operations on non PE output file
-f obj -> error: OBJ supports no special symbol features for this symbol type
-f ieee -> error: unrecognised symbol type `function'
-f as86 -> error: as86 format does not support any special symbol types
Somehow I run out of nasm output formats.
The whole thing is supposed to run on Win7x64 using minGW.
Previously I used djgpp, which is a gcc port for Windows for DOS programs and therefore could read the coff format. Unfortunately it also consists of 16bit programs that do not run on 64bit Windows.
It would be nice if someone knows of a C/C++-Compiler with a Linker that can read some format that nasm can produce.
Re: ld does not recognize nasm output format
Posted: Tue Feb 08, 2011 5:12 am
by Combuster
Your exact error message is in the
FAQ. Please search before posting.
Re: ld does not recognize nasm output format
Posted: Tue Feb 08, 2011 5:18 am
by Solar
nwp wrote:The whole thing is supposed to run on Win7x64 using minGW.
Previously I used djgpp...
The Wiki on
MinGW:
Really, you're advised not to use MinGW for OSDeving, but instead to use Cygwin.
The Wiki on
DJGPP:
While DJGPP has been widely used for OS development in the past, it's close connection to MS-DOS and compatibility problems with Windows XP have caused most Windows users to shift to Cygwin or MinGW. DJGPP must be considered obsolete by now.
It would be nice if someone knows of a C/C++-Compiler with a Linker that can read some format that nasm can produce.
The Wiki knows, and it's called
Cygwin and
GCC Cross-Compiler.
A hint: Cygwin provides a very useful utility called 'file'. When your toolchain gives you problems, call 'file <filename>' to get information of what format a given file actually
is in.