PDA

View Full Version : NASM for Maemo - What Object File Format?


OSEmuTech
02-27-2008, 05:35 PM
I was excited that the latest Netwide Assembler (http://nasm.sourceforge.net/) source was able to build in Scratchbox and then when nasm assembled a source file on my N800.

But when I went to link the file using ld I realized I was probably not thinking ahead: Nasm can only assemble to the following object code, while ld is expecting some other format (armel)?

bin flat-form binary files (e.g. DOS .COM, .SYS)
aout Linux a.out object files
aoutb NetBSD/FreeBSD a.out object files
coff COFF (i386) object files (e.g. DJGPP for DOS)
elf32 ELF32 (i386) object files (e.g. Linux)
elf ELF (short name for ELF32)
elf64 ELF64 (x86_64) object files (e.g. Linux)
as86 Linux as86 (bin86 version 0.3) object files
obj MS-DOS 16-bit/32-bit OMF object files
win32 Microsoft Win32 (i386) object files
win64 Microsoft Win64 (x86-64) object files
rdf Relocatable Dynamic Object File Format v2.0
ieee IEEE-695 (LADsoft variant) object file format
macho NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X object files

OSEmuTech
02-27-2008, 07:06 PM
Hum. I looked at the help output of ld. A small flat binary file format might work, but Nasm doesn't output the other file formats.

ld: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec tekhex binary ihex
ld: supported emulations: armelf_linux_eabi

Duncan
02-28-2008, 01:14 PM
The documentation for NASM says it targets x86 processors so even if it runs on an ARM processor the code it outputs won't.

OSEmuTech
02-28-2008, 06:18 PM
That's true. I wasn't thinking things out. Thank you.

I did a -S output of a C source file using gcc last night and saw that the (g)as code generated was for ARM of course. So besides the AT&T syntax, I would need to learn ARM directives, opcodes, etc. to develop using assembly on the NIT.