[all-commits] [llvm/llvm-project] 071203: [CSSPGO][llvm-profgen] Allow multiple executable l...

Hongtao Yu via All-commits all-commits at lists.llvm.org
Tue Jul 13 18:22:58 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 071203845887a2ff0347747bd5864f8738d17eef
      https://github.com/llvm/llvm-project/commit/071203845887a2ff0347747bd5864f8738d17eef
  Author: Hongtao Yu <hoy at fb.com>
  Date:   2021-07-13 (Tue, 13 Jul 2021)

  Changed paths:
    A llvm/test/tools/llvm-profgen/Inputs/multi-load-segs.perfbin
    A llvm/test/tools/llvm-profgen/Inputs/multi-load-segs.perfscript
    A llvm/test/tools/llvm-profgen/Inputs/symbolize.ll
    A llvm/test/tools/llvm-profgen/Inputs/symbolize.perfbin
    R llvm/test/tools/llvm-profgen/disassemble.s
    A llvm/test/tools/llvm-profgen/disassemble.test
    M llvm/test/tools/llvm-profgen/mmapEvent.test
    A llvm/test/tools/llvm-profgen/multi-load-segs.test
    R llvm/test/tools/llvm-profgen/symbolize.ll
    A llvm/test/tools/llvm-profgen/symbolize.test
    M llvm/tools/llvm-profgen/PerfReader.cpp
    M llvm/tools/llvm-profgen/PerfReader.h
    M llvm/tools/llvm-profgen/ProfiledBinary.cpp
    M llvm/tools/llvm-profgen/ProfiledBinary.h

  Log Message:
  -----------
  [CSSPGO][llvm-profgen] Allow multiple executable load segments.

The linker or post-link optimizer can create an ELF image with multiple executable 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 printing section offset to printing the virtual address instead, which matches the behavior of objdump.

Differential Revision: https://reviews.llvm.org/D103178




More information about the All-commits mailing list