User Tools

Site Tools


spo600:assembler_basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
spo600:assembler_basics [2025/01/08 21:51] – [Assembly Language on a Linux System] chrisspo600:assembler_basics [2025/02/11 11:58] (current) chris
Line 5: Line 5:
 =====  Format of an Assembly Language program  ===== =====  Format of an Assembly Language program  =====
  
-The traditional extension for assembly-language source files that will be used as input to an assembler is ''.s'' or ".asm", or ''.S'' for files that need to go through the C preprocessor (''cpp'') and compiler (''cc'').+The traditional extension for assembly-language source files that will be used as input to an assembler is ''.s'' (or __.asm__ on some platforms), or ''.S'' for files that need to go through the C preprocessor (''cpp'') and possibly the compiler (''cc'').
  
 An assembly-language program consists of: An assembly-language program consists of:
Line 93: Line 93:
   -  Run the linker: ''ld //test//.o -o //test//''   -  Run the linker: ''ld //test//.o -o //test//''
  
-Note that the ''-g'' option assembles the program with symbolic debugging information included.+Note that the ''-g'' option assembles the program with symbolic debugging information included (just as it does in most C compilers).
  
 ====  Compiling an Assembly Language Program using the NASM Assembler  ==== ====  Compiling an Assembly Language Program using the NASM Assembler  ====
Line 101: Line 101:
  
 Notes: Notes:
-   NASM only works with x86 code. +   NASM only works with x86 code. 
-   The source file must be written using NASM syntax (which is substantially different from the GNU assembler syntax). +   The source file must be written using NASM syntax (which is substantially different from the GNU assembler syntax). 
-   The ''-f elf64'' option instructs NASM to assemble the code for a 64-bit target (x86_64). +   The ''-f elf64'' option instructs NASM to assemble the code for a 64-bit target (x86_64). 
-   The ''-g'' option assembles the program with symbolic debugging information included.+   The ''-g'' option assembles the program with symbolic debugging information included.
  
 ====  Compiling an Assembly Language program using GCC  ==== ====  Compiling an Assembly Language program using GCC  ====
spo600/assembler_basics.1736373099.txt.gz · Last modified: 2025/01/08 21:51 by chris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki