Skip to content

Fix a bug where the patcher mistakes local names for hooks#25

Open
pants64DS wants to merge 1 commit intoDirbaio:masterfrom
pants64DS:master
Open

Fix a bug where the patcher mistakes local names for hooks#25
pants64DS wants to merge 1 commit intoDirbaio:masterfrom
pants64DS:master

Conversation

@pants64DS
Copy link
Copy Markdown

When compiling the following ASM patch, GCC emits _ZZ13hook_0200da08vE1a as a symbol for variable a.

extern "C" void Test(int* a);
asm("Test:\n bx lr");

void hook_0200da08()
{
	static int a = 0;
	Test(&a);
}

Before this fix, the patcher mistook that for a hook and tried to make a branch from the hook address to the variable. Using a lambda in a hook function could also lead to the same problem.

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