[PATCH] D104556: [InstrProfiling] Make CountersPtr in __profd_ relative

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 11:05:28 PDT 2021


MaskRay created this revision.
Herald added subscribers: wenlei, pengfei, hiraditya.
MaskRay requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

Since a `__profc_` variable is either private or linkonce/linkonce_odr hidden,
we can change `CountersPtr` in `__profd_` to a label difference.

  # ELF: R_X86_64_PC64 (PC-relative)
  .quad .L__profc_foo-.L__profd_foo
  
  # Mach-O: a pair of 8-byte X86_64_RELOC_UNSIGNED and X86_64_RELOC_SUBTRACTOR
  .quad l___profc_foo-l___profd_foo
  
  # COFF: currently not representable, because IMAGE_REL_AMD64_REL32 does not have a 64-bit counterpart
  .quad .L__profc_foo-.L__profd_foo


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104556

Files:
  compiler-rt/include/profile/InstrProfData.inc
  compiler-rt/lib/profile/InstrProfilingMerge.c
  llvm/include/llvm/ProfileData/InstrProfData.inc
  llvm/lib/ProfileData/InstrProfReader.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/icall.ll
  llvm/test/Instrumentation/InstrProfiling/profiling.ll
  llvm/test/Transforms/PGOProfile/comdat_internal.ll
  llvm/test/Transforms/PGOProfile/memcpy.ll
  llvm/test/tools/llvm-profdata/raw-32-bits-be.test
  llvm/test/tools/llvm-profdata/raw-32-bits-le.test
  llvm/test/tools/llvm-profdata/raw-64-bits-be.test
  llvm/test/tools/llvm-profdata/raw-64-bits-le.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104556.353055.patch
Type: text/x-patch
Size: 14564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210618/db5bdfef/attachment.bin>


More information about the llvm-commits mailing list