I've just installed Mingw, but ld doesn't recognize the .o fileformat =/
The .o is assembled with nasmw, -f aout.
I can't use any PE's, so, what to do?
I don't want to use cygwin..
.o not recognized
Re:.o not recognized
Relocatable (.o or .obj) files can be in different formats, depending on the tool chain. For MinGW, these files are Win32 PE COFF. This is the only format the MinGW linker recognizes.
Try "nasm -f win32 ...". If you're using the "aout" format because you need to mix 16- and 32-bit code, you're out of luck -- you must separate the 16- and 32-bit parts.
DON'T use "nasm -f coff ...". Though relocatable files in Win32 PE COFF format and regular (DJGPP) COFF format look identical, they're not. The relocations work differently. The linker will let you link files in the two formats, but the resulting executable won't work properly.
Try "nasm -f win32 ...". If you're using the "aout" format because you need to mix 16- and 32-bit code, you're out of luck -- you must separate the 16- and 32-bit parts.
DON'T use "nasm -f coff ...". Though relocatable files in Win32 PE COFF format and regular (DJGPP) COFF format look identical, they're not. The relocations work differently. The linker will let you link files in the two formats, but the resulting executable won't work properly.
Re:.o not recognized
Oops, that should have been -f win32. If you're trying to get ld to link to something other than PE, you're out of luck. If you don't want to use PE for your kernel, you should link to PE anyway (i.e. don't override ld's output format), then use objcopy to convert to the format you want.
Re:.o not recognized
You will probably want to recompile binutils to work with other object file formats. Objcopy might not be able to work with the format that you want before recompiling.Tim Robinson wrote: If you're trying to get ld to link to something other than PE, you're out of luck. If you don't want to use PE for your kernel, you should link to PE anyway (i.e. don't override ld's output format), then use objcopy to convert to the format you want.
Re:.o not recognized
What I'd be interested in would be a different part of that posting:
Would you mind sharing your reason?petrusss wrote: I don't want to use cygwin..
Every good solution is obvious once you've found it.