-
Notifications
You must be signed in to change notification settings - Fork 15k
WIP: [Bolt] Add support for DT_INIT_ARRAY #153196
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
base: main
Are you sure you want to change the base?
Conversation
|
TODO(s):
|
Previously Bolt relied on ELF 'e_entry' field or DT_INIT to determine the entry point of an ELF file for the instrumentation. This PR aims to handle that case if an ELF file only contains DT_INIT_ARRAY/DT_FINI_ARRAY sections. Bolt is hooking its runtime function based on e_entry address if the input is an ELF executable. When the input is a shared object, Bolt takes address of DT_INIT if that exists. If it doesn't, Bolt will use DT_INIT_ARRAY for hooking its runtime functions. This PR follows the implementation of DT_FINI_ARRAY.
|
hello i have come across a similar question . |
|
hello i have applyed for libc.so.6 (have no DT_INIT),but i still failed collect prof because libc.so.6 HasInterpHeader ,SO IN THIS CASE how can i fixed? |
|
i have applyed your pr but still failed when using intrumented libc.so.6 in arm64.it seems the father process exited after __bolt_instr_setup and can not exe __bolt_start_trampoline ,i do not know why |
|
Hi, thanks for your comment and your findings. Glibc is a tricky Elf shared object. It can acts as a binary or as a shared object. The draft solution what I uploaded, distinguishes between whether the ELF file is a binary or a shared object based on presence of the Interp header. So most probably DT_INITARRAY should be used here (if no DT_INIT), instead of e_entry. |
in my case when i apply your pr i have deleted !BC->HasInterpHeader , and i found it still cannot exe bin (who use libc.so.6) successfully but i check that it exe __bolt_instr_setup and can not exe __bolt_start_trampoline but when exe _start in libc.so.6 it failed |
|
|
hi ,sorry to interrupt you , How |
Currently Bolt relies on ELF 'e_entry' field or DT_INIT to determine entry point of an ELF file for the instrumentation. There is a case when an ELF file only has DT_INIT_ARRAY/DT_FINI_ARRAY sections, and ELF 'e_entry' holds zero.