OSDN Git Service

[profile] Solaris ld supports __start___llvm_prof_data etc. labels
authorRainer Orth <ro@gcc.gnu.org>
Thu, 20 Jun 2019 21:27:06 +0000 (21:27 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Thu, 20 Jun 2019 21:27:06 +0000 (21:27 +0000)
commit8f6eb8bd5e5fc2a7d9d7f41d288b5fb5e1d8b5dc
tree43f7a7f2c32b5d853cca4f58a80cd1ec8f471f35
parent483f92d9806c22358a32fa04742e072c3f4f7ee7
[profile] Solaris ld supports __start___llvm_prof_data etc. labels

Currently, many profiling tests on Solaris FAIL like

  Command Output (stderr):
  --
  Undefined                       first referenced
   symbol                             in file
  __llvm_profile_register_names_function /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o
  __llvm_profile_register_function    /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o

Solaris 11.4 ld supports the non-standard GNU ld extension of adding
__start_SECNAME and __stop_SECNAME labels to sections whose names are valid
as C identifiers.  Given that we already use Solaris 11.4-only features
like ld -z gnu-version-script-compat and fully working .preinit_array
support in compiler-rt, we don't need to worry about older versions of
Solaris ld.

The patch documents that support (although the comment in
lib/Transforms/Instrumentation/InstrProfiling.cpp
(needsRuntimeRegistrationOfSectionRange) is quite cryptic what it's
actually about), and adapts the affected testcase not to expect the
alternativeq __llvm_profile_register_functions and __llvm_profile_init.
It fixes all affected tests.

Tested on amd64-pc-solaris2.11.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363984 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/InstrProfiling.cpp
test/Instrumentation/InstrProfiling/platform.ll