[PATCH] D97649: [InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 28 17:10:04 PST 2021
MaskRay created this revision.
MaskRay added reviewers: davidxl, phosek.
Herald added a subscriber: hiraditya.
MaskRay requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.
`__llvm_prf_vnodes` and `__llvm_prf_names` are used by runtime but not
referenced via relocation in the translation unit.
With `-z start-stop-gc` (D96914 <https://reviews.llvm.org/D96914> https://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker does not let `__start_/__stop_` references retain them.
Place `__llvm_prf_vnodes` and `__llvm_prf_names` in `llvm.used` to make
them retained by the linker.
This patch changes most existing `UsedVars` cases to `CompilerUsedVars`
to reflect the ideal state - if the binary format properly supports
section based GC (dead stripping), `llvm.compiler.used` should be sufficient.
`__llvm_prf_vnodes` and `__llvm_prf_names` are switched to `UsedVars`
since we want them to be unconditionally retained by both compiler and linker.
Behaviors on other COFF/Mach-O are not affected.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97649
Files:
compiler-rt/test/profile/Linux/instrprof-value-merge.c
llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Instrumentation/InstrProfiling/icall.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97649.327008.patch
Type: text/x-patch
Size: 5757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210301/24bf054f/attachment.bin>
More information about the llvm-commits
mailing list