Changes

Jump to: navigation, search

Assembler Basics

109 bytes added, 23:53, 19 January 2017
Essentials of an Assembly Language Program on a Linux System
On a Linux system, you will need to meet three requirements to get your assembly language program to work:
# Code must be placed in the <code>.text</code> section of the ELF file.# Data must be placed in either the <code>.rodata</code> (read-only data) or <code>.data</code> (read/write data) sections of the ELF file.# There must be a globally-defined symbol which the linker (<code>ld</code>) will use to find the entry point to your program. If the code is being directly compiled by the assembler, this symbol must be <code>_start</code> -- but if the code is being compiled by gcc, this symbol must be called <code>main</code>(a preamble will be located at <code>_start</code> which will then transfer control to <code>main</code>).
The file extension should be <code>.s</code> for assembler source without directives (for compilation with the assembler) or <code>.S</code> for assembler with preprocessor directives (for compilation with gcc).

Navigation menu