-
Notifications
You must be signed in to change notification settings - Fork 479
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
libmcount: support no-plt binary #1820
Conversation
I need to refresh my memory on this. Please expect some delays.. |
4b712b5
to
cd2f88c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a quick glance, it looks good. Let me test it more..
@@ -93,6 +93,7 @@ int arch_load_dynsymtab_noplt(struct uftrace_symtab *dsymtab, struct uftrace_elf | |||
pr_dbg3("[%zd] %c %lx + %-5u %s\n", dsymtab->nr_sym, sym->type, sym->addr, | |||
sym->size, sym->name); | |||
} | |||
sort_dynsymtab(dsymtab); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change can be applied separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, actually I meant the sort_dynsymtab()
only. I think you can split the changes in the following way.
- add
sort_dynsymtab()
at the end ofarch_load_dynsymtab_noplt()
. It's an independent issue and can go separately. - add
arch_load_dynsymtab_noplt()
toload_dynsymtab()
. This should have no effect to normal PLT binaries. - check PLT with additional skip symbols and read from
.rela.dyn
.
2561230
to
4893696
Compare
73dda35
to
ad939be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, can you update the TBU part in the first commit message?
|
||
for (size_t i = 0; i < jmprel_nr; i += (is_rela ? sizeof(Elf64_Rela) : sizeof(Elf64_Rel))) { | ||
bool found = false; | ||
Elf64_Rela *rel = (void *)jmprel_addr + i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer having a blank line after the declaration.
028f43b
to
5ad537b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please rebase your changes onto the current master? It's already encouraged to do so (at least for uftrace) when you update your branch, thanks!
Issue reported that no-plt binary is handled as plt-enable binary because some functions are still left in plt section. The patch fixes this bug by comparing the name of self with a list of known functions. Fixes: namhyung#1777 Signed-off-by: ChoKyuWon <[email protected]>
`load_dynsymtab` only loaded the dynamic symbols from `dynsym` and PLTs(`.rel(a).plt` and `.plt`). this commit fixes it to call the `arch_load_dynsymtab_noplt` in the `load_dynsymtab`, so it also loads the dynamic symbols from the `rel(a).dyn`, which normally saves the symbols in case of no-plt option. Signed-off-by: ChoKyuWon <[email protected]>
Sorry about the long delay. |
Issue #1777 reported that no-plt binary is handled as plt-enable binary because some functions are still left in plt section. The patch fixes this bug by comparing the name of self with a list of known functions.