[PATCH] D41111: [profile] Solaris ld supports __start___llvm_prof_data etc. labels

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 04:43:30 PST 2017


ro created this revision.
ro added reviewers: vsk, bogner.
Herald added a subscriber: fedor.sergeev.

This patch is a companion to https://reviews.llvm.org/D40944.

I've got an experimental version of Solaris ld that does support the non-standard
GNU ld extension of adding __start_SECNAME and __stop_SECNAME labels to 
sections whose names are valid as C identifiers.

It 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 alternativ __llvm_profile_register_functions
and __llvm_profile_init.

I'm posting this patch for reference now, but it's problematic in how to deal with
either older Solaris versions or OpenSolaris derivatives where ld doesn't support 
this extension.


Repository:
  rL LLVM

https://reviews.llvm.org/D41111

Files:
  lib/Transforms/Instrumentation/InstrProfiling.cpp
  test/Instrumentation/InstrProfiling/platform.ll


Index: test/Instrumentation/InstrProfiling/platform.ll
===================================================================
--- test/Instrumentation/InstrProfiling/platform.ll
+++ test/Instrumentation/InstrProfiling/platform.ll
@@ -40,10 +40,10 @@
 ; LINUX-NOT: define internal void @__llvm_profile_register_functions
 ; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
 ; PS4-NOT: define internal void @__llvm_profile_register_functions
-; SOLARIS: define internal void @__llvm_profile_register_functions
+; SOLARIS-NOT: define internal void @__llvm_profile_register_functions
 
 ; MACHO-NOT: define internal void @__llvm_profile_init
 ; LINUX-NOT: define internal void @__llvm_profile_init
 ; FREEBSD-NOT: define internal void @__llvm_profile_init
 ; PS4-NOT: define internal void @__llvm_profile_init
-; SOLARIS: define internal void @__llvm_profile_init
+; SOLARIS-NOT: define internal void @__llvm_profile_init
Index: lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -670,6 +670,7 @@
   // Use linker script magic to get data/cnts/name start/end.
   if (Triple(M.getTargetTriple()).isOSLinux() ||
       Triple(M.getTargetTriple()).isOSFreeBSD() ||
+      Triple(M.getTargetTriple()).isOSSolaris() ||
       Triple(M.getTargetTriple()).isPS4CPU())
     return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41111.126531.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/d74e17dc/attachment.bin>


More information about the llvm-commits mailing list