1.5.1 Assembling

To assemble this program, you only need to invoke as with the filename of the assembly source code file name. The following command should do it:

as --gstabs -o test.o test.s

In this command, the -gstabs option indicates that the object file should retain debugger information (for each line). This allows us to use the debugger later to verify the execution of each instruction later.

The -o test.o option indicates that the output file is an object file with the name test.o. Without this option, the assembler attempts to generate an executable file, which generally is not a good idea.

The last part of the command, test.s is the name of the assembly source code file.

After you assemble the program, you can use the following command to verify the existence and size of the object file:

ls -l test.o



Copyright © 2009-04-16 by Tak Auyeung