The GOFF (Generalized Object File Format) specification was developed for the IBM zSystem Mainframe computer to supersede the IBM OS/360 Object File Format to compensate for weaknesses in the older format.
Contents
Background
The original IBM OS/360 Object File Format was developed in 1964 for the new IBM System/360 mainframe computer. The format was also used by makers of plug compatible and workalike mainframes, including the Univac 90/60, 90/70 and 90/80 and Fujitsu B2800. The format was expanded to add symbolic records and expanded information about modules, plus support for procedures and functions with names longer than 8 characters. While this helped, it did not provide for the enhanced information necessary for today's more complicated programming languages and more advanced features such as objects, properties and methods, Unicode support, and virtual methods (a procedure in an object that is not known which procedure is invoked until the program runs, because a later definition of a procedure with the same name in a descendant object replaces the original procedure in the ancestor object).
The GOFF object file format was developed by IBM approximately in 1995 as a means to overcome these problems. Note that the OS/360 Object File Format was simply superseded by the GOFF format, it was not deprecated, and is still in use by assemblers and language compilers where the language can withstand the limitations of the older format.
Note that this article will use the term "module" to refer to any name or equivalent symbol, which is used to provide an identifier for a piece of code or data external to the scope to which it is referenced. A module may refer to a subroutine, a function, a method or property of an object or class, or any other named routine or identifier external to that particular scope referencing the external name.
Requirements and restrictions
The format is similar to the OS/360 Object File Format but adds additional information for use in building applications.
Record Types
Similarly to the older OS/360 format, object file records are divided into 6 different record types, some added, some deleted, some altered:
Format
GOFF records may be fixed or variable length; the minimum length when using variable-length records is 56 characters, although most records will be longer than this. Except for module and class names, all characters are in the EBCDIC character set. Unix-based systems must use fixed-length (80-byte) records. Records in fixed-length files that are shorter than the fixed length should be zero-filled. To distinguish GOFF records from the older OS/360 format or from commands that may be present in the file, the first byte of each GOFF record is always the binary value X'03', while commands must start with a character value of at least space (X'40'). The next 2 bytes of a GOFF record indicate the record type, continuation and version of the file format. These first 3 bytes are known as the PTV field.
PTV
The PTV field represents the first 3 bytes of every GOFF record.
HDR
The HDR record is required, and must be the first record.
ESD
An ESD record gives the public name for a module, a main program, a subroutine, procedure, function, property or method in an object, Fortran Common or alternate entry point. An ESD record for a public name must be present in the file before any reference to that name is made by any other record.
Continuation
In the case of fixed-length records where the name requires continuation records, the following is used:
ADATA records
ADATA ("associated data") records are used to provide additional symbol information about a module. They replaced the older SYM records in the 360 object file format. To create an ADATA record
ADATA records will be appended to the end of the class in the order they are declared.
Class names assigned to ADATA records are translated by IBM programs by converting the binary value to text and appending it to the name C_ADATA, So an item numbered X'0033' would become the text string C_ADATA0033.
TXT
TXT records specify the machine code instructions and data to be placed at a specific address location in the module. Note that wherever a "length" must be specified for this record, the length value must include any continuations to this record.
Compression Table
A compression table is used if bytes 20-21 of the TXT record is nonzero. The R value is used to determine the number of times to repeat the string; the L value indicates the length of the text to be repeated "R" times. This could be used for pre-initializing tables or arrays to blanks or zero or for any other purpose where it is useful to express repeated data as a repeat count and a value.
IDR Format 1
Note that unlike most number values stored in a GOFF file, the "version", "release" and "trans_date" values are numbers as text characters instead of binary
IDR Format 2
Normally compilers and assemblers do not generate this format record, it is typically created by the binder.
IDR Format 3
All text in this item are character data; no binary information is used.
RLD
RLD records allow a module to show where it references an address that must be relocated, such as references to specific locations in itself, or to external modules.
Relocation Data
To clarify, if a module in a C program was named "Basura" was to issue a call to the "exit" function to terminate itself, the R_Pointer address would be the ESDID of the routine "exit" while the P_Pointer would be the ESDID of "Basura".
LEN
LEN records are used to declare the length of a module where it was not known at the time the ESD record was created, e.g. for one-pass compilers.
Elements
A deferred-length element entry cannot be continued or split
END
END must be the last record for a module. An 'Entry Point' is used when an address other than the beginning of the module is to be used as the start point for its execution. This is used either because the program has non-executable data appearing before the start of the module (very common for older assembly programmers, as older versions of the assembler were much slower to assemble data stored in programs once instructions were specified), or because the module calls an external module first, such as a run-time library to initialize itself.
Continuation
If an entry-point name specified on a fixed-length END record is longer than 54 bytes or (if this record itself is also continued) is longer than an additional 80 bytes), the following continuation record is used.