Author Topic: Assembling and Linking an Assembly Program  (Read 10521 times)

Offline Hazique35

  • Jr. Member
  • *
  • Posts: 4
Assembling and Linking an Assembly Program
« on: April 02, 2013, 11:33:32 PM »
Hello!  :)

Im using windows xp and I can use: nasm -f elf test.asm -o hello.o

I cant seem to link it however... Nothing comes up when I type the first bit in so Imm either doing it correct or completely wrong.
Anyway, I just need to get this running.

Thanks

Offline Gunner

  • Jr. Member
  • *
  • Posts: 74
  • Country: us
    • Gunners Software
Re: Assembling and Linking an Assembly Program
« Reply #1 on: April 03, 2013, 12:06:52 AM »
the elf format is for Linux.  For windows:
   nasm -f win32 test.asm
This will create a file called test.obj which you would then pass to whichever linker you are using.
Quote
valid output formats for -f are (`*' denotes default):
  * bin       flat-form binary files (e.g. DOS .COM, .SYS)
    ith       Intel hex
    srec      Motorola S-records
    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)
    elf64     ELF64 (x86_64) object files (e.g. Linux)
    elfx32    ELFX32 (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
    macho32   NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files
    macho64   NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (x86_64) object files
    dbg       Trace of all info passed to output stage
    elf       ELF (short name for ELF32)
    macho     MACHO (short name for MACHO32)
    win       WIN (short name for WIN32)