191 Commits

Author SHA1 Message Date
c484952912 Support generating RELs with non-sequential module IDs
Uses the module ID from the configuration, if present,
falling back to the standard behavior of sequential
module IDs.
2024-06-24 17:43:33 -06:00
4d039140f2 Version 0.9.2 v0.9.2 2024-06-10 17:41:05 -06:00
9c12efa64e Update orthrus-ncompress 2024-06-10 17:40:46 -06:00
af3bcf5f9e Create gap symbols at the end of sections
Before, the end of the section
was not considered, so missing
symbols at the end of a section
would omit that data entirely.
2024-06-10 17:40:39 -06:00
761a940f9e Match original "exec" for REL sections
mwld writes empty code sections as
NULL type in the PLF, but sometimes
the original REL has the exec flag
set for these sections. Match the
original value.
2024-06-10 17:39:40 -06:00
3841004947 Fix writing empty v3 RELs
Resolves #59
2024-06-10 17:38:11 -06:00
e359ea1e9e Improve REL relocation error handling 2024-06-10 17:37:06 -06:00
8813a2c9e4 Version 0.9.1 v0.9.1 2024-06-10 00:43:44 -06:00
eb7c3e9d9f Detect _savevr/_restvr + check in RELs
Some games include a copy of MW
runtime.c in RELs. Easy to check.

Some games also include _savevr/
_restvr for AltiVec. This is weird
but we can handle it as well.
2024-06-10 00:43:00 -06:00
3289b2a3aa Ignore invalid instructions
This could be a bad idea, but
it's unclear how to properly
handle these cases.

Resolves #55
2024-06-10 00:40:37 -06:00
b44aa78c49 Fix REL alignment after section data 2024-06-10 00:38:06 -06:00
4ea4ec86d0 Partially revert "Rework section alignment handling"
It turns out we can't actually
trust mwld to put our alignment
values in the PLF. Sad.
2024-06-10 00:37:17 -06:00
4dd2ebf85a Rename ObjSections::count -> len 2024-06-09 16:10:34 -06:00
46cf0be183 Add U8 (newer .arc) support
Supports the U8 .arc format, just
like the older RARC format.

`u8 list`, `u8 extract` and support
for U8 archive paths in config.yml
v0.9.0
2024-06-03 20:34:35 -06:00
255123796e Instruction disassembly in dol diff
When a function diff is detected in
`dol diff`, objdiff-core is used to
print a detailed view highlighting
any differences.

Resolves #28
2024-06-03 20:31:06 -06:00
d63111466b SN GCC DWARF improvements
Now emits all DWARF tags for
Spongebob Squarepants: Creature
from the Krusty Krab properly.

Resolves #46
2024-06-03 18:48:28 -06:00
61cd72cd11 Support address in config symbol references
Example: `symbol_name!.data:0x1234`
Allows disambiguating local symbols
with the same name.

Supported in `extract` and
`add_relocations` in config.yml

Resolves #58
2024-06-03 18:08:06 -06:00
4701de32f6 Check for existing function with bl
Ensures that the analyzer won't
create a function when the target
is already contained within a
function. Useful with manual asm
that would otherwise trip up the
analyzer.

Partial work for #56
2024-06-03 18:06:10 -06:00
6b60c13834 Change REL "invalid relocation" to warning
Also ensures that `block_relocations`
works to remove the warning

Resolves #53
2024-06-03 18:03:39 -06:00
53c6d74a6b Fix addic/addic. handling in relocation tracker
Resolves #57
2024-06-03 18:01:55 -06:00
d9770c48b2 Version 0.8.3 v0.8.3 2024-05-19 23:09:16 -06:00
c3f3ea58e8 Support block_relocations and add_relocations in config.yml
This allows more granular control over generated relocations.

Also optimizes relocation address validity checks,
leading to ~20% faster relocation analysis.

Config example:
```
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

add_relocations:
# Inserts or overwrites a relocation.
# From: `subi r3, r3, 0x7657`
# To: `li r3, mesWInsert-0x1@sda21`
- source: .text:0x800473F4
  type: sda21
  target: mesWInsert
  addend: -1
```

