[all-commits] [llvm/llvm-project] 33a7b4: [InstrProfiling] Use external weak reference for b...

Petr Hosek via All-commits all-commits at lists.llvm.org
Thu Jul 1 15:26:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33a7b4d9d8e6a113108aa71ed78ca32a83c68523
      https://github.com/llvm/llvm-project/commit/33a7b4d9d8e6a113108aa71ed78ca32a83c68523
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-07-01 (Thu, 01 Jul 2021)

  Changed paths:
    M compiler-rt/lib/profile/CMakeLists.txt
    M compiler-rt/lib/profile/InstrProfiling.h
    R compiler-rt/lib/profile/InstrProfilingBiasVar.c
    M compiler-rt/lib/profile/InstrProfilingFile.c
    M compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll

  Log Message:
  -----------
  [InstrProfiling] Use external weak reference for bias variable

We need the compiler generated variable to override the weak symbol of
the same name inside the profile runtime, but using LinkOnceODRLinkage
results in weak symbol being emitted which leads to an issue where the
linker might choose either of the weak symbols potentially disabling the
runtime counter relocation.

This change replaces the use of weak definition inside the runtime with
an external weak reference to address the issue. We also place the
compiler generated symbol inside a COMDAT group so dead definition can
be garbage collected by the linker.

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




More information about the All-commits mailing list