Documentation updates

Resolves #28
This commit is contained in:
Luke Street 2024-09-17 19:20:51 -06:00
parent 16efd6a025
commit 83e44bbec3
3 changed files with 44 additions and 6 deletions

View File

@ -120,6 +120,8 @@ modules:
extract: extract:
- # The symbol name to extract. - # The symbol name to extract.
# To disambiguate local symbols with the same name, use:
# `SomeSymbol!.section:0x80001234`
symbol: SomeSymbol symbol: SomeSymbol
# (optional) The path to extract raw binary data to. # (optional) The path to extract raw binary data to.
@ -130,3 +132,26 @@ extract:
# In a C/C++ file, the symbol can be included with `#include "Lib/SomeSymbol.inc"`. # In a C/C++ file, the symbol can be included with `#include "Lib/SomeSymbol.inc"`.
# Path is relative to `build/GAMEID/include`. # Path is relative to `build/GAMEID/include`.
header: Lib/SomeSymbol.inc header: Lib/SomeSymbol.inc
# (optional) Block relocations from or to specific addresses.
# For modules, this goes in the module's configuration above.
block_relocations:
# Block any relocation pointing _to_ this address.
- target: .data:0x80130140
# Block any relocation originating _from_ this address.
- source: .text:0x80047160
# (optional) End address to make it a range.
end: .text:0x800471A8
# (optional) Add or replace relocations if they were detected incorrectly.
# For modules, this goes in the module's configuration above.
add_relocations:
# From: `subi r3, r3, 0x7657`
# To: `li r3, mesWInsert-0x1@sda21`
- source: .text:0x800473F4
type: sda21
target: mesWInsert # Supports `symbol` or `symbol!.section:0x80001234`
addend: -1

View File

@ -27,11 +27,24 @@ path/to/file.cpp: [file attributes]
### File attributes ### File attributes
- `comment:` Overrides the `mw_comment_version` setting in [`config.yml`](/config/GAMEID/config.example.yml) for this file. See [Comment section](comment_section.md). - `comment:` Overrides the `mw_comment_version` setting in [`config.yml`](/config/GAMEID/config.example.yml) for this file. See [Comment section](comment_section.md).
- `comment:0` is used to disable `.comment` section generation for a file that wasn't compiled with `mwcc`.
`comment:0` is used to disable `.comment` section generation for a file that wasn't compiled with `mwcc`.
Example: `TRK_MINNOW_DOLPHIN/ppc/Export/targsupp.s: comment:0` Example: `TRK_MINNOW_DOLPHIN/ppc/Export/targsupp.s: comment:0`
This file was assembled and only contains label symbols. Generating a `.comment` section for it will crash `mwld`. This file was assembled and only contains label symbols. Generating a `.comment` section for it will crash `mwld`.
- `order:` Allows influencing the resolved link order of objects. This is **not required**, as decomp-toolkit will generate the link order automatically. This can be used to fine-tune the link order for ambiguous cases.
Example:
```
file1.cpp: order:0
...
file2.cpp: order:1
...
file3.cpp: order:2
...
```
This ensures that `file2.cpp` is always anchored in between 1 and 3 when resolving the final link order.
### Section attributes ### Section attributes
- `start:` The start address of the section within the file. For DOLs, this is the absolute address (e.g. `0x80001234`). For RELs, this is the section-relative address (e.g. `0x1234`). - `start:` The start address of the section within the file. For DOLs, this is the absolute address (e.g. `0x80001234`). For RELs, this is the section-relative address (e.g. `0x1234`).

View File

@ -30,7 +30,7 @@ All attributes are optional, and are separated by spaces.
- `size:` The size of the symbol. - `size:` The size of the symbol.
- `scope:` The symbol's visibility. `global` (default), `local` or `weak`. - `scope:` The symbol's visibility. `global` (default), `local` or `weak`.
- `align:` The symbol's alignment. - `align:` The symbol's alignment.
- `data:` The data type used when writing disassembly. `byte`, `2byte`, `4byte`, `8byte`, `float`, `double`, `string`, `wstring`, `string_table`, or `wstring_table`. - `data:` The data type used when writing disassembly. `byte`, `2byte`, `4byte`, `8byte`, `float`, `double`, `int`, `short`, `string`, `wstring`, `string_table`, or `wstring_table`.
- `hidden` Marked as "hidden" in the generated object. (Only used for extab) - `hidden` Marked as "hidden" in the generated object. (Only used for extab)
- `force_active` Marked as ["exported"](comment_section.md) in the generated object, and added to `FORCEACTIVE` in the generated `ldscript.lcf`. Prevents the symbol from being deadstripped. - `force_active` Marked as ["exported"](comment_section.md) in the generated object, and added to `FORCEACTIVE` in the generated `ldscript.lcf`. Prevents the symbol from being deadstripped.
- `noreloc` Prevents the _contents_ of the symbol from being interpreted as addresses. Used for objects containing data that look like pointers, but aren't. - `noreloc` Prevents the _contents_ of the symbol from being interpreted as addresses. Used for objects containing data that look like pointers, but aren't.