X': ADDIL | L'ltoff,%r19 | ; get procedure entry point | ||
LDW | R'ltoff(%r1),%r21 |
|
| |
LDW | R'ltoff+4(%r1),%r19 | ; get new r19 | value | |
LDSID | (%r21),%r1 |
|
|
|
MTSP | %r1,%sr0 |
|
|
|
BE | 0(%sr0,%r21) | ; branch to target |
| |
STW | ; save rp |
|
;Export Stub (Shared libs and Incomplete Executables)
X': BL,N | X,%rp ; trap the return | |
NOP |
|
|
LDW | ; restore the original rp | |
LDSID | (%rp),%r1 |
|
MTSP | %r1,%sr0 |
|
BE,N | 0(%sr0,%rp) ; |
For More Information: The remainder of this section describes how compilers generate PIC for the following addressing situations:
•“PIC Requirements for Compilers and Assembly Code” (page 187)
•“Long Branches and Switch Tables” (page 188)
•“Assigned GOTO Statements ” (page 188)
•“Literal References” (page 188)
•“Global and Static Variable References” (page 189)
•“Procedure Labels” (page 189)
You can use these guidelines to write assembly language programs that generate PIC object code. For details on assembly language, see the Assembler Reference Manual and
PIC Requirements for Compilers and Assembly Code
The linkage table pointer register, %r19, must be stored at
NOTE: Any code which is PIC or which makes calls to PIC must follow the standard procedure call mechanism.
When linking files produced by the assembler, the linker exports only those assembly language routines that have been explicitly exported as entry (that is, symbols of type ST_ENTRY).
.EXPORT foo, type
where type can be code, data, entry, and others. To ensure that foo is exported from a shared library, the assembly statement must be:
.EXPORT foo,entry
Generating