Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Appendix C

Using the Assembler Command Line

This appendix is organized into the following secitons:

C.1 Assembler Command Line

You invoke the assembler command line as follows:

as [options] [inputfile] ... 

Note - The language drivers (such as cc and f77) invoke the assembler command line with the fbe command. You can use either the as or fbe command to invoke the assembler command line.


The as command translates the assembly language source files, inputfile, into an executable object file, objfile. The SPARC assembler recognizes the filename argument hyphen (-) as the standard input. It accepts more than one file name on the command line. The input file is the concatenation of all the specified files. If an invalid option is given or the command line contains a syntax error, the SPARC assembler prints the error (including a synopsis of the command line syntax and options) to standard error output, and then terminates.

The SPARC assembler supports macros, #include files, and symbolic substitution through use of the C preprocessor cpp. The assembler invokes the preprocessor before assembly begins if it has been specified from the command line as an option. (See the -P option.)

C.2 Assembler Command Line Options

 

-b

This option generates extra symbol table information for the source code browser.

  • If the as command line option -P is set, the cpp preprocessor also collects browser information.

  • If the as command line option -m is set, this option is ignored as the m4 macro processor does not generate browser data.

For more information about the SPARCworks SourceBrowser, see the Browsing Source Code manual.

 

-Dname -Dname=def

When the -P option is in effect, these options are passed to the cpp preprocessor without interpretation by the as command; otherwise, they are ignored.

 

-Ipath

When the -P option is in effect, this option is passed to the cpp preprocessor without interpretation by the as command; otherwise, it is ignored.

 

-K PIC

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


Note - -K PIC and -K pic are equivalent.


 

-L

Saves all symbols, including temporary labels that are normally discarded to save space, in the ELF symbol table.

 

-m

This option runs m4 macro preprocessing on input. The m4 preprocessor is more powerful than the C preprocessor (invoked by the -P option), so it is more useful for complex preprocessing. See the m4(1) man page for more information about the m4 macro-processor.

 

-n

Suppress all warnings while assembling.

 

-o outfile

Takes the next argument as the name of the output file to be produced. By default, the .s suffix, if present, is removed from the input file and the .o suffix is appended to form the ouput file name.

 

-P

Run cpp, the C preprocessor, on the files being assembled. The preprocessor is run separately on each input file, not on their concatenation. The preprocessor output is passed to the assembler.

 

-Q{y|n}

This option produces the "assembler version" information in the comment section of the output object file if the y option is specified; if the n option is specified, the information is suppressed.

 

-q

This option causes the assembler to perform a quick assembly. Many error-checks are not performed when -q is specified.


Note - This option disables many error checks. It is recommended that you do not use this option to assemble handwritten assembly language.


 

-S[a|b|c|l|A|B|C|L]

Produces a disassembly of the emitted code to the standard output. Adding each of the following characters to the -S option produces:

  • a - disassembling with address

  • b - disassembling with ".bof"

  • c - disassembling with comments

  • l - disassembling with line numbers

Capital letters turn the switch off for the corresponding option.

 

-s

This option places all stabs in the ".stabs" section. By default, stabs are placed in "stabs.excl" sections, which are stripped out by the static linker ld during final execution. When the -s option is used, stabs remain in the final executable because ".stab" sections are not stripped out by the static linker ld.

 

-T

This is a migration option for SunOS 4.1 assembly files to be assembled on SunOS 5.x systems. With this option, the symbol names in SunOS 4.1 assembly files will be interpreted as SunOS 5.x symbol names. This option can be used in conjunction with the -S option to convert SunOS 4.1 assembly files to their corresponding SunOS 5.x versions.

 

-Uname

When the -P option is in effect, this option is passed to the cpp preprocessor without interpretation by the as command; otherwise, it is ignored.

 

-V

This option writes the version information on the standard error output.

 

-xarch=v7

This option instructs the assembler to accept instructions defined in the SPARC version 7 (V7) architecture. The resulting object code is in ELF format.

 

-xarch=v8

This option instructs the assembler to accept instructions defined in the SPARC-V8 architecture. The resulting object code is in ELF format. The quad-precision floating-point instructions are allowed; however when the program is executed these instructions cause a hardware exception called "trap" (an illegal instruction trap). The kernel has the trap handler to emulate the quad precision floating-point arithmetic. Consequently, all quad precision arithmetic is performed by the emulator in the kernel.

 

-xarch=v8a

This option instructs the assembler to accept instructions defined in the SPARC-V8 architecture, less the fsmuld instruction. The resulting object code is in ELF format. The quad-precision floating-point instructions are allowed; however when the program is executed these instructions cause a hardware exception called "trap" (an illegal instruction trap). The kernel has the trap handler to emulate the quad precision floating-point arithmetic. Consequently, all quad precision arithmetic is performed by the emulator in the kernel. This is the default choice of the -xarch= options.

 

-xarch=v8plus

This option instructs the assembler to accept instructions defined in the SPARC-V9 architecture. The resulting object code is in ELF format. The quad-precision floating-point instructions are allowed; however when the program is executed these instructions cause a hardware exception called "trap" (an illegal instruction trap). The kernel has the trap handler to emulate the quad precision floating-point arithmetic. Consequently, all quad precision arithmetic is performed by the emulator in the kernel. It will not execute on a Solaris V8 system (a machine with a V8 processor). It will execute on a Solaris V8+ system. This combination is a SPARC 64-bit processor and a 32-bit OS. For more information regarding SPARC-V9 instructions, see Appendix E, SPARC-V9 Instruction Set.

 

-xarch=v8plusa

This option instructs the assembler to accept instructions defined in the SPARC-V9 architecture, plus the instructions in the Visual Instruction Set (VIS). The resulting object code is in V8+ ELF format. It will not execute on a Solaris V8 system. It will execute on a Solaris V8+ system. For more information about VIS instructions, see the UltraSPARC Programmer's Reference Manual and the UltraSPARC User's Guide. The quad-precision floating-point instructions are allowed; however when the program is executed these instructions cause a hardware exception called "trap" (an illegal instruction trap). The kernel has the trap handler to emulate the quad precision floating-point arithmetic. Consequently, all quad precision arithmetic is performed by the emulator in the kernel.

 

-xarch=v9

This option limits instruction set to the SPARC-V9 architecture. The resulting .o object files are in 64-bit ELF format and can only be linked with other object files in the same format. The resulting executable can only be run on a 64-bit SPARC processor running 64-bit Solaris 7 with the 64-bit kernel.


Note - This option is available only on Solaris 7.


 

-xarch=v9a

This option limits instruction set to the SPARC-V9 architecture, adding the Visual Instruction Set (VIS) and extensions specific to UltraSPARC processors. The resulting .o object files are in 64-bit ELF format and can only be run on a 64-bit SPARC processor running 64-bit Solaris 7 with the 64-bit kernel.


Note - This option is available only on Solaris 7.


C.3 Disassembling Object Code

The dis program is the object code disassembler for ELF. It produces an assembly language listing of the object file. For detailed information about this function, see the man page dis(1).

 
 
 
  Previous   Contents   Next