[PATCH] D129107: [BOLT][HUGIFY] adds huge pages support of PIE/no-PIE binaries
Rafael Auler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 25 18:00:37 PDT 2022
rafauler added a comment.
I tried to repro your test case and I can't actually get it to work, then I realized that the problem is the -fPIE flag to build hugify.cpp. This is also a good reason why we probably should put a special 'pie' test case here (a new line in user-func-reorder.c that also builds it with -pie). If we had that, we would more easily detect this problem earlier in the review.
Here's the problem. If you are going to build hugify.cpp with -fPIE, you have to use the same trick that @yota9 used here https://github.com/llvm/llvm-project/commit/af58da4ef3fbd766b2c44cfdbdb859a21022d10a (reviewed here https://github.com/facebookincubator/BOLT/pull/192).
When building a PIE object file, the compiler will address data objects through a GOT table, and our rudimentary linker that brings in hugify.o into the final binary is unable to properly handle GOT table creation. So, at least in my environment, when I try to run BOLT with hugify option using as input a PIE binary, I end up with hugify trying to copy the wrong start pointers because we failed to create runtime relocations to fix the addresses in the GOT table.
Hopefully by using the "#pragma GCC visibility push(hidden)" trick, you should easily fix this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129107/new/
https://reviews.llvm.org/D129107
More information about the llvm-commits
mailing list