Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace binary blob extab(index) with linker-generated sections #107

Open
riptl opened this issue Aug 3, 2021 · 1 comment
Open

Replace binary blob extab(index) with linker-generated sections #107

riptl opened this issue Aug 3, 2021 · 1 comment
Labels
decomp PRs that add decompiled code p-low question Further information is requested

Comments

@riptl
Copy link
Collaborator

riptl commented Aug 3, 2021

The linker is supposed to generate the extab and extabindex sections.

Since we don't have the source code to do that, we used binary blob .s files to recreate them.
This is where the first problem occurs. The linker segfaults when feeding it object files with existing extab / extabindex sections.
As a workaround, the sections were renamed to extab_ / extabindex_.

The second problem is the symbol _eti_init_info.
This is a linker-generated symbol. Trying to reference it when using the extab_ hack instead of actual extab is also going to make the linker crash.

So as another workaround, I've defined _eti_init_info_ with a hardcoded address.

I feel like we should work towards the root problem: Fixing extab and extabindex in the object files with some magic, so that the linker has no problem generating its exception-related symbols and sections.

I'm not sure on this but I think if we don't do this, we're not going to have C++ runtime exception support.

@riptl riptl added question Further information is requested p-low decomp PRs that add decompiled code labels Aug 3, 2021
@riidefi
Copy link
Owner

riidefi commented Aug 3, 2021

Really excellent writeup. I think this will be relatively low priority as the game itself makes no use of C++ exceptions--the vast majority of the unwind tables were accidentally generated by the RFL library. Hopefully once we get that split, generating the tables will be relatively simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decomp PRs that add decompiled code p-low question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants