SPARC Assembly Language Reference Manual
この本のみを検索
PDF 文書ファイルをダウンロードする

SPARC Assembler for SunOS 5.x

1

Introduction

This chapter discusses the features of the SunOS 5.x(TM) SPARC(R) assembler. This document is distributed by SunSoft, Inc. as part of SunSoft's developer documentation set with every SunOS operating system release.
This document is also distributed with the on-line documentation set for the convenience of SPARCworks(TM) and SPARCompiler(TM) 3.0.1 users who have products that run on the SunOS 5.x operating system. It is included as part of the SPARCworks/SPARCompiler 3.0.1 Common Tools and Related Material AnswerBook, which is the on-line information retrieval system.

Operating Environment

The SunOS SPARC assembler runs under SunOS 5.x operating system or the Solaris(TM) 2.x operating environment. SunOS 5.x refers to SunOS 5.2 and later releases. Solaris 2.x refers to Solaris 2.2 and later releases.
The current release is SunOS 5.3.2 or Solaris 2.3.2. In the context of the SPARCworks and SPARCompiler products from SunSoft, the release refers to the current SPARCworks and SPARCompiler 3.0.1 products that run on SunOS 5.2 or Solaris 2.2 and later releases respectively.

SPARC Assembler for SunOS 4.1 Versus SunOS 5.x

This section describes the differences between the SunOS 4.1 SPARC assembler and the SunOS 5.x SPARC assembler.

New Labeling Format

  • Symbol names beginning with a dot (.) are assumed to be local symbols.
  • Names beginning with an underscore (_) are reserved by ANSI C.

New Object File Format

The type of object files created by the SPARC assembler are now ELF (Extensible and Linking Format) files. These relocatable object files hold code and data suitable for linking with other object files to create an executable file or a shared object file, and are the assembler normal output.

Pseudo-Operations

See Appendix A, "Pseudo-Operations," for a detailed description of the pseudo-operations (pseudo-ops) listed in this section.

New Pseudo-Ops

.file

  Specifies the name of the source file associated with the object file.

.local

Declares each symbol in the list to be local.
.nonvolatile
  Defines the end of a block of instructions which should not be modified at
  optimization time. This is the companion to .volatile pseudo-op.

.popsection

Makes the previous section the new current section.
.pushsection

Makes the named section the current section.
.section

Specifies information about the object file, including program and control information.
.size

  Declares the symbol size in bytes.

.type

Declares the type of symbol.
.uahalf

Generates a (sequence of) 16-bit value(s).
.uaword

Generates a (sequence of) 32-bit value(s).
.version

Identifies the minimum assembler version necessary to assemble the input file.
.volatile

Defines the beginning of a block of instructions which should not be modified at optimization time. This is the companion to .nonvolatile pseudo-op.
.weak

Declares each symbol in the list to be defined as a "weak" global symbol.

Changed Pseudo-Ops

.common

  Currently, only ".bss" (uninitialized data segments) is supported for the
  section name. (".data" is not currently supported.)

.global

Does not need to occur before a definition, or tentative definition, of the specified symbol.
.seg

The SunOS 4.1 SPARC assembler directive ".seg":
.seg "test", .seg "data" .seg "data1", .seg "bss",
would be interpreted as the following in the SunOS 5.x SPARC assembler:
.section ".text, .section ".data",
.section ".data1", .section ".bss".


Note - This pseudo-op is being maintained for compatibility with existing SunOS 4.1 SPARC assembly language programs only. The suggested usage for the SunOS 5.x SPARC assembler is .section.

New Command Line Options

See Appendix C, "Using the Assembler Command Line," for a detailed description of the new command line options listed in this section.
-K PIC

  Generates position-independent code. This option has the same
  functionality as the -k option under the SunOS 4.1 SPARC assembler.

-m

Runs m4 macro preprocessing on input.
-Q

Produces information about the object file.
-q
  Causes the assembler to perform a quick assembly by disabling
  context-dependent error checking.

-b

Generates SPARCworks SourceBrowser information.
-T

This is a migration option so that SunOS 4.1 assembly files can be assembled to run on a SunOS 5.x system.
-V

Writes the assembler version information on the standard error output.

Other References

You should also become familiar with the following:
  • Manual pages: as(1), ld(1), cpp(1, elf(3f), dis(1), a.out(1)
  • SPARC Architecture Manual
  • ELF-related sections of the Programming Utilities Guide manual
  • SPARC Applications Binary Interface (ABI)
iv>