Introduction
A REL is a relocatable module for the Nintendo GameCube and Wii: code and data that a game loads while it runs, links to the main program (the
DOL) and to other modules, and may unload again. The operating system function OSLink loads one. A game may
keep most of its code in modules, or use them for parts that need not stay in memory. The processor is the same PowerPC as for a DOL
(Gekko and Broadway), big-endian.
A REL has no signature, and the extension is not unique: the explorer takes a file named .rel and checks its structure (a
version of 1, 2 or 3, a header, a section table, an import table and every relocation list inside the file and ending with its end marker). Files that fail
the check, such as the contacts database files some older programs also call .rel, are shown as not a valid REL. A module without the
extension is not recognised.
Structure
0x00the header: module id, links, section count and table offset, name, version, BSS size, import table, prolog, epilog and unresolved0x40, 0x48 or 0x4C bytes- the section table: for each section a file offset (bit 0: code) and a length8 bytes each
- the sections: code, data (the BSS has no bytes)as the table says
- the import table: for each module the relocations refer to, its id and its list’s offset8 bytes each
- the relocation lists, each ending with the end marker8 bytes per entry
The fields are on header, the table and the sections on sections, and what the loader does with the lists on imports and relocations.
In the explorer
The viewer shows the header field by field, the section table, the import table and each relocation list as nodes of the file (the entries are listed on demand), tables of the sections, the imports and the relocation types used, and every code section disassembled with the PowerPC decoder. An instruction that a relocation patches carries a note naming the type and what it points to (an address in the main program, or a section of this or another module). The relocations are not applied: the listing shows the bytes of the file. The options are the processor, an assumed address for the first section (the loader chooses the real one at run time), register names and simplified mnemonics.
Not described
Known, not yet covered
- Reference: the loader’s order of operations in detail (the wiki describes the relocation types and the module selection and nothing further), the separate name file the header’s name offset points into, the fixed-size linking of version 3 beyond the field, the type 204 (
R_DOLPHIN_MRKREF), whose purpose is unknown, and the RSO and DLL variants that WiiBrew says are used similarly. - Viewer: recognition by structure only; relocations are noted, not applied; the section addresses in the listing are an assumed placement; data sections are shown as bytes; no symbols besides the three header entry points. It was checked only on built modules, because no real REL exists on this machine, and has not been run in a browser by its author.
Links
Software
- Dolphin – GameCube and Wii emulator (Windows, macOS, Linux, Android)
Reference
- Mario Kart Wii wiki: REL (File Format) – the header, tables and relocation types
- WiiBrew: REL – an introduction that points to the wiki above