From 68624e45b595753f69201df2a84dee466b05d968 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 8 Jun 2018 04:00:07 +0000 Subject: [XRay][compiler-rt] Remove reliance on C++ ABI features Summary: This fixes http://llvm.org/PR32274. This change adds a test to ensure that we're able to link XRay modes and the runtime to binaries that don't need to depend on the C++ standard library or a C++ ABI library. In particular, we ensure that this will work with C programs compiled+linked with XRay. To make the test pass, we need to change a few things in the XRay runtime implementations to remove the reliance on C++ ABI features. In particular, we change the thread-safe function-local-static initialisation to use pthread_* instead of the C++ features that ensure non-trivial thread-local/function-local-static initialisation. Depends on D47696. Reviewers: dblaikie, jfb, kpw, eizan Reviewed By: kpw Subscribers: echristo, eizan, kpw, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46998 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334262 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/xray/TestCases/Posix/c-test.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/xray/TestCases/Posix/c-test.cc (limited to 'test') diff --git a/test/xray/TestCases/Posix/c-test.cc b/test/xray/TestCases/Posix/c-test.cc new file mode 100644 index 000000000..f8f5775d1 --- /dev/null +++ b/test/xray/TestCases/Posix/c-test.cc @@ -0,0 +1,15 @@ +// RUN: %clang_xray -g -o %t %s +// RUN: rm xray-log.c-test.* || true +// RUN: XRAY_OPTIONS=patch_premain=true:verbosity=1:xray_mode=xray-basic %t \ +// RUN: 2>&1 | FileCheck %s +// RUN: rm xray-log.c-test.* || true +// +// REQUIRES: x86_64-target-arch +// REQUIRES: built-in-llvm-tree +__attribute__((xray_always_instrument)) void always() {} + +int main() { + always(); +} + +// CHECK: =={{[0-9].*}}==XRay: Log file in '{{.*}}' -- cgit v1.2.3