DOL (File Format)
The DOL format is the name given to a section of Wii and GameCube disc partitions. This section represents an object file. It contains code for the game or program on the disc as well as the data needed by that code. The discs do not explicitly contain a file with the DOL format in the file system, but by convention most disc viewers/editors list a file called main.dol which contains the DOL section of the disc. Mario Kart Wii's disc contains three DOL sections for each of its three disc partitions. This article documents the generic DOL format, information about Mario Kart Wii's main DOL can be found at main.dol.
Like many object formats, DOLs are divided into sections, grouped by like access. For example, executable code may be placed in one section, read only data in another, etc. The file begins with a header and then is directly followed by the section data. The format does not support relocation or symbol information and so DOLs are much simpler and much less flexible than most common object formats such as ELF or PE (.exe). The REL format is used by some games including Mario Kart Wii when a more complex object format is required.
The file begins with a header of 0x100 bytes. The header allows for a maximum of 18 sections with contents. The first 7 sections can contain executable code and the remaining 11 sections can only contain data. The header also allows for a zero initialised (
bss) range. This range can overlap the 18 sections, with the sections taking priority. DOL files on Wii and GameCube should only affect address in the range
0x81200000. Addresses outside this range are reserved for the operating system and the loader.
|0x000||4 × 18||Section offsets indicate where each section's data begins relative to the start of this header. 0 for unused sections.|
|0x048||4 × 18||Section address indicates where each section should be copied to by the loader as a virtual memory address. 0 for unused sections.|
|0x090||4 × 18||Section lengths indicate the size in bytes of each section. 0 for unused sections.|
|0x0d8||4||bss address indicates the start of the zero initialised (|
|0x0dc||4||bss length indicates the size in bytes of the zero initialised (|
|0x0e0||4||Entry point indicates the virtual memory address of a function to run after the DOL has been loaded in order to start the program. This function should not return.|
|0x100||End of header. Start of section data.|
Small data sections
The PowerPC Embedded ABI specification defines four additional sections for fast access to small data (≤8bytes):
.sbss2. However, the DOL format can only define one
.bss section. In order to support this ABI extension, DOL allows defining data sections inside the
.bss address region. These sections represent
.sdata2 and their corresponding
.sbss2 sections are the remaining
.bss chunks until the next "interrupting"
.sdata section or the end of
.bss. So in a DOL supporting the PPC EABI, the region defined by the header as
.bss actually defines 5 sections:
.bss: From the region start until the first interrupting data section.
.sdata: From the start of the first interrupting data section until its end.
.sbss: From the end of the first interrupting data section until the start of the second interrupting data section.
.sdata2: From the start of the second interrupting data section until its end.
.sbss2: From the end of the second interrupting data section until the region end.
- , Power PC Embedded Application Binary Interface (EABI): 32-Bit Implementation