Every object file compiled byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/SMGCommunity/Petari/llms.txt
Use this file to discover all available pages before exploring further.
mwcc contains a .comment ELF section. This section carries per-symbol metadata — primarily alignment values and “force active” (export) flags — that mwld reads during the link step. Its presence or absence has consequences that are important to understand when reproducing an original build.
Effect on linker behavior
When a.comment section is absent, mwld skips two operations it would otherwise perform:
- It does not adjust symbol alignment.
- It does not remove unused symbols (dead-stripping is disabled).
mwld to re-run alignment and dead-stripping on those objects would change the output. Because objects generated by powerpc-eabi-as (the GNU assembler) contain no .comment section, assembler-built objects benefit from this passthrough behavior automatically.
When the .comment section is required
Export behavior when .comment is generated
When decomp-toolkit generates a.comment section for an object, it marks all global symbols in that object as “exported” (force active). This prevents mwld from dead-stripping any symbols, because the mere presence of the .comment section re-enables dead-stripping. The export flag counteracts that by pinning every symbol in place.
This is also useful for preventing the linker from discarding entire objects. A missing .comment section blocks removal of individual unused symbols inside an object, but the linker will still discard the entire object if it believes it is unreferenced. Generating a .comment section and setting the export flag closes that gap.
Binary format
The.comment section has a fixed-layout header followed by one 8-byte entry per ELF symbol (including the null symbol at index 0).
Header
0x0B) — known values:
| Value | Hex | CodeWarrior version |
|---|---|---|
| 8 | 08 | GameCube 1.0 and later |
| 10 | 0A | GameCube 1.3.2 and later |
| 11 | 0B | GameCube 2.7 and later |
| 12 | 0C | GameCube 2.7 and later (difference from 11 unknown) |
| 14 | 0E | GameCube 3.0a3 and later |
| 15 | 0F | GameCube 3.0a3 and later (difference from 14 unknown) |
The version byte is configurable via the
mw_comment_version key in config.yml. It is not known whether mwld actually changes behavior based on this value, but it should match the compiler version used to build the project to produce a byte-identical .comment section.0x0C, 4 bytes):
The first three bytes are the major, minor, and patch version of the compiler. The fourth byte is always 0x01.
mwcc --help may differ from the internal version number stored here.
Pool data flag (0x10):
0x11):
0x15) — known bits:
Symbol entries
Starting at offset0x2C, there is one 8-byte entry for every ELF symbol in the object, in index order. The first entry corresponds to the null ELF symbol and is all zeros.
0x04):
| Value | Meaning |
|---|---|
00 | Default visibility |
0D | Weak |
0E | Unknown; also appears to indicate weak |
0x05):
| Value | Meaning |
|---|---|
00 | Default |
08 | Force active / export — prevents dead-stripping. When set on a section symbol, the entire section is preserved as-is. Used by mwcc when data pooling is active (e.g. a symbol named ...data.0) to protect hard-coded section-relative offsets. Equivalent to #pragma force_active on or __declspec(export). |
10 | Unknown |
20 | Unknown |