[llvm] r363984 - [profile] Solaris ld supports __start___llvm_prof_data etc. labels

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 14:27:06 PDT 2019


Author: ro
Date: Thu Jun 20 14:27:06 2019
New Revision: 363984

URL: http://llvm.org/viewvc/llvm-project?rev=363984&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
    llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=363984&r1=363983&r2=363984&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Thu Jun 20 14:27:06 2019
@@ -713,7 +713,8 @@ static bool needsRuntimeRegistrationOfSe
     return false;
   // Use linker script magic to get data/cnts/name start/end.
   if (TT.isOSLinux() || TT.isOSFreeBSD() || TT.isOSNetBSD() ||
-      TT.isOSFuchsia() || TT.isPS4CPU() || TT.isOSWindows())
+      TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS4CPU() ||
+      TT.isOSWindows())
     return false;
 
   return true;

Modified: llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll?rev=363984&r1=363983&r2=363984&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll (original)
+++ llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll Thu Jun 20 14:27:06 2019
@@ -42,19 +42,16 @@ declare void @llvm.instrprof.increment(i
 ; MACHO-NOT: define internal void @__llvm_profile_register_functions
 ; LINUX-NOT: define internal void @__llvm_profile_register_functions
 ; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
+; SOLARIS-NOT: define internal void @__llvm_profile_register_functions
 ; PS4-NOT: define internal void @__llvm_profile_register_functions
 ; WINDOWS-NOT: define internal void @__llvm_profile_register_functions
 
 ;; PR38340: When dynamic registration is used, we had a bug where we'd register
 ;; something that's not a __profd_* variable.
 
-; SOLARIS: define internal void @__llvm_profile_register_functions
-; SOLARIS-NOT: __llvm_profile_runtime_user
-; SOLARIS: ret void
-
 ; MACHO-NOT: define internal void @__llvm_profile_init
 ; LINUX-NOT: define internal void @__llvm_profile_init
 ; FREEBSD-NOT: define internal void @__llvm_profile_init
+; SOLARIS-NOT: define internal void @__llvm_profile_init
 ; PS4-NOT: define internal void @__llvm_profile_init
 ; WINDOWS-NOT: define internal void @__llvm_profile_init
-; SOLARIS: define internal void @__llvm_profile_init




More information about the llvm-commits mailing list