Skip to content

Decompile __init_cpp_exceptions.cpp - #126

Open
vagnertxr wants to merge 1 commit into
doldecomp:mainfrom
vagnertxr:runtime/init-cpp-exceptions
Open

Decompile __init_cpp_exceptions.cpp#126
vagnertxr wants to merge 1 commit into
doldecomp:mainfrom
vagnertxr:runtime/init-cpp-exceptions

Conversation

@vagnertxr

Copy link
Copy Markdown

Matches and links Runtime.PPCEABI.H/__init_cpp_exceptions.cpp, taking the DOL to 508 linked files.

Three things the unit needs beyond the plain translation:

  • cflags_runtime carries no OpenRVL include paths, so ExtabIndexInfo and the __register_fragment/__unregister_fragment prototypes are declared locally rather than pulled from <revolution/OS/__ppc_eabi_init.h>.

  • __register_fragment takes the TOC in r2. An asm helper function is never inlined by mwcc and would emit its own symbol, so the value is read with an inline asm block into a register local, which lowers to the single mr r4, r2 the target has.

  • The unit owns 8 bytes of .sdata, and a lone int leaves the section 4 bytes short, shifting everything after it. Pairing the id with its trailing word reproduces the section byte-for-byte.

The .ctors$10 and .dtors$15 entries are referenced only as data, so the linker discards them unless kept alive; both are added to force_active for the DOL. Without that the build links but main.dol mismatches, with 0x804064E0 holding the wrong pointer.

Verified: ninja reports 127 files OK.

Matches and links the last unwritten Runtime unit, taking the DOL to
508 linked files.

Three things the unit needs beyond the obvious translation:

- cflags_runtime carries no OpenRVL include paths, so ExtabIndexInfo and
  the __register_fragment/__unregister_fragment prototypes are declared
  locally rather than pulled from <revolution/OS/__ppc_eabi_init.h>.

- __register_fragment takes the TOC in r2. An `asm` helper function is
  never inlined by mwcc and would emit its own symbol, so the value is
  read with an inline `asm` block into a `register` local, which lowers
  to the single `mr r4, r2` the target has.

- The unit owns 8 bytes of .sdata, and a lone `int` leaves the section
  4 bytes short, shifting everything after it. Pairing the id with its
  trailing word reproduces the section byte-for-byte.

The .ctors$10 and .dtors$15 entries are referenced only as data, so the
linker discards them unless they are kept alive; both are added to
force_active for the DOL.

Verified: `ninja` reports 127 files OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant