[PATCH] D103178: [CSSPGO][llvm-profgen] Allow multiple executable load segments.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 09:09:48 PDT 2021


hoy created this revision.
Herald added a subscriber: wenlei.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The linker or post-link optimizer can create an ELF image with multiple
exeutable segments each of which will be loaded separately at run time.
This breaks the assumption of llvm-profgen that currently only supports
one base load address. What it ends up with is that the subsequent mmap events
will be treated as an overwrite of the first mmap event which will
in turn screw up address mapping. While it is non-trivial to support
multiple separate load addresses and given that on x64 those segments
will always be loaded at consecutive addresses (though via separate mmap
sys calls), I'm adding an error checking logic to bail out if that's
violated and keep using a single load address which is the address of
the first executable segment.

Also changing the disassembly output from priting section offset to
priting the virutal address instead, which matches the behavior of objdump.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103178

Files:
  llvm/test/tools/llvm-profgen/Inputs/multi-load-segs.perfbin
  llvm/test/tools/llvm-profgen/Inputs/multi-load-segs.perfscript
  llvm/test/tools/llvm-profgen/Inputs/symbolize.ll
  llvm/test/tools/llvm-profgen/Inputs/symbolize.perfbin
  llvm/test/tools/llvm-profgen/disassemble.s
  llvm/test/tools/llvm-profgen/disassemble.test
  llvm/test/tools/llvm-profgen/mmapEvent.test
  llvm/test/tools/llvm-profgen/multi-load-segs.test
  llvm/test/tools/llvm-profgen/symbolize.ll
  llvm/test/tools/llvm-profgen/symbolize.test
  llvm/tools/llvm-profgen/PerfReader.cpp
  llvm/tools/llvm-profgen/ProfiledBinary.cpp
  llvm/tools/llvm-profgen/ProfiledBinary.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103178.347991.patch
Type: text/x-patch
Size: 26569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210526/8687b195/attachment.bin>


More information about the llvm-commits mailing list