DynamoRIO / DynamoRIO/dynamorio
Support statically linking multiple clients with application
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
DR's application API (`dr_app_*`) allows an app to start and stop running under DR. We may want to statically link multiple clients with the application, and control which client to use at starting.
On Linux, we could use the weak symbol trick.
Each client has two symbols:
- a global symbol `dr****_client_main` is the actual initialization function.
- a weak symbol `dr_client_main` either be alias to the `dr****_client_main` or a function simply calls `dr****_client_main`.
By doing that, each client can run separately.
When linking with an application, we can implement a global symbol `dr_client_main` in the app to override all the other `dr_client_main` in the clients, and pick which client initialization function to run by calling the corresponding `dr****_client_main`.
We may be able to use command line linker option to add `dr****_client_main` as the alias of `dr_client_main` in the client to minimal the change (need more investigation).
On Windows, there is no weak symbol. We may need use `__declspec(selectany)` to achieve similar goal.
Contributor guide
Assessment
This issue has not been assessed yet.