Support symolization of PIE binaries in memprof. We assume that the
profiled binary has one executable text segment for simplicity. Update
the memprof-pic test to now expect the same output as the memprof-basic test.
Details
- Reviewers
tejohnson - Commits
- rGcef71d0105c5: [memprof] Support symbolization of PIE binaries.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/ProfileData/RawMemProfReader.cpp | ||
---|---|---|
283 | Is this limitation going to affect us? | |
291 | Is it expected that p_vaddr will not be page boundary aligned already? | |
297 | I think it might be clearer to report this error in the above loop. Otherwise when reading that code it is a little confusing why PreferredTextSegmentAddress will be overwritten for each executable segment. Similar suggestion when setting ProfiledTextSegment{Start,End} in setupForSymbolization | |
581 | I'm a little confused on the difference between PreferredTextSegmentAddress and ProfiledTextSegmentStart, and the arithmetic being done here. Can you clarify? |
PTAL, thanks!
llvm/lib/ProfileData/RawMemProfReader.cpp | ||
---|---|---|
283 | No, the systems we care about default to 4K. Notable exceptions include newer versions of Darwin which use 16K. See a similar assumption made in llvm-profgen [1]. https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-profgen/ProfiledBinary.cpp#L316 | |
291 | It most likely will be page (or 2M hugepage aligned) already. The default is to align by 4K [1] and this should almost always be a no-op since even 2M aligned is also 4K aligned. [1] https://github.com/llvm/llvm-project/blob/main/lld/ELF/Target.h#L112 | |
581 | For non-PIE binaries: For PIE binaries: Added comments to the code to clarify. |
lgtm. Couple suggestions for asserts if you think they make sense.
llvm/lib/ProfileData/RawMemProfReader.cpp | ||
---|---|---|
291 | Consider making this an assert that it is already page aligned? | |
581 | Thanks, the new comment helps. Perhaps add an assert somewhere like: |
Is this limitation going to affect us?