Program sectioning directive
Format
.PSECT program-section-name[,argument-list]
1 – Parameters
program-section-name
The name of the program section (psect).
argument-list
A list containing the program section attributes and the program
section alignment. Program sections are aligned when you specify
an integer in the range of 0 to 16 or one of the five keywords
listed in the following table. If you specify an integer, the
program section is linked to begin at the next virtual address
that is a multiple of two raised to the power of the integer. If
you specify a keyword, the program section is linked to begin at
the next virtual address that is a multiple of the corresponding
value listed in the following table:
KeywordSize (in Bytes)
BYTE 20 = 1
WORD 21 = 2
LONG 22 = 4
QUAD 23 = 8
OCTA 24 = 16
QUAD is the default.
Table 8 Program Section Attributes
AttribuFunction
ABS Absolute-The program section has an absolute address. An
absolute program section contributes no binary code to
the image, so its byte allocation request to the linker
is 0. You cannot store initial values in an absolute
program section with directives such as .BYTE, .WORD,
.LONG, .QUAD. Usually the .BLKx directives are used in
conjunction with label definitions within an absolute
program section to define symbolic offsets within a
structure. Compare this attribute with its opposite, REL.
CON Concatenate-Program sections with the same name and
attributes (including CON) from other modules are
concatenated into one program section at link time. Their
contents are concatenated in the order in which the linker
acquires them. The allocated virtual address space is the
sum of the individual requested allocations. Compare this
attribute with its opposite, OVL.
EXE Executable-The program section contains instructions.
This attribute provides the capability of separating
instructions from read-only and read/write data. The
linker uses this attribute in gathering program sections
and in verifying that the transfer address is in an
executable program section. The assembler only allows
you to place instructions in a program section that has
either or both the EXE or MIX attributes. Compare this
attribute with its opposite, NOEXE.
GBL Global-Program sections that have the same name and
attributes will be combined at link time into a single
program section even when the individual program sections
are in different clusters. This attribute is specified
for Fortran COMMON block program sections. Compare this
attribute with its opposite, LCL.
LCL Local-The program section is restricted to its cluster.
Compare this attribute with its opposite, GBL.
MIX Mix-The program section can contain both data and
instructions. The MIX and NOMIX attributes are assembly-
time attributes that only affect assembler processing.
The MIX and NOMIX attributes do not appear in the object
module and do not affect linker processing. To mix
instructions and data in the same psect, you must specify
the MIX attribute. The NOMIX attribute is the default. If
you choose to use instructions in a NOEXE psect, or use
data directives in an EXE psect, you must specify the MIX
attribute. The following limitations apply when using the
MIX attribute:
o Optimizations and alignment of code labels are not
performed. Optimizations and code-label alignment are
not performed on instructions placed in a MIX psect,
regardless of whether the .ENABLE/.DISABLE options have
been set, or if the command-line /OPTIMIZATION and
/ALIGNMENT=CODE options have been specified.
o Limited debugging information is provided. No PC-line
(program counter) correlation information is generated
for the instructions placed in a MIX psect.
o The listing file includes only binary encoded
instructions. All instructions that are placed in a
MIX psect appear in the machine-code portion of the
listing file, in their binary encoded instruction form
as a data initializer to the .LONG data directive.
There are no restrictions on data directives. Compare this
attribute with its opposite, NOMIX.
NOEXE Not Executable-The program section contains data only; it
does not contain instructions. The assembler only allows
you to place data allocations in a program section that
has either or both the NOEXE and MIX attributes. Compare
this attribute with its opposite, EXE.
NOMIX The default attribute when you use the .PSECT directive.
Compare this attribute with its opposite, MIX.
NOPIC Non-Position-Independent Content-The program section is
assigned to a fixed location in virtual memory (when it
is in a shareable image). Compare this attribute with its
opposite, PIC.
NORD Nonreadable-Reserved for future use. Compare this
attribute with its opposite, RD.
NOSHR No Share-The program section is reserved for private use
at execution time by the initiating process. Compare this
attribute with its opposite, SHR.
NOWRT Nonwritable-The contents of the program section cannot
be altered (written into) at execution time. Compare this
attribute with its opposite, WRT.
OVR Overlay-Program sections with the same name and attributes
(including OVR) from other modules receive the same
relocatable base address in memory at link time. The
allocated virtual address space is the requested
allocation of the largest overlaying program section.
Compare this attribute with its opposite, CON.
PIC Position-Independent Content-The program section can be
relocated; that is, it can be assigned to any memory area
(when it is in a shareable image). Compare this attribute
with its opposite, NOPIC.
RD Readable-Reserved for future use. Compare this attribute
with its opposite, NORD.
REL Relocatable-The linker assigns the program section a
relocatable base address. The contents of the program
section can be code or data. Compare this attribute with
its opposite, ABS.
SHR Share-The program section can be shared at execution time
by multiple processes. This attribute is assigned to a
program section that can be linked into a shareable image.
Compare this attribute with its opposite, NOSHR.
WRT Write-The contents of the program section can be altered
(written into) at execution time. Compare this attribute
with its opposite, NOWRT.
Table 9 Default Program Section Attributes
Default
Attribute Opposite Attribute
CON OVR
EXE NOEXE
LCL GBL
NOMIX MIX
NOPIC PIC
NOSHR SHR
RD NORD
REL ABS
WRT NOWRT
2 – Description
.PSECT defines a program section and its attributes and refers to
a program section after it is defined. Use program sections to do
the following:
o Develop modular programs.
o Separate instructions from data.
o Allow different modules to access the same data.
o Protect read-only data and instructions from being modified.
o Identify sections of the object module to the linker and the
debugger.
o Control the order in which program sections are stored in
virtual memory.
When the assembler encounters a .PSECT directive that specifies
a new program section name, it creates a new program section
and stores the name, attributes, and alignment of the program
section. The assembler includes all data or instructions that
follow the .PSECT directive in that program section until it
encounters another .PSECT directive. The assembler starts all
program sections at a relative location counter of 0.
The assembler does not automatically define program sections.
Any code or data placed before the first .PSECT directive in the
source code produces an assembly error.
If the assembler encounters a .PSECT directive that specifies
the name of a previously defined program section, it stores the
new data or instructions after the last entry in the previously
defined program section, even with program sections that have
the OVR attribute. (OVR program sections from separate modules
are overlaid by the linker. The OVR attribute does not affect
how multiple contributions to a psect are processed within a
single assembly unit.) You need not relist the attributes when
continuing a program section, but any attributes that are listed
must be the same as those previously in effect for the program
section. A continuation of a program section cannot contain
attributes conflicting with those specified, or defaulted, in
the original .PSECT directive.
The attributes listed in the .PSECT directive describe the
contents of the program section. Except for the EXE and NOEXE
attributes, the assembler does not check to ensure that the
contents of the program section actually adhere to the attributes
listed. However, the assembler and the linker do check that
all program sections with the same name have exactly the same
attributes. The assembler and linker display an error message if
the program section attributes are not consistent.
Program section names are independent of local symbol, global
symbol, and macro names. You can use the same symbolic name
for a program section and for a local symbol, global symbol,
or macro name. You may want to use unique names for clarity and
maintainability.
3 – Notes
o The .ALIGN directive cannot specify an alignment greater than
that of the current program section; consequently, .PSECT
should specify the largest alignment needed in the program
section.
o For efficiency of execution and ease of programming, an
alignment of quadword or larger is recommended for all program
sections that have quadword data.
4 – Example
.PSECT A,QUAD,EXE ; Code psect