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

gtirb_rewriting.assembler.assembler.UndefSymbolError: test is an undefined symbol reference #5

Open
Pl0414141 opened this issue Jan 2, 2023 · 1 comment

Comments

@Pl0414141
Copy link

Pl0414141 commented Jan 2, 2023

I am doing binary rewriting on Windows binaries, the tested binary is compiled with Visual Studio 2022 and the dependences are the following:

KERNEL32.dll
VCRUNTIME140.DLL

I have used the following code to load these external libraries and solve the following error:

class NilMsgPass(Pass):
    def begin_module(self, module, functions, context):
        context.get_or_insert_extern_symbol(
            "test", "libraries.dll")
        context.register_insert(
            #AllFunctionsScope(FunctionPosition.ENTRY, BlockPosition.ENTRY),
            SingleBlockScope(module.entry_point, BlockPosition.ENTRY),
            Patch.from_function(self.nop_patch),
        )

    @patch_constraints(x86_syntax=X86Syntax.INTEL)
    def nop_patch(self, context):
        return """
            call test
            ret
        """

but it dont work, any solution?

File "C:\Users\mar\AppData\Local\Programs\Python\Python38\lib\site-packages\gtirb_rewriting-0.1.2.dev0-py3.8.egg\gtirb_rewriting\assembler\assembler.py", line 1458, in _resolve_symbol
gtirb_rewriting.assembler.assembler.UndefSymbolError: test is an undefined symbol reference

@jranieri-grammatech
Copy link
Collaborator

Hi, I apologize for the late reply. Between deadlines and parental leave this sort of fell off my radar.

Is this still a problem you're having? This code looks to be correct.

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

No branches or pull requests

2 participants