User`s guide

Recommended and Required Source Changes
3.4 Dynamic Image Relocation
3.4 Dynamic Image Relocation
On OpenVMS VAX systems, you can copy position independent code (PIC) from
one address range to another, and it assembles and runs correctly. If you compile
this code for OpenVMS Alpha or OpenVMS I64, which includes a range of code
that you copied using source code labels, it does not work for two reasons. First,
the compiled code may not be in the same order as the source code. Second,
on OpenVMS Alpha, the code requires the linkage section to make external
references. Not only is the linkage section in another psect, but it also contains
absolute addresses fixed up by the linker and image activator. On OpenVMS I64,
the code requires a portion of the global region that was built by the linker and
image activator.
Recommended Change
Replicate the code or otherwise eliminate the copy of code from one address range
to another.
3.5 Overwriting Static Data
The VAX MACRO assembler allows complete freedom in overwriting previously
initialized static storage. This is usually done by changing the current location
counter with a ‘‘.=’’ construct.
By contrast, the MACRO compiler restricts overwriting so that partial overwriting
of an existing data item is not allowed, except for .ASCII data. You can overwrite:
Any scalar item with another of the same size
Any storage left blank (declared with .BLKx or ‘‘.=.+n’’)
Sections of .ASCII data with other .ASCII or .BYTE directives
Recommended Change
Where possible, change your code to one of the following forms that is allowed:
Code that overwrites data declared by any of the scalar storage directives
(.BYTE, .WORD, or .LONG, and so forth) using a directive of the same type
or one that occupies the same number of bytes. The items must be the same
size at the same location; they cannot partially overlap. For instance:
LAB1: .WORD 1
.WORD 2
.=LAB1
.WORD 128
Partial overwriting of .ASCII data
You can overwrite portions of previously written .ASCII data using .ASCII
or .BYTE. (Since .ASCIC and .ASCIZ are implemented as a pair of .ASCII/
.BYTE directives, they can also overwrite .ASCII).
For example:
DATA: .ascii /abcdefg/
.=data
.ascii /z/ ; change "a" to "z"
.=data
.byte 0 ; change "z" to 0
.=data+4
.ascii /xyz/ ; change "efg" to "xyz"
Recommended and Required Source Changes 3–15