[PATCH] D40599: [XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternative
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 14:06:46 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT319366: [XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternative (authored by dberris).
Changed prior to commit:
https://reviews.llvm.org/D40599?vs=124719&id=124813#toc
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D40599
Files:
lib/xray/xray_init.cc
Index: lib/xray/xray_init.cc
===================================================================
--- lib/xray/xray_init.cc
+++ lib/xray/xray_init.cc
@@ -88,8 +88,15 @@
#endif
}
-// Only add the preinit array initialization if the sanitizers can.
#if !defined(XRAY_NO_PREINIT) && SANITIZER_CAN_USE_PREINIT_ARRAY
+// Only add the preinit array initialization if the sanitizers can.
__attribute__((section(".preinit_array"),
used)) void (*__local_xray_preinit)(void) = __xray_init;
+#else
+// If we cannot use the .preinit_array section, we should instead use dynamic
+// initialisation.
+static bool UNUSED __local_xray_dyninit = [] {
+ __xray_init();
+ return true;
+}();
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40599.124813.patch
Type: text/x-patch
Size: 703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171129/dd055875/attachment.bin>
More information about the llvm-commits
mailing list