The extended common object file format (XCOFF) is the object file format for the operating system. XCOFF combines the standard common object file format (COFF) with the TOC module format concept, which provides for dynamic linking and replacement of units within an object file. In AIX 4.3, XCOFF has been extended to provide for 64-bit object files and executable files.
XCOFF is the formal definition of machine-image object and executable files. These object files are produced by language processors (assemblers and compilers) and binders, and are used primarily by binders and the system loaders.
The default name for an XCOFF executable file is a.out.
Note: This information lists bits in big-endian order.
Read the following information to learn more about XCOFF object files:
Programs can be written to understand 32-bit XCOFF files, 64-bit XCOFF files, or both. The programs themselves may be compiled in 32-bit mode or 64-bit mode to create 32-bit or 64-bit programs. By defining preprocessor macros, applications can select the proper structure definitions from the XCOFF header files.
Note: This document uses "XCOFF32" and "XCOFF64" as shorthand for "32-bit XCOFF" and "64-bit XCOFF", respectively.
To select the XCOFF32 definitions, an application merely needs to include the appropriate header files. Only XCOFF32 structures, fields, and preprocessor defines will be included. Structure names and field names will match those in previous versions of the operating system, so existing programs can be recompiled without change.
Note: Existing uses of shorthand type notation (e.g., UINT, ULONG) have been removed.
To select the XCOFF64 definitions, an application should define the preprocessor macro __XCOFF64__. When XCOFF header files are included, the structures, fields, and preprocessor defines for XCOFF64 will be included. Where possible, the structure names and field names are identical to the XCOFF32 names, but field sizes and offsets may differ.
To select structure definitions for both XCOFF32 and XCOFF64, an application should define both the preprocessor macros __XCOFF32__ and __XCOFF64__. This will define structures for both kinds of XCOFF files. Structures and typedef names for XCOFF64 files will have the suffix "_64" added to them. (Consult the header files for details.)
An application may choose to select single structures that contain field definitions for both XCOFF32 and XCOFF64 files. For fields that have the same size and offset in both XCOFF32 and XCOFF64 definitions, the field names are retained. For fields whose size or offset differ between XCOFF32 and XCOFF64 definitions, the XCOFF32 fields have a "32" suffix, while the XCOFF64 fields have a "64" suffix. To select hybrid structure definitions, an application should define the preprocessor macro __XCOFF_HYBRID__. For example, the symbol table definition (in /usr/include/syms.h) will have the names n_offset32 and n_offset64, which should be used for the 32-bit XCOFF and 64-bit XCOFF respectively.
Assemblers and compilers produce XCOFF object files as output. The binder combines individual object files into an XCOFF executable file. The system loader reads an XCOFF executable file to create an executable memory image of a program. The symbolic debugger reads an XCOFF executable file to provide symbolic access to functions and variables of an executable memory image.
An XCOFF file contains the following parts:
Not every XCOFF file contains every part. A minimal XCOFF file contains only the file header.
XCOFF object files and executable files are similar in structure. An XCOFF executable file (or "module") must contain an auxiliary header, a loader section header, and a loader section.
The loader raw-data section contains information needed to dynamically load a module into memory for execution. Loading an XCOFF executable file into memory creates the following logical segments:
The XCOFF file Organization illustrates the structure of the XCOFF object file.
The xcoff.h file
defines the structure of the XCOFF file. The xcoff.h
file includes the following files:
The a.out.h file includes the xcoff.h file. All of the XCOFF include files include the xcoff32_64.h file.
For more information on sections of the XCOFF object file, see "Sections and Section Headers." For more information on the symbol table, see "Symbol Table Information." For more information on the string table, see "String Table." For more information on the Debug section, see "Debug Section."
The following sections describe the XCOFF composite file header components:
The filehdr.h
file defines the file header of an XCOFF file. The file header is 20
bytes long in XCOFF32 and 24 bytes long in XCOFF64. The structure
contains the fields shown in the following table.
File Header Structure (Defined in filehdr.h) | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 2 | 0 | 2 | f_magic | Target machine |
2 | 2 | 2 | 2 | f_nscns | Number of sections |
4 | 4 | 4 | 4 | f_timdat | Time and date of file creation |
8 | 4 | 8 | 8 | f_symptr+ | Byte offset to symbol table start |
12 | 4 | 20 | 4 | f_nsyms+ | Number of entries in symbol table |
16 | 2 | 16 | 2 | f_opthdr | Number of bytes in optional header |
18 | 2 | 18 | 2 | f_flags | Flags (see "Field Definitions") |
+ Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The auxiliary header contains system-dependent and implementation-dependent information, which is used for loading and executing a module. Information in the auxiliary header minimizes how much of the file must be processed by the system loader at execution time.
The binder generates an auxiliary header for use by the system loader. Auxiliary headers are not required for an object file that is not to be loaded. When auxiliary headers are generated by compilers and assemblers, the headers are ignored by the binder.
The auxiliary header immediately follows the file header.
Note: If the value of the f_opthdr field is 0, the auxiliary header does not exist.
The C language structure for the
auxiliary header is defined in the aouthdr.h file.
The auxiliary header contains the fields shown in the following table.
Auxiliary Header Structure (Defined in aouthdr.h) | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 2 | 0 | 2 | o_mflag | Flags, how to execute |
2 | 2 | 2 | 2 | o_vstamp | Version |
4 | 4 | 56 | 8 | o_tsize+ | Text size in bytes |
8 | 4 | 64 | 8 | o_dsize+ | Initialized data size in bytes |
12 | 4 | 72 | 8 | o_bsize+ | Uninitialized data size in bytes |
16 | 4 | 80 | 8 | o_entry+ | Entry point descriptor (virtual address) |
20 | 4 | 8 | 8 | o_text_start+ | Base address of text (virtual address) |
24 | 4 | 16 | 8 | o_data_start+ | Base address of data (virtual address) |
28 | 4 | 24 | 8 | o_toc+ | Address of TOC anchor |
32 | 2 | 32 | 2 | o_snentry | Section number for entry point |
34 | 2 | 34 | 2 | o_sntext | Section number for .text |
36 | 2 | 36 | 2 | o_sndata | Section number for .data |
38 | 2 | 38 | 2 | o_sntoc | Section number for TOC |
40 | 2 | 40 | 2 | o_snloader | Section number for loader data |
42 | 2 | 42 | 2 | o_snbss | Section number for .bss |
44 | 2 | 44 | 2 | o_algntext | Maximum alignment for .text |
46 | 2 | 46 | 2 | o_algndata | Maximum alignment for .data |
48 | 2 | 48 | 2 | o_modtype | Module type field |
50 | 1 | 50 | 1 | o_cpuflag | Bit flags - cpu types of objects |
51 | 1 | 51 | 1 | o_cputype | Reserved for CPU type |
52 | 4 | 88 | 8 | o_maxstack+ | Maximum stack size allowed (bytes) |
56 | 4 | 96 | 8 | o_maxdata+ | Maximum data size allowed (bytes) |
60 | 4 | 4 | 4 | o_debugger+ | Reserved for debuggers. |
64 | 8 | 52 | 4 | o_resv2 | Reserved Field must contain 0s. |
N/A | 104 | 116 | o_resv3 | Reserved. Field must contain 0s. | |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The following information defines
the auxiliary header fields. For entries with two labels, the label in
parentheses is the alternate original COFF a.out file format
name.
The following definitions are
extensions used by the system loader. In general, an object file may
contain multiple sections of a given type, but in a module, only a single
occurrence of the .text, .data,
.bss, and .loader sections may
exist.
Each section of an XCOFF file has
a corresponding section header, although some section headers may not have a
corresponding raw-data section. A section header provides
identification and file-accessing information for each section contained
within an XCOFF file. Each section header in an XCOFF32 file is 40
bytes long, while XCOFF64 section headers are 72 bytes long. The C
language structure for a section header can be found in the
scnhdr.h file. A section header contains the fields
shown in the following table.
Section Header Structure (Defined in scnhdr.h) | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 8 | 0 | 8 | s_name | Section name |
8 | 4 | 8 | 8 | s_paddr+ | Physical address |
12 | 4 | 16 | 8 | s_vaddr+ | Virtual address (same as physical address) |
16 | 4 | 24 | 8 | s_size+ | Section size |
20 | 4 | 32 | 8 | s_scnptr+ | Offset in file to raw data for section |
24 | 4 | 40 | 8 | s_relptr+ | Offset in file to relocation entries for section |
28 | 4 | 48 | 8 | s_lnnoptr+ | Offset in file to line number entries for section |
32 | 2 | 56 | 4 | s_nreloc+ | Number of relocation entries |
34 | 2 | 60 | 4 | s_nlnno+ | Number of line number entries |
36 | 2 | 64 | 4 | s_flags+ | Flags to define the section type |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The following information defines the section header fields:
Specifies a pad section. A section of this type is used to provide alignment padding between sections within an XCOFF executable object file. This section header type is obsolete since padding is allowed in an XCOFF file without a corresponding pad section header.
Specifies an executable text (code) section. A section of this type contains the executable instructions of a program.
Specifies an initialized data section. A section of this type contains the initialized data and the TOC of a program.
Specifies an uninitialized data section. A section header of this type defines the uninitialized data of a program.
Specifies an exception section. A section of this type provides information to identify the reason that a trap or exception occurred within an executable object program.
Specifies a comment section. A section of this type provides comments or data to special processing utility programs.
Specifies a loader section. A section of this type contains object file information for the system loader to load an XCOFF executable. The information includes imported symbols, exported symbols, relocation data, type-check information, and shared object names.
Specifies a debug section. A section of this type contains stabstring information used by the symbolic debugger.
Specifies a type-check section. A section of this type contains parameter/argument type-check strings used by the binder.
Note: An XCOFF64 file may not contain an overflow section header.
Specifies a relocation or line-number field overflow section. A section header of this type contains the count of relocation entries and line number entries for some other section. This section header is required when either of the counts exceeds 65,534. See the s_nreloc and s_nlnno fields in "Sections and Section Headers" for more information on overflow headers.
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
Section headers are defined to provide a variety of information about the contents of an XCOFF file. Programs that process XCOFF files will recognize only some of the valid sections.
See the following information to learn more about XCOFF file sections:
Current applications do not use
the s_name field to determine the section type.
Nevertheless, conventional names are used by system tools, as shown in the
following table.
Conventional Header Names | |||
Description | Conventional Name | Multiple Allowed? | s_flag |
Text section | .text | Yes | STYP_TEXT |
Data section | .data | Yes | STYP_DATA |
BSS section | .bss | Yes | STYP_BSS |
Pad section | .pad | Yes | STYP_PAD |
Loader section | .loader | No | STYP_LOADER |
Debug section | .debug | No | STYP_DEBUG |
Type-check section | .typchk | Yes | STYP_TYPCHK |
Exception section | .except | No | STYP_EXCEPT |
Overflow section | .ovrflo | Yes (one per .text or .data section) | STYP_OVRFLO |
Comment section | .info | Yes | STYP_INFO |
Some fields of a section header
may not always be used, or may have special usage. This pertains to the
following fields:
An XCOFF file provides special meaning to the following sections:
For more information on XCOFF file sections, see "Loader Section (loader.h)," "Debug Section," "Type-Check Section," "Exception Section," and "Comment Section."
The loader section contains information required by the system loader to load and relocate an executable XCOFF object. The loader section is generated by the binder. The loader section has an s_flags section type flag of STYP_LOADER in the XCOFF section header. By convention, .loader is the loader section name. The data in this section is not referenced by entries in the XCOFF symbol table.
The loader section consists of the following parts:
The C language structure for the loader section can be found in the loader.h file.
The following table describes the
loader section's header field definitions.
Loader Section Header Structure (Defined in loader.h) | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 4 | l_version | Loader section version number |
4 | 4 | 4 | 4 | l_nsyms | Number of symbol table entries |
8 | 4 | 8 | 4 | l_nreloc | Number of relocation table entries |
12 | 4 | 12 | 4 | l_istlen | Length of import file ID string table |
16 | 4 | 16 | 4 | l_nimpid | Number of import file IDs |
20 | 4 | 24 | 8 | l_impoff+ | Offset to start of import file IDs |
24 | 4 | 20 | 4 | l_stlen+ | Length of string table |
28 | 4 | 32 | 8 | l_stoff+ | Offset to start of string table |
N/A | 40 | 8 | l_symoff | Offset to start of symbol table | |
N/A | 48 | 8 | l_rldoff | Offset to start of relocation entries | |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The following information defines
the loader section's header fields:
The loader section symbol table contains the symbol table entries that the system loader needs for its import and export symbol processing and dynamic relocation processing.
The loader.h file defines the symbol table fields. Each entry is 24 bytes long.
There are three implicit external
symbols, one each for the .text, .data,
and .bss sections. These symbols are referenced using
symbol table index values 0, 1, and 2, respectively. The first symbol
contained in the loader section symbol table is referenced using an index
value of 3.
Loader Section Symbol Table Entry Structure | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 8 | N/A | l_name+ | Symbol name or byte offset into string table | |
0 | 4 | N/A | l_zeroes+ | Zero indicates symbol name is referenced from l_offset | |
4 | 4 | 8 | 4 | l_offset+ | Byte offset into string table of symbol name |
8 | 4 | 0 | 8 | l_value+ | Address field |
12 | 2 | 12 | 2 | l_scnum | Section number containing symbol |
14 | 1 | 14 | 1 | l_smtype | Symbol type, export, import flags |
15 | 1 | 15 | 1 | l_smclas | Symbol storage class |
16 | 4 | 16 | 4 | l_ifile | Import file ID; ordinal of import file IDs |
20 | 4 | 20 | 4 | l_parm | Parameter type-check field |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
l_name | (XCOFF32 only) Specifies an 8-byte, null-padded symbol name if it is 8
bytes or less in length. Otherwise, the field is treated as the
following two 4-byte integers for accessing the symbol name:
|
l_offset | (XCOFF64 only) This field has the same use as the l_offset field in XCOFF32. |
l_value | Specifies the virtual address of the symbol |
l_scnum | Specifies the number of the XCOFF section that contains the symbol. If the symbol is undefined or imported, the section number is 0. Otherwise, the section number refers to the .text, .data, or .bss section. Section headers are numbered beginning with 1. |
l_smtype | Specifies the symbol type, import flag, export flag, and entry
flag.
Bits 0-4 are flag bits defined as follows:
Bit 0 0x80 Reserved. Bit 1 0x40 Specifies an imported symbol. Bit 2 0x20 Specifies an entry point descriptor symbol. Bit 3 0x10 Specifies an exported symbol. Bit 4 0x08 Reserved. Bits 5-7 0x07 Symbol type--see below. Bits 5-7 constitute a 3-bit symbol type field with the following definitions:
|
l_smclas | Specifies the storage mapping class of the symbol, as defined in syms.h for the x_smclas field of the csect auxiliary symbol table entry. Values have the symbolic form XMC_xx, where xx is PR, RO, GL, XO, SV, SV64, SV3264, RW, TC, TD, DS, UA, BS, or UC. See "csect Auxiliary Entry for the C_EXT and C_HIDEXT Symbols" for more information. |
l_ifile | Specifies the import file ID string. This integer is the ordinal value of the position of the import file ID string in the import file ID name string table of the loader section. For an imported symbol, the value of 0 in this field identifies the symbol as a deferred import to the system loader. A deferred import is a symbol whose address can remain unresolved following the processing of the loader. If the symbol was not imported, this field must have a value of 0. |
l_parm | Specifies the offset to the parameter type-check string. The byte offset is from the beginning of the loader section string table. The byte offset points to the first byte of the parameter type-check string (not to its length field). For more information on the parameter type-check string, see "Type-Check Section" . A value of 0 in the l_parm field indicates that the parameter type-checking string is not present for this symbol, and the symbol will be treated as having a universal hash. |
The Loader Section Relocation
Table Structure contains all the relocation information that the system loader
needs to properly relocate an executable XCOFF file when it is loaded.
The loader.h file defines the relocation table
fields. Each entry in the loader section relocation table is 12 bytes
long in XCOFF32 and 16 bytes long in XCOFF64. The l_vaddr,
l_symndx, and l_rtype fields have the same meaning as
the corresponding fields of the regular relocation entries, which are defined
in the reloc.h file. See "Relocation Information for XCOFF File
(reloc.h)" for more information.
Loader Section Relocation Table Entry Structure | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 8 | l_vaddr+ | Address field |
4 | 4 | 12 | 4 | l_symndx+ | Loader section symbol table index of referenced item |
8 | 2 | 8 | 2 | l_rtype | Relocation type |
10 | 2 | 10 | 2 | l_rsecnm | File section number being relocated |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The loader.h
file defines the following fields:
Name | Description |
---|---|
l_vaddr | Specifies the virtual address of the relocatable reference. |
l_symndx | Specifies the loader section symbol table index (n-th entry)
of the symbol that is being referenced. Values 0, 1, and 2 are implicit
references to the .text, .data, and
.bss sections, respectively. Symbol index 3 is the
index for the first symbol actually contained in the loader section symbol
table.
Note: A reference to an exported symbol can be made using the symbol's section number (symbol number 0, 1, or 2) or using the actual number of the exported symbol. |
l_rtype | Specifies the relocation size and type. (This field has the same interpretation as the r_type field in the reloc.h file.) See "Relocation Information for XCOFF File (reloc.h)" for more information. |
l_rsecnm | Specifies the section number of the .text, .data, or .bss section being relocated (associated with l_vaddr field). This is a one-based index into the section headers. |
The loader section import file ID
name strings of a module provide a list of dependent modules that the system
loader must load in order for the module to load successfully. However,
this list does not contain the names of modules that the named modules
themselves depend on.
Loader Section Import File IDs - Contains Variable Length Strings | |||
Offset | Length in Bytes | Name | Description |
0 | n1 | l_impidpath | Import file ID path string, null-delimited |
n1 + 1 | n2 | l_impidbase | Import file ID base string, null-delimited |
n1 + n2 + 2 | n3 | l_impidmem | Import file ID member string, null-delimited |
|
|
| Fields repeat for each import file ID. |
Each import file ID name consists of three null-delimited strings.
The first import file ID is a default LIBPATH value to be used by the system loader. The LIBPATH information consists of file paths separated by colons. There is no base name or archive member name, so the file path is followed by three null bytes.
Each entry in the import file ID name table consists of:
/usr/lib\0mylib.a\0shr.o\0
The loader section string table
contains the parameter type-checking strings, all symbols names for an XCOFF64
file, and the names of symbols longer than 8 bytes for an XCOFF32 file.
Each string consists of a 2-byte length field followed by the string.
Loader Section String Table | ||
Offset | Length in Bytes | Description |
0 | 2 | Length of string. |
2 | n | Symbol name string (null-delimited) or parameter type string (not null-delimited). |
|
| Fields repeat for each string. |
Symbol names are null-terminated. The value in the length-field includes the length of the string plus the length of the null terminator but does not include the length of the length field itself.
The parameter type-checking strings contain binary values and are not null-terminated. The value in the length field includes the length of the string only but does not include the length of the length field itself.
The symbol table entries of the loader section contain a byte offset value that points to the first byte of the string instead of to the length field.
The contents of the section header
fields for the loader section are:
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on XCOFF file sections, see "Sections and Section Headers," "Debug Section," "Type-Check Section," "Exception Section," and "Comment Section."
The debug section contains the symbolic debugger stabstrings (symbol table strings). It is generated by the compilers and assemblers. It provides symbol attribute information for use by the symbolic debugger. The debug section has a section type flag of STYP_DEBUG in the XCOFF section header. By convention, .debug is the debug section name. The data in this section is referenced from entries in the XCOFF symbol table. A stabstring is a null-terminated character string. Each string is preceded by a 2-byte length field in XCOFF32 or a 4-byte length field in XCOFF64.
The following two fields are repeated for each symbolic debugger stabstring:
Refer to discussion of symbolic debugger stabstring grammar for the specific format of the stabstrings.
The contents of the section header
fields for the debug section are:
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on XCOFF file sections, see "Sections and Section Headers," "Debug Section," "Type-Check Section,", "Exception Section," and "Comment Section."
The type-check section contains the type-checking hash strings and is produced by compilers and assemblers. It is used by the binder to detect variable mismatches and argument interface errors when linking separately compiled object files. (The type-checking hash strings in the loader section are used to detect these errors prior to running a program.) The type-check section has a section type flag of STYP_TYPCHK in the XCOFF section header. By convention, .typchk is the type-check section name. The strings in this section are referenced from entries in the XCOFF symbol table.
The following two fields are repeated for each parameter type-checking string:
The type-checking hash strings are used to detect errors prior to execution of a program. Information about all external symbols (data and functions) is encoded by the compilers and then checked for consistency at bind time and load time. The type-checking strings are designed to enforce the maximum checking required by the semantics of each particular language supported, as well as provide protection to applications written in more than one language.
The type encoding and checking mechanism features 4-part hash encoding that provides some flexibility in checking. The mechanism also uses a unique value, UNIVERSAL, that matches any code. The UNIVERSAL hash can be used as an escape mechanism for assembly programs or for programs in which type information or subroutine interfaces might not be known. The UNIVERSAL hash is four blank ASCII characters (0x20202020) or four null characters (0x00000000).
The following fields are
associated with the type encoding and checking mechanism:
code length | A 2-byte field containing the length of the hash. This field has a value of 10. |
language identifier | A 2-byte code representing each language. These codes are the same as those defined for the e_lang field in the "Exception Section" information . |
general hash | A 4-byte field representing the most general form by which a data symbol or function can be described. This form is the most common to languages supported by . If the information is incomplete or unavailable, a universal hash should be generated. The general hash is language-independent and must match for the binding to succeed. |
language hash | A 4-byte field containing a more detailed, language-specific representation of what is in the general hash. It allows for the strictest type-checking required by a given language. This part is used in intra-language binding and is not checked unless both symbols have the same language identifier. |
The contents of the section header
fields for the type-check section are:
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on XCOFF file sections, see "Sections and Section Headers," "Debug Section," "Type-Check Section," "Exception Section," and "Comment Section."
The exception section contains addresses of trap instructions, source language identification codes, and trap reason codes. This section is produced by compilers and assemblers, and used during or after run time to identify the reason that a specific trap or exception occurred. The exception section has a section type flag of STYP_EXCEPT in the XCOFF section header. By convention, .except is the exception section name. Data in the exception section is referenced from entries in the XCOFF symbol table.
An exception table entry with a value of 0 in the e_reason field contains the symbol table index to a function's C_EXT or C_HIDEXT symbol table entry. Reference from the symbol table to an entry in the exception table is via the function auxiliary symbol table entry. For more information on this entry, see "csect Auxiliary Entry for C_EXT andC_HIDEXT Symbols" .
The C language structure for the exception section entries can be found in the exceptab.h file.
The exception section entries
contain the fields shown in the following tables.
Initial Entry: Exception Section Structure | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 4 | e_addr.e_symndx+ | Symbol table index for function |
4 | 1 | 8 | 1 | e_lang+ | Compiler language ID code |
5 | 1 | 9 | 1 | e_reason+ | Value 0 (exception reason code 0) |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. With e_addr.e_symndx, the suffix is added to e_addr (i.e. e_addr32.e_symndx). |
Subsequent Entry: Exception Section Structure | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 8 | e_addr.e_paddr+ | Address of the trap instruction |
4 | 1 | 8 | 1 | e_lang+ | Compiler language ID code |
5 | 1 | 9 | 1 | e_reason+ | Trap exception reason code |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. With e_addr.e_paddr, the suffix is added to e_addr (i.e. e_addr32.e_paddr). |
The following defines the fields
listed of the exception section:
The following fields are the
contents of the section header fields for the exception section.
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on XCOFF file sections, see "Sections and Section Headers," "Debug Section," "Type-Check Section," "Exception Section," and "Comment Section."
The comment section contains information of special processing significance to an application. This section can be produced by compilers and assemblers and used during or after run time to fulfill a special processing need of an application. The comment section has a section type flag of STYP_INFO in the XCOFF section header. By convention, .info is the comment section name. Data in the comment section is referenced from C_INFO entries in the XCOFF symbol table.
The contents of a comment section consists of repeated instances of a 4-byte length field followed by a string of bytes (containing any binary value). The length of each string is stored in its preceding 4-byte length field. The string of bytes need not be terminated by a null character nor by any other special character. The specified length does not include the length of the length field itself. A length of 0 is allowed. The format of the string of bytes is not specified.
A comment section string is referenced from an entry in the XCOFF symbol table. The storage class of the symbol making a reference is C_INFO. See "Symbol Table Field Contents by Storage Class" for more information.
A C_INFO symbol is associated with the nearest C_FILE, C_EXT, or C_HIDEXT symbol preceding it.
The following fields are the
contents of the section header fields for the comment section.
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on XCOFF file sections, see "Sections and Section Headers," "Debug Section," "Type-Check Section," "Exception Section," and "Comment Section."
The .text section and .data section may have relocation information. The relocation information is used by the binder to modify the .text section and .data section contents with address and byte-offset information of individual XCOFF object files collected into an XCOFF executable file.
The compilers and assemblers are responsible for generating the relocation entries for the .text and .data sections.
The binder generates relocation information for the .loader section, as required by the system loader.
Each relocation entry of the
.text and .data section is 10 bytes long
(14 for XCOFF64). (A relocation entry in the .loader
section is 12 bytes long (16 for XCOFF64) and is explained in the loader
section description in this document. See "Relocation Table Field Definitions" for more
information.) The C language structure for a relocation entry can be
found in the reloc.h file. A relocation entry
contains the fields shown in the following table.
Relocation Entry Structure | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 8 | r_vaddr+ | Virtual address (position) in section to be relocated |
4 | 4 | 8 | 4 | r_symndx+ | Symbol table index of item that is referenced |
8 | 1 | 12 | 1 | r_rsize+ | Relocation size and information |
9 | 1 | 13 | 1 | r_rtype+ | Relocation type |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The relocation entries for the .text and .data sections are part of their respective sections. The relocation entry refers to a location to be modified. The relocation entries for a section must be in ascending address order.
(The loader section contains a single set of relocation entries used by the system loader, so a section number is required within each relocation entry to identify the section that needs to be modified.)
The following defines the relocation-information fields:
Specifies positive relocation. Provides the address of the symbol specified by the r_symndx field.
Specifies negative relocation. Provides the negative of the address of the symbol specified by the r_symndx field.
Specifies relative-to-self relocation. Provides a displacement value between the address of the symbol specified by the r_symndx field and the address of the csect to be modified.
Specifies relative-to-TOC relocation. Provides a displacement value that is the difference between the address value in the symbol specified by the r_symndx field and the address of the TOC anchor csect. The TOC anchor csect has a symbol table csect auxiliary entry with an x_smclass (storage mapping class) value of XMC_TC0. The TOC anchor csect must be of zero length. There may be only one TOC anchor csect per XCOFF section.
Specifies TOC Relative Indirect Load (modifiable) relocation. Provides a displacement value that is the difference between the address value in the symbol specified by the r_symndx field and the address of the TOC anchor csect. This relocation entry is treated the same as an R_TOC relocation entry. It provides the following additional information concerning the instruction being relocated: The instruction that is referenced by the r_vaddr field is a load instruction. That load instruction is permitted to be modified by the binder to become a compute address instruction. Changing an instruction from a load instruction to a compute address instruction avoids a storage reference during execution. A compute address instruction can be used if the address contained at the address specified by the r_symndx field has a value that itself references a r_symndx field that can be accessed with a valid in-range displacement relative to the TOC anchor address. That is, the target of the TOC entry is from -32,768 to 32,767, inclusive, from the TOC anchor address. If a compute address instruction is generated by the binder, the R_TRL relocation type is changed to become a R_TRLA type. This allows the reverse transformation, if required. Compilers are permitted to generate this relocation type.
Specifies TOC Relative Load Address (modifiable LA to L) relocation. Provides a displacement value that is the difference between the address value in the symbol specified by the r_symndx field and the address of the TOC anchor csect. This relocation entry is treated the same as an R_TOC relocation entry. It provides the following additional information concerning the instruction being relocated: The instruction that is referenced by the r_vaddr field is a compute address instruction. The compute address instruction is modified by the binder to become a load instruction whenever the calculated displacement value is outside the valid displacement range relative to the TOC anchor address. This relocation type provides the binder with a means to transform a compute address instruction into a load instruction whenever required. If a load instruction is generated by the binder, the R_TRLA relocation type is changed to become an R_TRL type. Compilers are not permitted to generate this relocation type.
Specifies Global Linkage-External TOC address relocation. Provides the address of the TOC associated with a defined external symbol. The external symbol with the required TOC address is specified by the r_symndx field of the relocation entry. This relocation entry provides a method of accessing the address of the TOC contained within the same executable where the r_symndx external symbol is defined.
Specifies local object TOC address relocation. Provides the address of the TOC associated with a defined external symbol. The external symbol for which the TOC address is required is specified by the r_symndx field of the relocation entry. The external symbol is defined locally within the resultant executable. This relocation entry provides a method of accessing the address of the TOC contained within the same executable where the r_symndx external symbol is defined.
Specifies a nonrelocating reference to prevent garbage collection (by the binder) of a symbol. This relocation type is intended to provide compilers and assemblers a method to specify that a given csect has a dependency upon another csect without using any space in the actual csect. The reason for making the dependency reference is to prevent the binder from garbage-collecting (eliminating) a csect for which another csect has an implicit dependency.
Specifies branch absolute relocation. Provides the address of the symbol specified by the r_symndx field as the target address of a branch instruction. The instruction can be modified to a (relative) branch instruction if the target address is relocatable.
Specifies (relative) branch relocation. Provides a displacement value between the address of the symbol specified by the r_symndx field and the address of the csect containing the branch instruction to be modified. The instruction can be modified to an absolute branch instruction if the target address is not relocatable.
The R_RBR relocation type is the standard branch relocation type used by compilers and assemblers for the . This relocation type along with glink code allows an executable object file to have a text section that is position-independent.
Standard practice is to retain relocation information only for unresolved references or references between distinct sections. Once a reference is resolved, the relocation information is discarded. This is sufficient for an incremental bind and a fixed address space model. To provide the capability for rebinding and handling a relocatable address space model, the relocation information is not discarded from an XCOFF file.
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For more information on relocation field table definitions, see "Relocation Table Field Definitions" in the loader section.
Line number entries are used by the symbolic debugger to debug code at the source level. When present, there is a single line number entry for every source line that can have a symbolic debugger breakpoint. The line numbers are grouped by function. The beginning of each function is identified by the l_lnno field containing a value of 0. The first field, l_symndx , is the symbol table index to the C_EXT or C_HIDEXT symbol table entry for the function.
Each line number entry is six
bytes long. The C language structure for a line number entry can be
found in the linenum.h file. A line number entry
contains the fields shown in the following tables.
Initial Line Number Structure Entry for Function | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 4 | l_ addr.l_ symndx+ | Symbol table index for function |
4 | 2 | 8 | 4 | l_ lnno+ | Value 0 (line number 0) |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. With l_addr.l_symndx, the suffix is added to l_addr (i.e. l_addr32.l_symndx). |
Subsequent Line Number Entries for Function | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | 0 | 8 | l_paddr+ | Address at which break point can be inserted |
4 | 2 | 8 | 4 | l_lnno+ | Line number relative to start of function |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. With l_addr.l_paddr, the suffix is added to l_addr (i.e. l_addr32.l_paddr). |
The following list defines the
line number entries:
Note: If part of a function other than the beginning comes from an include file, the line numbers are absolute, rather than relative to the beginning of the function. (See the C_BINCL and C_EINCL symbol types in "Storage Classes by Usage and Symbol Value Classification" for more information.)
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
For information on debugging, see "Debug Section."
One composite symbol table is defined for an XCOFF file. The symbol table contains information required by both the binder (external symbols) and the symbolic debugger (function definitions and internal and external symbols).
The symbol table consists of a list of 18-byte, fixed-length entries. Each symbol represented in the symbol table consists of at least one fixed-length entry, and some are followed by auxiliary entries of the same size.
See the following information to learn more about the symbol table:
For each external symbol, one or more auxiliary entries are required that provide additional information concerning the external symbol. There are three major types of external symbols of interest to the binder, performing the following functions:
For symbols defining a replaceable unit (csect), a csect auxiliary entry defines the length and storage-mapping class of the csect. For symbols defining external names for functions within a csect, the csect auxiliary entry points to the containing csect, the parameter type-checking information, and the symbolic debugger information for the function. For symbols referencing the name of an external function, a csect auxiliary entry identifies the symbol as an external reference and points to parameter type-checking information.
An XCOFF symbol table has the following general contents and ordering:
The ordering of the symbol table must be arranged by the compilers and assemblers both to accommodate the symbolic debugger requirements and to permit effective management by the binder of the different sections of the object file as a result of such binder actions as garbage collection, incremental binding, and rebinding. This ordering is required by the binder so that if a csect is deleted or replaced, all the symbol table information associated with the csect can also be deleted or replaced. Likewise, if all the csects associated with a source file are deleted or replaced, all the symbol table and related information associated with the file can also be deleted or replaced.
The following example shows the general ordering of the symbol table.
un_external Undefined global symbols .file Prolog --defines stabstring compaction level .file Source file 1 .info Comment section reference symbol with file scope stab Global Debug symbols of a file csect Replaceable unit definition (code) .info Comment section reference symbol with csect scope function Local/External function stab Debug and local symbols of function function Local/External function stab Debug and local symbols of function .............. csect Replaceable unit definition (local statics) stab Debug and local statics of file .............. csect Relocatable unit definition (global data) external Defined global symbol stab Debug info for global symbol .............. .file Source file 2 stab Global Debug symbols of a file csect Replaceable unit definition (code) function Local/External function stab Debug and local symbols of function .............. csect Replaceable unit definition (local statics) stab Debug and Local statics of file .............. csect Replaceable unit definition (global data) external Defined global symbol stab Debug info for global symbol .file Source file ..............
Each symbol, regardless of storage
class and type, has a fixed-format entry in the symbol table. In
addition, some symbol types may have additional (auxiliary) symbol table
entries immediately following the fixed-format entry. Each entry in the
symbol table is 18 bytes long. The C language structure for a symbol
table entry can be found in the syms.h file. The
index for the first entry in the symbol table is 0. The following table
shows the structure of the fixed-format part of each symbol in the symbol
table.
Symbol Table Entry Format | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 8 | N/A | n_name | Symbol name (occupies the same 8 bytes as n_zeroes and n_offset) | |
0 | 4 | N/A | n_zeroes | Zero, indicating name in string table or .debug section (overlays first 4 bytes of n_name) | |
4 | 4 | 8 | 4 | n_offset+ | Offset of the name in string table or .debug section (In XCOFF32: overlays last 4 bytes of n_name) |
8 | 4 | 0 | 8 | n_value+ | Symbol value; storage class-dependent |
12 | 2 | 12 | 2 | n_scnum | Section number of symbol |
14 | 2 | 14 | 2 | n_type | Basic and derived type specification |
14 | 1 | 14 | 1 | n_lang | Source language ID (overlays first byte of n_type) |
15 | 1 | 15 | 1 | n_cpu | CPU Type ID (overlays second byte of n_type) |
16 | 1 | 16 | 1 | n_sclass | Storage class of symbol |
17 | 1 | 17 | 1 | n_numaux | Number of auxiliary entries |
+Use "32" or "64" suffix when __XCOFF_HYBRID__ is defined. |
The following defines the symbol
table entry fields:
n_name | Used by XCOFF32 only. Specifies an 8-byte, null-padded symbol name
or symbolic debugger stabstring. The storage class field is used to
determine if the field is a symbol name or symbolic debugger
stabstring. By convention, a storage class value with the high-order
bit on indicates that this field is a symbolic debugger stabstring.
If the XCOFF32 symbol name is longer than 8 bytes, the field is interpreted as the following two fields:
|
n_offset | For XCOFF64: Specifies the byte offset to the symbol name in the string table or .debug section. The byte offset is relative to the start of the string table or .debug section. A byte offset value of 0 is a null or zero-length symbol name. (For XCOFF32 only, used in conjunction with n_zeroes. See entry immediately above.) |
n_value | Specifies the symbol value. The contents of the symbol value field
is storage class-dependent, as shown in the following definitions:
|
n_scnum | Specifies a section number associated with one of the following symbols: |
n_type | Used in COFF for type information. This use is obsolete in XCOFF. For C_EXT and C_HIDEXT symbols, this field should contain 0x0020 for function symbols and 0 otherwise. This field has a special purpose for C_FILE symbols. See "File Auxiliary Entry for the C_FILE Symbol" for more information. |
n_sclass | Specifies the storage class of the symbol. The storclass.h and dbxstclass.h files contain the definitions of the storage classes. See "Symbol Table Field Contents by Storage Class" for more information. |
n_numaux | Specifies the number of auxiliary entries for the symbol. If more than one auxiliary entry is required for a symbol, the order of the auxiliary entries is determined by convention. That is, no flag field in the auxiliary entries can be used to distinguish one type of auxiliary entry from another. |
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
The symbol table contains auxiliary entries to provide supplemental information for a symbol. The auxiliary entries for a symbol follow its symbol table entry. The length of each auxiliary entry is the same as a symbol table entry (18 bytes). The format and quantity of auxiliary entries depend on the storage class (n_sclass) and type (n_type) of the symbol table entry.
In XCOFF32, symbols having a storage class of C_EXT or C_HIDEXT and more than one auxiliary entry must have the csect auxiliary entry as the last auxiliary entry. In XCOFF64, the x_auxtype field of each auxiliary symbol table entry differentiates the symbols, but the convention is to generate the csect auxiliary symbol table entry last.
The file auxiliary symbol table entry is defined to contain the source file name and compiler-related strings. A file auxiliary entry is optional and is used with a symbol table entry that has a storage-class value of C_FILE. The C language structure for a file auxiliary entry can be found in the x_file structure in the syms.h file.
The C_FILE symbol provides source file-name information, source-language ID and CPU-version ID information, and, optionally, compiler-version and time-stamp information.
The n_type field of the
symbol table entry identifies the source language of the source file and the
CPU version ID of the compiled object file. The field information is as
follows:
Source Language ID | Overlays the high-order byte of the n_type field. This
field contains the source-language identifier. The values for this
field are defined in the e_lang field in "Exception Section" . This field can be used by
the symbolic debuggers to determine the source language.
The optional values for this field are 248 (TB_OBJECT) for symbols from object files with no C_FILE symbol table entry; or 249 (TB_FRONT) or 250 (TB_BACK) for generated entries used to provide debugging information. If the source language is TB_FRONT or TB_BACK, the 8-character name field begins with ' ' (blank) , '\0'(NULLl). If the source language is TB_FRONT, the third byte is the stabstring compaction level for the object file, and the n_offset field contains the symbol table index of the TB_BACK symbol table entry, if it exists, or 0 otherwise. |
CPU Version ID | Defined as the low-order byte of the n_type field.
Decribes the kind of instructions generated for the file. The following
values are defined:
If both fields are 0, no information is provided about the source language.
|
The following defines the fields
listed above:
If the file auxiliary entry is not used, the symbol name is the name of the source file. If the file auxiliary entry is used, then the symbol name should be .file, and the first file auxiliary entry (by convention) contains the source file name. More than one file auxiliary entry is permitted for a given symbol table entry. The n_numaux field contains the number of file auxiliary entries.
The csect auxiliary entry
identifies csects (section definitions), entry points (label definitions), and
external references (label declarations). A csect auxiliary entry is
required for each symbol table entry that has a storage class value of
C_EXT or C_HIDEXT. See "Symbol Table Entry (syms.h)" for more
information. By convention, the csect auxiliary entry in an XCOFF32
file must be the last auxiliary entry for any external symbol that has more
than one auxiliary entry. The C language structure for a csect
auxiliary entry can be found in the x_csect structure in the
syms.h file.
csect Auxiliary Entry Format | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | N/A | x_scnlen | (See field definition section) | |
N/A | 0 | 4 | x_scnlen_lo | (See field definition section) Low 4 bytes of section length | |
4 | 4 | 4 | 4 | x_parmhash | Offset of parameter type-check hash in .typchk section |
8 | 2 | 8 | 2 | x_snhash | .typchk section number |
10 | 1 | 10 | 1 | x_smtyp | Symbol alignment and type 3-bit symbol alignment (log 2) 3-bit symbol type |
11 | 1 | 11 | 1 | x_smclas | Storage mapping class |
12 | 4 | N/A | x_stab | Reserved | |
16 | 2 | N/A | x_snstab | Reserved | |
N/A | 12 | 4 | x_scnlen_hi | (See field definition section) High 4 bytes of section length | |
N/A | 16 | 1 | (pad) | Reserved | |
N/A | 17 | 1 | x_auxtype | Contains _AUX_CSECT; indicates type of auxiliary entry |
The following defines the fields listed above:
The following storage-mapping classes are read-only and normally mapped to the .text section:
The following storage-mapping classes are read/write and normally mapped to the .data or .bss section:
To minimize the number of duplicate TOC entries that cannot be combined by the binder, compilers and assemblers should adhere to a common naming convention for TOC entries. By convention, compilers and assemblers produce TOC entries that have a storage class value of C_HIDEXT and an n_name string that is the same as the n_name value for the symbol that the TOC entry addresses.
For the cases where TOC scalar cannot reside in the TOC, the binder must be capable of transforming the compiler generated TOC relative instruction into a conventional indirect addressing instruction sequence. This transformation is necessary if the TOC scalar is contained in a shared object.
There is only one function descriptor csect for a function, and it must be contained within the same executable as the function itself is contained. The function descriptor has a storage class value of C_EXT and has an n_name value that is the same as the name of the function in the source file. The addresses of function descriptors are imported to and exported from an executable XCOFF file.
Auxiliary symbol table entries are defined in XCOFF to contain reference and size information associated with a defined function. These auxiliary entries are produced by compilers and assembler for use by the symbolic debuggers. In XCOFF32, a function auxiliary symbol table entry contains the required information. In XCOFF64, both a function auxiliary entry and an exeption auxiliary entry may be needed. When both auxiliary entries are generated for a single C_EXT or C_HIDEXT symbol, the x_size and x_endndx fields must have the same values.
The function auxiliary symbol
table entry is defined in the following table.
Function Auxiliary Entry Format | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | N/A | x_exptr | File offset to exception table entry. | |
4 | 4 | 8 | 4 | x_fsize | Size of function in bytes |
8 | 4 | 0 | 8 | x_lnnoptr | File pointer to line number |
12 | 4 | 12 | 4 | x_endndx | Symbol table index of next entry beyond this function |
16 | 1 | 16 | 1 | (pad) | Unused |
N/A | 17 | 1 | x_auxtype | Contains _AUX_FCN; Type of auxiliary entry |
The following defines the fields
listed in the Function Auxiliary Entry Format table:
The exception auxiliary symbol table
entry, defined in XCOFF64 only, is shown in the following table.
Exception Auxiliary Entry Format (XCOFF64 only) | |||
Offset | Length | Name | Description |
0 | 8 | x_exptr | File offset to exception table entry. |
8 | 4 | x_fsize | Size of function in bytes |
12 | 4 | x_endndx | Symbol table index of next entry beyond this function |
16 | 1 | (pad) | Unused |
17 | 1 | x_auxtype | Contains _AUX_EXCEPT; Type of auxiliary entry |
The following defines the fields listed
in the Exception Auxiliary Entry Format table:
The section auxiliary symbol table
entry is defined in XCOFF to provide information associated with the begin and
end blocks of functions. The section auxiliary symbol table entry is
produced by compilers for use by the symbolic debuggers.
Table Entry Format | |||||
XCOFF32 | XCOFF64 | Name | Description | ||
Offset | Length | Offset | Length | ||
0 | 4 | N/A | (no name) | Reserved | |
4 | 2 | 0 | 4 | x_lnno | Source line number |
6 | 12 | 4 | 13 | (no name) | Reserved |
N/A | 17 | 1 | x_auxtype | Contains _AUX_SYM; Type of auxiliary entry |
The following defines the fields
above:
(no name) | Reserved. |
x_lnno | Specifies the line number of a source file. The maximum value of this field is 65535 for XCOFF64 and 232 for XCOFF64. |
(no name) | Reserved. |
The section auxiliary symbol table
entry ID is defined in XCOFF32 to provide information in the symbol table
concerning the size of sections produced by a compiler or assembler.
The generation of this information by a compiler is optional, and is ignored
and removed by the binder.
Section Auxiliary Entry Format (XCOFF32 Only) | |||
Offset | Length in Bytes | Name | Description |
0 | 4 | x_scnlen | Section length |
4 | 2 | x_nreloc | Number of relocation entries |
6 | 2 | x_nlinno | Number of line numbers |
8 | 10 | (no name) | Reserved |
The following list defines the
fields:
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format." For more information on the symbol table, see "Symbol Table Information."
For information on debugging, see "Debug Section."
This section defines the symbol
table field contents for each of the defined storage classes
(n_sclass ) that are used in XCOFF. The following table
lists storage class entries in alphabetic order. See "Symbol Table Entry (syms.h)" for more
information.
Symbol Table by Storage Class | ||||
Class Definition | n_name | n_value | n_scnum | Aux. Entry |
C_BCOMM 135 Beginning of common block | Name of the common block* | 0, undefined | N_DEBUG |
|
C_BINCL 108 Beginning of include file | Source name of the include file** | File pointer | N_DEBUG |
|
C_BLOCK 100 Beginning or end of inner block | .bb or .eb | Relocatable address | N_SCNUM | BLOCK |
C_BSTAT 143 Beginning of static block | .bs | Symbol table index | N_DEBUG |
|
C_DECL 140 Declaration of object (type) | Debugger stabstring* | 0, undefined | N_SCNUM |
|
C_ECOML 136 Local member of common block | Debugger stabstring* | Offset within common block | N_ABS |
|
C_ECOMM 137 End of common block | Debugger stabstring* | 0, undefined | N_DEBUG |
|
C_EINCL 109 End of include file | Source name of the include file** | File pointer | N_DEBUG |
|
C_ENTRY 141 Alternate entry | * | 0, undefined | N_DEBUG |
|
C_ESTAT 144 End of static block | .es | 0, undefined | N_DEBUG |
|
C_EXT 2 External symbol (defining external symbols for binder processing) | Symbol Name** | Relocatable address | N_SCNUM or N_UNDEF | FUNCTION CSECT |
C_FCN 101 Beginning or end of function | .bf or .ef | Relocatable address | N_SCNUM | BLOCK |
C_FILE 103 Source file name and compiler information | .file or source file name (if no auxiliary entries)** | Symbol table index | N_DEBUG | FILE |
C_FUN 142 Function or procedure | Debugger stabstring* | Offset within containing csect | N_ABS |
|
C_GSYM 128 Global variable | Debugger stabstring* | 0, undefined | N_DEBUG |
|
C_HIDEXT 107 Unnamed external symbol | Symbol Name or null** | Relocatable address | N_SCNUM | FUNCTION CSECT |
C_INFO 100 Comment section reference | Info Name Identifier or null** | Offset within comment section | N_SCNUM |
|
C_LSYM 129 Automatic variable allocated on stack | Debugger stabstring* | Offset relative to stack frame | N_ABS |
|
C_NULL 0 Symbol table entry marked for deletion. |
| 0x00DE1E00 |
| Any |
C_PSYM 130 Argument to subroutine allocated on stack | Debugger stabstring* | Offset relative to stack frame | N_ABS |
|
C_RPSYM 132 Argument to function or procedure stored in register | Debugger stabstring* | Register number | N_ABS |
|
C_RSYM 131 Register variable | Debugger stabstring* | Register number | N_ABS |
|
C_STAT 3 Static symbol (Unknown. Some compilers generate these symbols in the symbol table to identify size of the .text , .data , and .bss sections. Not used or preserved by binder.) | Symbol Name** | Relocatable address | N_SCNUM | SECTION |
C_STSYM 133 Statically allocated symbol | Debugger stabstring* | Offset within csect | N_ABS |
|
C_TCSYM 134 Reserved | Debugger stabstring* |
|
|
|
Notes:
Following are the storage classes
used and relocated by the binder. The symbol values (n_value
) are addresses.
Following are storage classes used
by the binder and symbolic debugger or by other utilities for file scoping and
accessing purposes:
C_FILE | Specifies the source file name. The n_value field holds the symbol index of the next file entry. The n_name field is the name of the file. |
C_BINCL | Specifies the beginning of include header file. The n_value field is the line number byte offset in the object file to the first line number from the include file. |
C_EINCL | Specifies the end of include header file. The n_value field is the line number byte offset in the object file to last line number from the include file. |
C_INFO | Specifies the location of a string in the comment section. The n_value field is the offset to a string of bytes in the specified STYP_INFO section. The string is preceded by a 4-byte length field. The n_name field is preserved by the binder. An application-defined unique name in this field can be used to filter access to only those comment section strings intended for the application. |
Following are the storage classes
that exist only for symbolic debugging purposes:
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format." For more information on the symbol table, see "Symbol Table Information."
For information on debugging, see "Debug Section."
IN XCOFF32, the string table contains the names of symbols that are longer than 8 bytes. In XCOFF64, the string table contains the names of all symbols. If the string table is present, the first 4 bytes contain the length (in bytes) of the string table, including the length of this length field. The remainder of the table is a sequence of null-terminated ASCII strings. If the n_zeroes field in the symbol table entry is 0, then the n_offset field gives the byte offset into the string table of the name of the symbol.
If a string table is not used, it
may be omitted entirely, or a string table consisting of only the length field
(containing a value of 0 or 4) may be used. A value of 4 is
preferable. The following table shows string table organization.
String Table Organization | ||
Offset | Length in Bytes | Description |
0 | 4 | Length of string table. |
4 | n | Symbol name string, null-terminated. |
|
| Field repeats for each symbol name. |
For general information on the XCOFF file format, see "XCOFF Object (a.out) File Format."
The debug section contains the symbolic debugger stabstrings (symbol table strings). It is generated by the compilers and assemblers. It provides symbol attribute information for use by the symbolic debugger.
See "Debug Section" for a general discussion.
In the stabstring grammar, there are five types of terminal symbols, which are written in all capital letters. These symbols are described by the regular expressions in the following list:
Note: The [ ] (brackets) denote one instance, [ ]* (brackets asterisk) denote zero or more instances, [ ]+ (brackets plus sign) denote one or more instances, ( ) (parentheses) denote zero or one instance, .* (dot asterisk) denotes a sequence of zero or more bytes, and | (pipe) denotes alternatives.
Symbol | Regular Expression |
---|---|
NAME | [^ ; : ' "] (A name consists of any non-empty set of characters, excluding ; : ' or ".) |
STRING | '.*' |
".*", where \", \', or
\\ can be used inside the string
Within a string, the \ (backslash character) may have a special meaning. If the character following the \ is another \, one of the backslashes is ignored. If the next character is the quote character used for the current string, the string is interpreted as containing an embedded quote. Otherwise, the \ is interpreted literally. However, if the closing quote is the last character in the stabstring, and a \ occurs immediately before the quote, the \ is interpreted literally. This use is not recommended. The \ must be quoted only in the following instances:
An escaped quote is required only when a single string contains both a single quote and a double quote. Otherwise, the string should be quoted with the quote character not contained in the strings. A string can contain embedded null characters, so utilities that process stabstrings must use the length field to determine the length of a stabstring. |
INTEGER | (-)[0-9]+ |
HEXINTEGER | [0-9A-F]+ |
REAL | [+-][0-9]+(.)[0-9]*([eEqQ](+-)[0-9]+)
| (+-)INF | QNAN | SNAN
Real numbers are the same strings recognized by the scanf subroutine when using the "%lf" pattern. Therefore, white space may occur before a real number. |
REALs may be preceded by white space, and STRINGs may contain any characters, including null and blank characters. Otherwise, there are no null or blank characters in a stabstring.
Long stabstrings can be split across multiple symbol table entries for easier handling. In the stabstring grammar, a # (pound sign) indicates a point at which a stabstring may be continued. A continuation is indicated by using either the ? (question mark) or \ as the last character in the string. The next part of the stabstring is in the name of the next symbol table entry. If an alternative for a production is empty, the grammar shows the keyword /*EMPTY*/.
The following list contains the stabstring grammar:
Note: Type attributes (TypeAttrs) are extra information associated with a type, such as alignment constraints or pointer-checking semantics. The dbx program recognizes only the size attribute and the packed attribute. The size attribute denotes the total size of a padded element within an array. The packed attribute indicates that a type is a packed type. Any other attributes are ignored by dbx.
For i types, ModuleName refers to the Modula-2 module from which it is imported.
The as command, dbx command, dump command, ld command, size command, strip command, and what command.