HP-UX Architecture Conventions

Location Counters

Location Counters

Just as spaces can be divided into subspaces, subspaces can be further divided by using location counters. You can use up to four location counters in each subspace, and the Assembler fills a separate area for each location counter. When the assembly is complete, the subspace is formed by concatenating each of these areas. All references relative to a location counter are relocated so that they are relative to the complete subspace.

Unlike subspaces, however, the use of location counters is completely local to the Assembler. Once the subspace is formed at the end of the assembly, the distinction among the individual areas built by location counters disappears. No further reordering or grouping related to location counters is performed by the linker.

This facility allows you to assemble related data into disjoint pieces of a subspace, while keeping the source code in a convenient order.

The .LOCCT directive is used to switch from one location counter to another. The Assembler automatically remembers the previous value of each location counter within each subspace. When the .SUBSPA directive is used to switch subspaces, the Assembler automatically begins using the location counter that was last in effect in the new subspace.

46

Chapter 3

Page 46
Image 46
HP UX Developer Tools manual Location Counters