Generating x64 output
As with many traditional compilers, the native code for Jzero will be produced by carrying out the following steps. First, we will write out a linked list of x64 objects in human-readable assembler language with the .s
extension. We then invoke the GNU assembler to turn that into binary object file format with the .o
extension. An executable is constructed by invoking a linker, which combines a set of .o
files specified by the user with a set of .o
files containing runtime library code and data referenced from the generated code. This section presents each of these steps, starting with producing the assembler code.
Writing the x64 code in assembly language format
This section provides a brief description of the x64 assembler format as supported by the GNU assembler, which uses AT&T syntax. Instructions and pseudo-instructions occur on a line by themselves with a tab (or eight spaces) of indentation at the left. Labels are an exception to this rule as...