3.2.3 Link-Time Optimization

The design of this calling standard assumes that the system linker will assist in implementing a transfer of control to a target location that is too far away to reach with a BSR instruction.

A typical standard call looks like:

        BSR     FOO'  
  

where FOO' is the displacement from the location of the BSR instruction to the entry point of the target procedure FOO. If the displacement is too large to be represented in the 21-bit displacement field of the BSR instruction, or if the displacement is not known at link-time, then the linker must intervene to create code such as the following:

FOO":   LDAH    R28, FOO-hi(R31)  
        LDA     R28, FOO-lo(R28)  
        JMP     (R28)  
  

The value of FOO' is then the displacement from the location of the BSR instruction to the FOO" entry in the exit transfer vector. The exit transfer vector loads the full absolute target address for procedure FOO and completes the transfer of control. Note that control does not return to the transfer vector; rather, it returns to the location following the BSR instruction.

Note   This design requires that the Windows NT for Alpha Systems operating environment manage the offsets in the LDAH/LDA instructions of the exit transfer vector whenever a dynamic-link library image is loaded and/or relocated.