as, the GNU assembler, translates text-based assembly language source files into binary-based object files. Normally it operates without you being aware of it, as the compiler driver program (gcc) invokes it automatically. However, if you are creating your own assembler source files, you must invoke as directly.
If, while using gcc, you want to pass special command-line options to the assembler to control its behavior, you need to use the `-Wa,<text>' command-line option. This option passes <text> directly to the assembler's command line. For example:
gcc -c -g -O -Wa,-alh,-L file.c
passes the -alh command line option on to the assembler. (This causes the assembler to emit a listing file that shows the assembler source generated by the compiler for each line of the C source file file.c).
For more information, refer to Using as, the Gnu Assembler.
The assembler creates object files that, by convention, have the .o extension. These are binary files that contain the assembled source code, information to help the linker integrate the object file into an executable program, debugging information and tables of all of the symbols used in the source code.
Special programs exist to manipulate object files. For example, objdump can disassemble an object file back into assembler source code and ar can group together multiple object files into an archive or library file.
Assembler directives are commands inside the assembler source files that control how the object file is generated. They are also known as pseudo-ops, or pseudo-operations, because they can look like commands in the assembler programming language.
Assembler directives always start with a period (.). The rest of their name is letters, usually in lower case. They have a wide range of different uses, such as specifying alignments, inserting constants into the output, and selecting in which sections of the output file the assembled machine instructions are placed.