Resolves #33
Resolves #52
2024-05-19 22:49:40 -06:00
e1c80655b7 Fix lcf generation for empty RELs
Also, handle alignment of 0 in rel make
2024-05-19 22:28:14 -06:00
bf0d1a823f Version 0.8.2: Fix asm output v0.8.2 2024-05-17 07:12:05 -06:00
0bcc539d36 Version 0.8.1: Fix .note.split generation v0.8.1 2024-05-16 18:31:27 -06:00
cb1a765041 Version 0.8.0 v0.8.0 2024-05-15 23:16:26 -06:00
cadmic
876b78bfa6
Reconstruct "erased" tags from DWARF debugging info (#51)
* Read erased tags

* cargo +nightly fmt

* .filter(...).next() -> find(...)

* Plumb both data and address endians through

* Rename has_erased_parent -> is_erased_root and comment
2024-05-15 23:06:30 -06:00
d3c2e8192c ci: Bump cargo-zigbuild version 2024-05-01 09:37:09 -06:00
4dacf2f39a Add disc commands: info, extract, convert, verify
Utilizing https://github.com/encounter/nod-rs
2024-05-01 00:12:20 -06:00
9452ca8b8c Pass ppc750cl::Ins by value 2024-04-30 22:53:32 -06:00
963425793d Remove unused deps 2024-04-30 20:48:53 -06:00
c45f37eb10 Update ppc750cl (10x faster!) & upgrade deps 2024-04-30 20:40:14 -06:00
c1c4373e53 Prefer references to _savegpr_14 over __savegpr
Same for `__restore_gpr`, `__save_fpr` and `__restore_fpr`.
A common issue that can be solved with a little bit
of special-casing.
2024-04-30 18:04:50 -06:00
dc7e307c44 Rework section alignment handling
- Honor splits.txt alignment values when writing ldscript.lcf
- Add alignment values to ldscript_partial.lcf, remove hacky code from rel make
- Guess alignment values in DOL loader

Fixes #27
2024-04-30 18:04:17 -06:00
dac2dcfc9e Explicitly check split end >= start
Fixes #48
2024-04-30 18:03:59 -06:00
fdafe59e13 Adds data:int and data:short for asm output
Fixes #41
2024-04-30 18:03:45 -06:00
bfa926ebbf Write object address and size in asm comments
Fixes #37
2024-04-30 18:03:31 -06:00
989293a477 Add Yay0/Yaz0 compression & decompression
Uses orthrus-ncompress

Fixes #6
2024-04-30 18:03:00 -06:00
e46c6a72bc Split up README a bit 2024-04-22 23:17:09 -06:00
a156c3697f Appease clippy v0.7.6 2024-04-03 00:18:16 -06:00
3497d38ea3 Version 0.7.6 2024-04-03 00:13:42 -06:00
d0f39f1d82 Support global labels in REL creation (_savegpr, etc) 2024-04-03 00:13:15 -06:00
ccfbfd1a5a Fix for jumptable naming in RELs 2024-04-03 00:12:46 -06:00
e9a9ed0453 Fixes for switch analysis
- When finalizing a block, restart analysis at
  the first block
- Check for default case in jump table entries
2024-04-03 00:11:58 -06:00
9249fa67b8 ci: Update actions versions 2024-03-13 18:31:42 -06:00
7fd039722d Format & use syntect regex-fancy
The onig crate no longer builds
in CI with cargo-zigbuild.
2024-03-13 18:30:15 -06:00
d727110262 Update all dependencies & support new demangle flag
- Support `--mw-extensions` flag for demangle
- Fix relocation handling for object crate upgrade
2024-03-13 18:23:09 -06:00
b829e15438 Rework .splitmeta, now .note.split
Uses actual ELF .note format, which is
more standard and handled better by mwld.
v0.7.5
2024-03-04 18:12:20 -07:00
96b13be11d Allow overriding jump table size analysis
When the analyzer detects a jump table,
it will now check for an existing object
symbol at that address, using that size
if present.
2024-03-04 18:11:31 -07:00
4f8a9e6fab Write .splitmeta section in split objects
This enables showing the original address of
symbols in objdiff, as well as `elf disasm`
on split objects retaining the original
addresses.
2024-02-28 22:27:38 -07:00