[all-commits] [llvm/llvm-project] 697084: [compiler-rt/profile] Hide __llvm_profile_raw_version
pirama-arumuga-nainar via All-commits
all-commits at lists.llvm.org
Fri Oct 15 12:08:29 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 69708477be258dbea2711f6a35c02685659b49d3
https://github.com/llvm/llvm-project/commit/69708477be258dbea2711f6a35c02685659b49d3
Author: Pirama Arumuga Nainar <pirama at google.com>
Date: 2021-10-15 (Fri, 15 Oct 2021)
Changed paths:
M compiler-rt/lib/profile/InstrProfiling.h
M compiler-rt/lib/profile/InstrProfilingVersionVar.c
Log Message:
-----------
[compiler-rt/profile] Hide __llvm_profile_raw_version
Hide __llvm_profile_raw_version so as not to resolve reference from a
dependent shared object. Since libclang_rt.profile is added later in
the command line, a definition of __llvm_profile_raw_version is not
included if it is provided from an earlier object, e.g. from a shared
dependency.
This causes an extra dependence edge where if libA.so depends on libB.so
and both are coverage-instrumented, libA.so uses libB.so's definition of
__llvm_profile_raw_version. This leads to a runtime link failure if the
libB.so available at runtime does not provide this symbol (but provides
the other dependent symbols). Such a scenario can occur in Android's
mainline modules.
E.g.:
ld -o libB.so libclang_rt.profile-x86_64.a
ld -o libA.so -l B libclang_rt.profile-x86_64.a
libB.so has a global definition of __llvm_profile_raw_version. libA.so
uses libB.so's definition of __llvm_profile_raw_version. At runtime,
libB.so may not be coverage-instrumented (i.e. not export
__llvm_profile_raw_version) so runtime linking of libA.so will fail.
Marking this symbol as hidden forces each binary to use the definition
of __llvm_profile_raw_version from libclang_rt.profile.
Differential Revision: https://reviews.llvm.org/D111759
More information about the All-commits
mailing list