Solaris 7 3/99 Online Release Notes (SUNWrdm)

64-Bit Solaris Support for the Assembler

A mechanism was included in the SPARC V9 ABI to provide global register use checking so that these global registers can be more reliably utilized.

This mechanism is described in the SPARC V9 ABI. In summary, ELF register usage records were introduced. V9 ABI compliant programs are required to utilize these records to report global register usage. During link time, either static or dynamic, the records are compared to insure consistent usage of the global registers between differing linkable objects. If inconsistent usage is detected, an error message results from the link operation.

To implement this mechanism, the compiler must output the ELF register records. This can currently be accomplished by adding the -Wc,-Qiselect-regsym=1 option for C or the -Qoption cg -Qiselect-regsym=1 option for C++ to the compiler when compiling for v9. Linkers bundled with Solaris 2.5.1, Solaris 2.6, and Solaris 7 accept the ELF register records. Linkers bundled with previous Solaris builds do not accept the new ELF register records and issue an error message.

Since the SPARC assembler may also generate linkable objects, it is necessary for the SPARC assembler to also output the ELF register records. The assembler needs to know how you intend to utilize the global registers referenced within each input .s file. To do this, you must introduce a new assembler pseudo op to provide this functionality.

Since the compiler may also output assembly language, e.g. with -S options, which may later be assembled by the assembler, it is necessary for the compiler to output the new pseudo ops so as to provide the proper documentation of the global register usage.

New SPARC V9 Pseudo Instruction:

.register %g {2 | 3 | 6 | 7}, {#scratch | symbol name}

The new pseudo is accepted by the SPARC assembler for any arch setting. It only has an effect for V9. This allows enables you to write assembly code for V8 and V9 using the new natural assembly pseudo ops. For V8 on SPARC architecture versions 2.5.1 and 2.6, the pseudo op is accepted, but ignored.

Under -xarch=v9, if the SPARC assembler detects a global register use that is not covered by a new pseudo op, then the SPARC assembler displays an error message.

Under -xarch=v9, if the SPARC assembler detects multiple differing pseudo ops related to the same global register, then the SPARC assembler issues an error message. Otherwise, the SPARC assembler lists the appropriate ELF register records as identified by the user. The SPARC assembler may verify that the specified usage description is correct, but is not required to do so.