37 Commits

Author SHA1 Message Date
b184fee73f Migrate SectionIndex/SymbolIndex to u32
This halves the size of structs like SectionAddress.
2024-10-04 20:40:50 -06:00
Amber Brault
26f52f65b7
Automatically check for invalid extab relocations (#75)
* Begin work on extab reloc analysis code

* Refactoring

* Make format happy

* Address feedback + improvements
2024-10-03 01:13:23 -06:00
First Last
c3c7c2b062
Properly locate ProDG .bss sections (partial addressing of #62) (#63)
* Locate ProDG .bss sections (partial addressing of #62)

* Support both correct and incorrect memset calls
2024-07-16 23:14:46 -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
4dd2ebf85a Rename ObjSections::count -> len 2024-06-09 16:10:34 -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
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
9452ca8b8c Pass ppc750cl::Ins by value 2024-04-30 22:53:32 -06:00
c45f37eb10 Update ppc750cl (10x faster!) & upgrade deps 2024-04-30 20:40:14 -06:00
fdafe59e13 Adds data:int and data:short for asm output
Fixes #41
2024-04-30 18:03:45 -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
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
59fe8069f8 Analyzer fix for fallthrough switch cases
Fixes #23
2024-01-06 22:57:41 -07:00
85e044463e Support matching multiple symbols with signatures
Half of #20
2024-01-06 18:31:33 -07:00
d9612cc9b7 Analyzer improvements for ProDG (WIP)
Fixes #19
2024-01-06 16:05:04 -07:00
c44846d73f Allow absolute relocations to linker generated symbols
Fixes #15
2024-01-06 11:47:17 -07:00
ebff47924f Add links field to config for overriding REL linkage
By default, every REL is linked with every other REL. Some games, like Mario Party, link RELs individually, so the module IDs are not unique. To support this, the `links` field can be used to override which _other_ modules are included in a module's analysis.
2023-11-18 23:37:50 -05:00
dfb569b883 Add alf support (NVIDIA Shield TV binaries)
- Supports .alf files in all places .dol files are accepted.
- Adds `hash` and `dhash` to symbols config.
2023-10-07 02:03:09 -04:00
d4ef1ce16a Analyzer fixes galore
- Transparent NLZSS decompression (add `:nlzss` to path)
- Overhaul portions of the analyzer to support more games
- Reject some invalid data relocations automatically
- Jump table analysis fixes
2023-09-13 02:08:51 -04:00
e3857d3212 Improvements to REL & map support
- Fix symbols.txt align attribute
- Fully support nested RARC files & transparent Yaz0 decompression
- Guess symbol visibility for maps without link map
- Add module name config
- Add manual force_active config
- Quiet option for shasum
- `symbols_known` and `fill_gaps` config
- Allow disabling .comment generation per-unit (`comment:0`)
- Various minor fixes
- Add `rarc` and `yaz0` commands
2023-09-05 17:22:22 -04:00
f9f7fb2e1e Working rel make & more
- Added `elf info`
- Improved `rel info`
- Colored output for `shasum`
- Fix section `rename` in RELs
- Added padding symbols to avoid linker issues
- Automatically set symbols to "active" in .comment output
2023-08-23 23:13:12 -04:00
a2374e4fa0 Semi-working REL analysis & splitting 2023-08-23 23:13:12 -04:00
3f63f1ef47 A lot more section-address-aware refactoring 2023-08-23 23:13:12 -04:00
5843ee021e Begin REL analysis & rework lots of code to be section-address aware 2023-08-17 22:09:45 -04:00
908e3bb037 Check functions at start of code sections in detect_functions 2023-08-15 22:44:48 -04:00
2c2ee8bf08 Validate splits don't overlap symbols (or each other)
Use DoubleEndedIterator::next_back instead of Iterator::last to avoid unnecessary iteration.
2023-08-15 09:47:00 -04:00
cf328b8707 Only create relocations for direct branches 2023-08-09 23:59:26 -04:00
c9eb824034 Emit __init_cpp_exceptions_reference symbols as global 2023-08-07 20:05:19 -04:00
4ee63abea4 Mark autogenerated splits & rework ObjInfo::add_split 2023-08-03 19:18:20 -04:00
f06a6ffbdd Ignore ABS symbols in ObjSymbols::for_range
- Add ObjSymbols::iter_ordered for all symbols (including ABS)
- Extract duplicated logic into ObjSymbols::for_relocation
2023-08-03 19:04:17 -04:00
8660984d40 Improve prologue/epilogue detection 2023-08-03 18:51:15 -04:00
b267b79f7b Fix string detection overwriting known symbols 2023-08-03 18:50:27 -04:00
0fa0aafaea 6 months of occasional work I guess 2023-07-21 17:59:07 -04:00
830f7b172f Reorganize files; start RSO support; config & split updates 2023-01-27 23:15:52 -05:00