112 Commits

Author SHA1 Message Date
68f4552e44 Better support for SMG/TP maps
These maps are post-processed and have
various issues. This includes some hacks
to work around those issues as much as
possible.
2024-09-29 12:02:26 -06:00
ac45676770 Fixes for updated object crate
object stopped including the ELF null
symbol and null section in the respective
iterators. We relied on this behavior for
building certain vectors in order of
symbol index. Adjust this logic to
restore the correct behavior.
2024-09-29 12:00:44 -06:00
0719c73ef8 Resolve clippy issue 2024-09-09 20:39:54 -06:00
cfcd146dfa Add map config for generating symbols/splits
Useful for extracting information from
map files that aren't fully well-formed,
such as ones from existing decompilation
projects.
2024-09-09 20:38:25 -06:00
8b793b5616 Update CI workflow & all dependencies 2024-09-09 20:36:18 -06:00
9dfdbb9301 Fix v1-2 REL alignment regression
Alignment after section data and
before relocations / import table
is exclusive to REL v3.
2024-09-05 00:26:14 -06:00
d9817f63d5 Fix .note.split warnings for older mwld versions
Prior to mwld GC 3.0a3, the linker doesn't support ELF .note sections
properly. With GC 2.7, it crashes if the section type is SHT_NOTE.
Use the same section type as .mwcats.* so the linker ignores it.
2024-09-04 19:56:22 -06:00
Chippy
a112eb1829
DWARF: Add PureVirtual/Virtual Block2 attributes (#70) 2024-08-26 17:41:25 -07:00
b6a29fa910 Add split order attribute for manual reordering
Example in splits.txt:
```
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.
2024-08-11 20:38:11 -06:00
Wesley Moret
da6a514fac
RSO: make command (#67)
Allow to create rso file from relocatable elf

No sel file support yet
2024-08-06 21:15:03 -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
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
b44aa78c49 Fix REL alignment after section data 2024-06-10 00:38:06 -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
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
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 2024-05-17 07:12:05 -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
c45f37eb10 Update ppc750cl (10x faster!) & upgrade deps 2024-04-30 20:40:14 -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
a156c3697f Appease clippy 2024-04-03 00:18:16 -06:00
ccfbfd1a5a Fix for jumptable naming in RELs 2024-04-03 00:12:46 -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.
2024-03-04 18:12:20 -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
Chippy
807dc6a440
Rename and output GCC extensions (#40)
Outputs GCC Source Info extensions
Add asm language to support DWARF emitted by MWCC MIPS assembler
Update MwOverlayBranch handling
2024-02-20 20:56:49 -07:00
1superchip
2784859c4f
Handle more CompileUnit attributes in DWARF (#38)
* Handle more DWARF CompileUnit attributes

Handle comp_dir and add two unknown attributes

* Remove comment about unknown attributes
2024-02-19 16:13:35 -07:00
4a84975648 dol apply: Don't apply gap symbols
Also don't overwrite "unknown" scope
with global.

Fixes #30
2024-01-24 23:23:05 -07:00
f71931838c Sanitize '$' in split filenames
Fixes #29
2024-01-24 23:08:45 -07:00
7b7c8ce251 Add noexport attr to symbols.txt
Rename `auto_force_active` to `export_all`.
This is a better solution to code_merging, as
individual functions can be marked `noexport`.
2024-01-14 13:58:18 -07:00
968f50ebed Add auto_force_active option (disable to support -code_merging)
Fixes #13
2024-01-13 21:54:10 -07:00
Benjamin Moir
5a3256b2b6
Infer anonymous unions from type layout (#26)
* Infer anonymous unions from type layout

* Add comments to signify inferred types

* Improve union detection

* Fix some output weirdness

* Handle some more anonymous union edge cases

* Change union offset validation

* Skip anonymous unions with less than 2 members.
2024-01-13 21:42:39 -07:00
Benjamin Moir
9f8c55efe9
Support anonymous type names as seen in PS2 DWARF (#25) 2024-01-07 08:36:34 -07:00
Benjamin Moir
6b59c677d4
Add support for MwOverlayBranch (#24)
* Add support for MwOverlayBranch

* Make clippy happy

* cargo fmt
2024-01-07 08:02:01 -07:00
58b6d7c7d5 Avoid duplicate unit names when auto-splitting
Fixes #20
2024-01-06 21:57:42 -07:00
458d0599f5 dwarf dump: Emit address range for compile units and functions 2024-01-06 17:51:09 -07:00
d9612cc9b7 Analyzer improvements for ProDG (WIP)
Fixes #19
2024-01-06 16:05:04 -07:00
8e7de9588f cargo fmt 2024-01-06 10:29:51 -07:00
3bcfaef4fe Zero out relocations before disassembling
Fixes an issue where an addi with relocation
can be disassembled as subi
2024-01-06 10:28:01 -07:00
Benjamin Moir
dd23fef4f7
Support some more MetroWerkz DWARF extensions (#22)
* Support FT_MW_int128

* Support OP_MW_FPREG

* Support AT_MW_mangled on local variables

* cargo fmt

---------

Co-authored-by: Luke Street <luke@street.dev>
2024-01-02 10:33:07 -07:00