summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_init.cc
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2016-07-29 07:11:58 +0000
committerDean Michael Berris <dberris@google.com>2016-07-29 07:11:58 +0000
commit17a586e6de8ac3bf5bd49038564662d6a35496a4 (patch)
tree4b2c14aab1ff2df23cd20ad7a5072dac96f1745b /compiler-rt/lib/xray/xray_init.cc
parent8129255e7637b195981a21fcba93a7af0dbdb4a1 (diff)
downloadbcm5719-llvm-17a586e6de8ac3bf5bd49038564662d6a35496a4.tar.gz
bcm5719-llvm-17a586e6de8ac3bf5bd49038564662d6a35496a4.zip
[compiler-rt][XRay] Address follow-up comments to initial interface and initialisation code
This addresses some comments from D21612, which contains the following changes: - Update __xray_patch() and __xray_unpatch() API documentation to not imply asynchrony. - Introduce a scope cleanup mechanism to make sure we can roll-back changes to the XRayPatching global atomic. - Introduce a few more comments for potential extension points for other platforms (for the implementation details of patching and un-patching). Reviewers: eugenis, rnk, kcc, echristo, majnemer Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22911 llvm-svn: 277124
Diffstat (limited to 'compiler-rt/lib/xray/xray_init.cc')
-rw-r--r--compiler-rt/lib/xray/xray_init.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler-rt/lib/xray/xray_init.cc b/compiler-rt/lib/xray/xray_init.cc
index 8c2a5d380c8..e5dc0d9557d 100644
--- a/compiler-rt/lib/xray/xray_init.cc
+++ b/compiler-rt/lib/xray/xray_init.cc
@@ -22,18 +22,20 @@
#include "xray_interface_internal.h"
extern "C" {
-extern void __xray_init();
+void __xray_init();
extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak));
extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak));
}
using namespace __xray;
-// We initialize some global variables that pertain to specific sections of XRay
-// data structures in the binary. We do this for the current process using
-// /proc/curproc/map and make sure that we're able to get it. We signal failure
-// via a global atomic boolean to indicate whether we've initialized properly.
+// When set to 'true' this means the XRay runtime has been initialised. We use
+// the weak symbols defined above (__start_xray_inst_map and
+// __stop_xray_instr_map) to initialise the instrumentation map that XRay uses
+// for runtime patching/unpatching of instrumentation points.
//
+// FIXME: Support DSO instrumentation maps too. The current solution only works
+// for statically linked executables.
std::atomic<bool> XRayInitialized{false};
// This should always be updated before XRayInitialized is updated.
OpenPOWER on IntegriCloud