IBM OS/2 16/32-bit Linear eXecutable Module Format (LX) Specification
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
This document describes the IBM OS/2 16/32-bit Linear eXecutable Module Format (LX). This is the load module format understood by the OS/2 32-bit system loader (for OS/2 version 2.0 and greater). LX load modules are created by Linear Executable linker utilities (such as IBM LINK386). A Linear Executable linker must be used in order to create 32-bit (flat-model) OS/2 programs; however, the LX format also allows for any combination of 16-bit and 32-bit code or data sections to exist within the same module.
Linear Executable Module Format
The following sections describe the Linear Executable Module Format in detail.
Linear Executable Sections
The LX module header may optionally be preceded by a DOS 2 compatible module header. The DOS 2 compatible module header is identified by the first two bytes of the header containing the signature characters "MZ". If the DOS 2 compatible module header is absent then the module will start with the LX module header.
If a module begins with a DOS 2 compatible module header, then the following technique should be used to locate the LX module header, if present. The word at offset 18h in the DOS 2 compatible module header is the offset to the DOS relocation table. If this offset is 40h, then the doubleword at offset 3Ch in the DOS 2 compatible module header contains the offset, from the beginning of the file, to the new module header. This may be an LX module header and can be identified by the first two bytes of the header containing the signature characters "LX". If a valid module header is not found, then the file is a DOS 2 compatible module.
The remainder of the DOS 2 compatible module header will describe a DOS stub program. The stub may be any valid program but will typically be a program which displays an error message. It may also be a DOS version of the LX program.
Figure 3-1: DOS 2.0 Section (Discarded after processed by the loader)
00h DOS 2 Compatible EXE header 1Ch unused 24h OEM Identifier 26h OEM Info 3Ch Offset to Linear EXE Header 40h DOS 2.0 Stub Program and Relocation Table
Figure 3-2: Linear Executable Module Header (In-memory copy maintained)
xxh Executable Information Module Information Loader Section Information Table Offset Information
Figure 3-3: Loader Section (In-memory copy maintained)
Object Table Object Page Table Resource Table Resident Name Table Entry Table Module Format Directives Table (Optional) Resident Directives Data (Optional) (Verify Record) Per-Page Checksum
Figure 3-4: Fixup Section (In-memory copy maintained)
Fixup Page Table Fixup Record Table Import Module Name Table Import Procedure Name Table
The Fixup Section must immediately follow the Loader Section in the executable file. Although they are defined as two separate sections, the OS/2 loader currently treats these two sections as one section.
Figure 3-5: Data Section (No In-memory copy maintained)
Preload Pages Demand Load Pages Iterated Pages Non-Resident Name Table Non-Resident Directives Data (Optional) (To be Defined)
Figure 3-6: Debug Section (Not used by the Loader)
Note: The standard section ordering of an LX module is the LX module header, the resident sections, the non-resident sections and finally the debug section (if present). It is also permissable to use an alternate section ordering of the LX module header, the non-resident sections, the resident sections and finally the debug section (if present).