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
Sort dynamic symbols #507
Sort dynamic symbols #507
Conversation
@romainthomas Hello, please review this change. Thank you! |
Hi @Clcanny |
Hi @romainthomas ,
|
|
What about: https://github.com/llvm/llvm-project/blob/2fc704a0a529dd7eba7566a293f981a86bfa5c3e/lld/ELF/SyntheticSections.cpp#L2081-L2086 ? which seems to avoid two stable_sort ? |
According to llvm, we need to sort dynamic symbol table 2 times:
std::vector<SymbolTableEntry>::iterator mid =
std::stable_partition(v.begin(), v.end(), [&](const SymbolTableEntry &s) {
return !s.sym->isDefined() || s.sym->partition != partition;
});
llvm::stable_sort(symbols, [](const Entry &l, const Entry &r) {
return l.bucketIdx < r.bucketIdx;
}); Besides the above two sorting, we need another sort (3) to find local symbols (null entries). I am going to combine the first sort and the third sort, and do other things to improve my code. Thanks for your guide! |
64ea440
to
1d3a1d9
Compare
@romainthomas Hi, I have changed my code. I think calling And I add a unit test for this change. There is one thing worth noting: size of |
1d3a1d9
to
2da3560
Compare
2da3560
to
50a348e
Compare
Oh yes I mess that. Open a PR with your fixe when it's done |
To be reopened |
Dynamic symbol table of libfoo.so is:
Without this change:
With this change: