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

Initial Support for Callbacks #3

Open
ameily opened this issue Aug 11, 2022 · 1 comment
Open

Initial Support for Callbacks #3

ameily opened this issue Aug 11, 2022 · 1 comment
Assignees

Comments

@ameily
Copy link
Contributor

ameily commented Aug 11, 2022

Add some initial support for lifting callback functions, which will entail:

  • Lift the actual callback function and make sure it is not removed by DCE
  • Update function calls that register the callback, for example:
    // original code
    atexit(&my_callback);
    // lifted code
    atexit(&lifted_my_callback);

This initial support will target atexit with the goal of having it extensible for other callbacks.

@ameily ameily self-assigned this Aug 11, 2022
@ameily
Copy link
Contributor Author

ameily commented Aug 17, 2022

I pushed my work in progress branch, which is currently broken, to support-callbacks. There are two new passes:

  • globalize_function_addresses - identifies potential funciton pointer values and makes them global variables named Callback_<address>
  • replace_local_function_pointers - for each global callback address variable, find uses, and replace the use with the lifted function's address

The lifting is crashing for a sample that uses atexit which I believe is because the cast from function to i32 is incorrect.

@michaelbrownuc michaelbrownuc transferred this issue from another repository Nov 17, 2022
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

1 participant