[PATCH] D96757: [InstrProfiling] Use ELF section groups for counters, data and values

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 00:41:25 PST 2021


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

C identifier name input sections such as __llvm_prf_* are GC roots so
they cannot be discarded. Putting these into a section group disables
the C identifier name semantics.

The ELF section group semantics ensures that group members are retained
or discarded as a unit. When a function symbol is discarded, this allows
allows linker to discard counters, data and values associated with that
function symbol as well.

Note that `noduplicates` COMDAT is lowered to zero-flag section group in
ELF. We only set this for functions that aren't already in a COMDAT and
for those that don't have available_externally linkage since we already
use regular COMDAT groups for those.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96757

Files:
  compiler-rt/test/CMakeLists.txt
  compiler-rt/test/profile/CMakeLists.txt
  compiler-rt/test/profile/instrprof-gc-sections.c
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/linkage.ll
  llvm/test/Transforms/PGOProfile/counter_promo.ll
  llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96757.323901.patch
Type: text/x-patch
Size: 13344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210216/7a9f6150/attachment.bin>


More information about the llvm-commits mailing list