Skip Navigation Links | |
Exit Print View | |
SPARC Assembly Language Reference Manual Oracle Solaris 11 Express 11/10 |
1. SPARC Assembler for SunOS 5.x
3. Executable and Linking Format
4. Converting Files to the New Format
B. Examples of Pseudo-Operations
C. Using the Assembler Command Line
This example shows how to use the following pseudo-ops to specify the bindings of variables in C:
common, .global, .local, .weak
The following C definitions/declarations:
int foo1 = 1; #pragma weak foo2 = foo1 static int foo3; static int foo4 = 2;
can be translated into the following assembly code.
Example B-1 Using Pseudo-ops to Specify C Variable Bindings
.pushsection ".data" .global foo1 ! int foo1 = 1 .align 4 foo1: .word 0x1 .type foo1,#object ! foo1 is of type data object, .size foo1,4 ! with size = 4 bytes .weak foo2 ! #pragma weak foo2 = foo1 foo2 = foo1 .local foo3 ! static int foo3 .common foo3,4,4 .align 4 ! static int foo4 = 2 foo4: .word 0x2 .type foo4,#object .size foo4,4 .popsection