[PATCH] D35789: [XRay][compiler-rt] Do not print the warning when the binary is not XRay instrumented.
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 00:23:04 PDT 2017
dberris updated this revision to Diff 108591.
dberris added a comment.
- fixup: reduce to minimum viable change
https://reviews.llvm.org/D35789
Files:
lib/xray/xray_init.cc
test/xray/TestCases/Linux/quiet-start.cc
test/xray/lit.cfg
Index: test/xray/lit.cfg
===================================================================
--- test/xray/lit.cfg
+++ test/xray/lit.cfg
@@ -31,6 +31,11 @@
('%clangxx_xray', build_invocation(clang_xray_cxxflags)))
config.substitutions.append(
('%llvm_xray', llvm_xray))
+config.substitutions.append(
+ ('%xraylib',
+ ('-lm -lpthread -ldl -lrt -L%s '
+ '-Wl,-whole-archive -lclang_rt.xray-%s -Wl,-no-whole-archive')
+ % (config.compiler_rt_libdir, config.host_arch)))
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
Index: test/xray/TestCases/Linux/quiet-start.cc
===================================================================
--- /dev/null
+++ test/xray/TestCases/Linux/quiet-start.cc
@@ -0,0 +1,19 @@
+// Ensure that we have a quiet startup when we don't have the XRay
+// instrumentation sleds.
+//
+// RUN: %clangxx -std=c++11 %s -o %t %xraylib
+// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1" %run %t 2>&1 | \
+// RUN: FileCheck %s --check-prefix NOISY
+// RUN: XRAY_OPTIONS="patch_premain=true verbosity=0" %run %t 2>&1 | \
+// RUN: FileCheck %s --check-prefix QUIET
+#include <iostream>
+
+using namespace std;
+
+int main(int, char**) {
+ // NOISY: {{.*}}XRay instrumentation map missing. Not initializing XRay.
+ // QUIET-NOT: {{.*}}XRay instrumentation map missing. Not initializing XRay.
+ cout << "Hello, XRay!" << endl;
+ // NOISY-NEXT: Hello, XRay!
+ // QUIET: Hello, XRay!
+}
Index: lib/xray/xray_init.cc
===================================================================
--- lib/xray/xray_init.cc
+++ lib/xray/xray_init.cc
@@ -49,7 +49,8 @@
void __xray_init() XRAY_NEVER_INSTRUMENT {
initializeFlags();
if (__start_xray_instr_map == nullptr) {
- Report("XRay instrumentation map missing. Not initializing XRay.\n");
+ if (common_flags()->verbosity)
+ Report("XRay instrumentation map missing. Not initializing XRay.\n");
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35789.108591.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170728/5e8c9a9f/attachment.bin>
More information about the llvm-commits
mailing list