[all-commits] [llvm/llvm-project] 04c304: [InstrProfiling] Place __llvm_prf_vnodes and __llv...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Mar 1 13:43:41 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04c3040f417683e7c31b3ee3381a3263106f48c5
      https://github.com/llvm/llvm-project/commit/04c3040f417683e7c31b3ee3381a3263106f48c5
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

  Changed paths:
    A compiler-rt/test/profile/Linux/Inputs/instrprof-value-merge.c
    A compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c
    M compiler-rt/test/profile/Linux/instrprof-value-merge.c
    M llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/icall.ll

  Log Message:
  -----------
  [InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF

`__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://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker no longer lets `__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.

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




More information about the All-commits mailing list