Skip to content

Commit a388df7

Browse files
[XRay] Remove reliance on default PIC behavior in DSO tests (#113892)
Compiling with `-fxray-shared` requires position-independent code (introduced in #113548). Some tests do not explicitly specify this, thus falling back to the compiler default. If, for example, Clang is compiled with `-DCLANG_DEFAULT_PIE_ON_LINUX=OFF`, these checks fail. This patch addresses this issue in two tests: - Removing a check in `xray-shared.cpp` that only tests default PIC behavior - Adding `-fPIC` explicitly in `clang-xray-shared.cpp`
1 parent b6a84e7 commit a388df7

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

clang/test/Driver/XRay/xray-shared.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fPIC -fxray-instrument -fxray-shared -c %s -o /dev/null 2>&1 | FileCheck %s
22
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fpic -fxray-instrument -fxray-shared -c %s -o /dev/null 2>&1 | FileCheck %s
3-
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fxray-instrument -fxray-shared -c %s -o /dev/null 2>&1 | FileCheck %s
43
// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fno-PIC -fxray-instrument -fxray-shared -c %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR-PIC
54
// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fno-pic -fxray-instrument -fxray-shared -c %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR-PIC
65

compiler-rt/test/xray/TestCases/Posix/clang-xray-shared.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that the DSO-local runtime library has been linked if -fxray-shared is passed.
22
//
3-
// RUN: %clangxx -fxray-instrument -fxray-shared %s -shared -o %t.so
3+
// RUN: %clangxx -fxray-instrument -fxray-shared -fPIC %s -shared -o %t.so
44
// RUN: llvm-nm %t.so | FileCheck %s --check-prefix ENABLED
55

66
// RUN: %clangxx -fxray-instrument %s -shared -o %t.so

0 commit comments

Comments
 (0)