[PATCH] D54136: Prioritize the constructor call of __local_xray_dyninit()
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 18:55:47 PST 2018
krytarowski created this revision.
krytarowski added reviewers: dberris, joerg.
krytarowski added a project: Sanitizers.
Herald added a subscriber: llvm-commits.
krytarowski retitled this revision from "Priority the constructor call of __local_xray_dyninit()" to "Prioritize the constructor call of __local_xray_dyninit()".
For platforms without preinit support (such as NetBSD/amd64) the
initialization routine __xray_init() was called in non-deterministic
compared to other constructors. This caused breakage failures
as xray routines attempted to execute code with assumption of
being initialized, which was no always true.
Use GCC/Clang extension to set maximal priority to the constructor
calling __xray_init(). This code switches away from C++ lambda form,
as it did not allow to specify this compiler extension.
Repository:
rL LLVM
https://reviews.llvm.org/D54136
Files:
lib/xray/xray_init.cc
Index: lib/xray/xray_init.cc
===================================================================
--- lib/xray/xray_init.cc
+++ lib/xray/xray_init.cc
@@ -106,8 +106,8 @@
#else
// If we cannot use the .preinit_array section, we should instead use dynamic
// initialisation.
-static bool UNUSED __local_xray_dyninit = [] {
+__attribute__ ((constructor (0)))
+static void __local_xray_dyninit() {
__xray_init();
- return true;
-}();
+}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54136.172700.patch
Type: text/x-patch
Size: 447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181106/e5ba2c4f/attachment.bin>
More information about the llvm-commits
mailing list