[all-commits] [llvm/llvm-project] ae51ec: [Bolt] Solving pie support issue (#65494)

JohnLee1243 via All-commits all-commits at lists.llvm.org
Wed Nov 15 23:05:20 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae51ec84bb9a4cbce6ac2c3a9fddeb6ccd330558
      https://github.com/llvm/llvm-project/commit/ae51ec84bb9a4cbce6ac2c3a9fddeb6ccd330558
  Author: JohnLee1243 <135311387+JohnLee1243 at users.noreply.github.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M bolt/lib/Core/BinaryContext.cpp
    A bolt/test/perf2bolt/Inputs/perf_test.c
    A bolt/test/perf2bolt/Inputs/perf_test.lds
    A bolt/test/perf2bolt/lit.local.cfg
    A bolt/test/perf2bolt/perf_test.test
    M bolt/unittests/Core/BinaryContext.cpp

  Log Message:
  -----------
  [Bolt] Solving pie support issue (#65494)

Now PIE is default supported after clang 14. It cause parsing error when
using perf2bolt. The reason is the base address can not get correctly.
Fix the method of geting base address. If SegInfo.Alignment is not equal
to pagesize, alignDown(SegInfo.FileOffset, SegInfo.Alignment) can not
equal to FileOffset. So the SegInfo.FileOffset and FileOffset should be
aligned by SegInfo.Alignment first and then judge whether they are
equal.
The .text segment's offset from base address in VAS is aligned by
pagesize. So MMapAddress's offset from base address is
alignDown(SegInfo.Address, pagesize) instead of
alignDown(SegInfo.Address, SegInfo.Alignment). So the base address
calculate way should be changed.

Co-authored-by: Li Zhuohang <lizhuohang3 at huawei.com>




More information about the All-commits mailing list