Introduction
The header gives the section count and the offset of the section table. The table has one 8-byte entry per section, and the sections are numbered by their place in it: the relocations, the prolog and the other entry points all name a section by this number. The layout follows the Mario Kart Wii wiki “REL (File Format)”, read through a page summary (our words).
Table entries
| Offset | Size | Field | Meaning |
|---|---|---|---|
0x0 | 4 | Offset | The file offset of the section’s bytes. Bit 0 is set for an executable (code) section and is masked off to get the offset. An offset of 0 with a length is an uninitialised section: the BSS. |
0x4 | 4 | Length | The length in bytes. An entry with length 0 is skipped. |
The first entry (section 0) is always empty. A section number of 0 in the header’s prolog, epilog and unresolved fields therefore means “none”.
The sections
A toolchain writes the code of the module into one or more code sections and its initialised data into data sections; the BSS has no bytes in the file. Which sections a given toolchain writes, and in what order, is not described here: the only modules checked are ones built for the tests (section 0 empty, then code, data and a BSS). The code sections are what the explorer disassembles; the relocations say which words in them are patched when the module is linked.
Not described
Known, not yet covered
- Reference: the alignment the loader gives each section (the header’s alignment fields are described but their use is not), and the order of the sections in modules built by Nintendo’s tools.
- Viewer: data sections are shown as bytes; no real module was available.
Links
Reference
- Mario Kart Wii wiki: REL (File Format) – the section table