JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
SPARC Assembly Language Reference Manual
search filter icon
search icon

Document Information


1.  SPARC Assembler for SunOS 5.x

2.  Assembler Syntax

3.  Executable and Linking Format

4.  Converting Files to the New Format

5.  Instruction-Set Mapping

A.  Pseudo-Operations

B.  Examples of Pseudo-Operations

B.1 Example 1

B.2 Example 2

B.3 Example 3

B.4 Example 4

B.5 Example 5

C.  Using the Assembler Command Line

D.  An Example Language Program

E.  SPARC-V9 Instruction Set


B.1 Example 1

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

    .pushsection    ".data"

    .global    foo1    ! int foo1 = 1
    .align    4
    .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
    .word            0x2
    .type            foo4,#object
    .size            foo4,4