[PATCH] D113727: [llvm-profgen] Add switch to allow use of first loadable segment for calculating offset
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 09:43:02 PST 2021
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:712
+
+ if (!UseOffset || (UseOffset && UseLoadableSegmentAsBase)) {
+ Start = Binary->offsetToVirtualAddr(Start);
----------------
Wondering if we can avoid changing the code here.
I'm thinking like if we can refactor all `getPreferredBaseAddress` to `getBaseAddress()` or a new function.
Then we have code early in the binary to `setBaseAddress` like:
```
if (UseLoadableSegmentAsBase)
setBaseAddress(getFirstLoadableAddress())
else
setBaseAddress(getPreferredBaseAddress())
```
Then here `Binary->offsetToVirtualAddr(..);` will cover all the offset cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113727/new/
https://reviews.llvm.org/D113727
More information about the llvm-commits
mailing list