[PATCH] D38993: [XRay] [compiler-rt] [DSO] start deciding which symbols to hide/export
Martin Pelikán via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 13 01:56:13 PDT 2018
pelikan updated this revision to Diff 142357.
pelikan added a comment.
sync & add a failing test
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D38993
Files:
lib/xray/CMakeLists.txt
lib/xray/xray.syms
lib/xray/xray.vers
test/xray/TestCases/Posix/symbol-visibility.cc
Index: test/xray/TestCases/Posix/symbol-visibility.cc
===================================================================
--- /dev/null
+++ test/xray/TestCases/Posix/symbol-visibility.cc
@@ -0,0 +1,25 @@
+// Test to check if XRay runtime symbols have the expected visibility.
+//
+// RUN: %clangxx_xray -fuse-ld=gold -fxray-instrument %s -Wl,-verbose -v -o %t
+// RUN: %llvm_objdump -t %t | FileCheck %s
+//
+// XXX STILL WORK IN PROGRESS!
+//
+// REQUIRES: linux && fixing lld
+// XFAIL: (until the corresponding clang change in D45570 is committed)
+
+[[clang::xray_always_instrument]] int main() { return 0; }
+
+// CHECK: SYMBOL TABLE:
+// CHECK: _ZN6__xray13XRayArgLoggerE
+// CHECK: _ZN6__xray22XRayPatchedCustomEventE
+// CHECK: _ZN6__xray19XRayPatchedFunctionE
+// CHECK-NOT: __xray_FunctionEntry
+// CHECK-NOT: __xray_FunctionExit
+// CHECK-NOT: __xray_FunctionTailExit
+// CHECK-NOT: __xray_ArgLoggerEntry
+// CHECK-NOT: __xray_CustomEvent
+// CHECK-NOT: __start_xray_instr_map
+// CHECK-NOT: __stop_xray_instr_map
+// CHECK-NOT: __start_xray_fn_index
+// CHECK-NOT: __stop_xray_fn_index
Index: lib/xray/xray.vers
===================================================================
--- /dev/null
+++ lib/xray/xray.vers
@@ -0,0 +1,23 @@
+{
+global:
+ extern "C++" {
+ __xray::XRayPatchedCustomEvent;
+ __xray::XRayPatchedFunction;
+ __xray::XRayArgLogger;
+ };
+ XRayInitialized;
+local:
+ extern "C++" {
+ __xray::DSOContext;
+ };
+ __start_xray_instr_map;
+ __start_xray_fn_index;
+ __stop_xray_instr_map;
+ __stop_xray_fn_index;
+ __xray_ArgLoggerEntry;
+ __xray_FunctionEntry;
+ __xray_FunctionExit;
+ __xray_FunctionTailExit;
+ __xray_CustomEvent;
+ __xray_patch;
+};
Index: lib/xray/xray.syms
===================================================================
--- /dev/null
+++ lib/xray/xray.syms
@@ -0,0 +1,8 @@
+{
+ extern "C++" {
+ __xray::XRayPatchedCustomEvent;
+ __xray::XRayPatchedFunction;
+ __xray::XRayArgLogger;
+ };
+ XRayInitialized;
+};
Index: lib/xray/CMakeLists.txt
===================================================================
--- lib/xray/CMakeLists.txt
+++ lib/xray/CMakeLists.txt
@@ -132,6 +132,18 @@
DEFS ${XRAY_COMMON_DEFINITIONS}
OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS} RTXray
PARENT_TARGET xray)
+ set(syms ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/libclang_rt.xray-${arch}.a.syms)
+ set(vers ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/libclang_rt.xray-${arch}.a.vers)
+ add_custom_command(TARGET xray
+ COMMAND /bin/cp xray.syms ${syms}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ VERBATIM)
+ add_custom_command(TARGET xray
+ COMMAND /bin/cp xray.vers ${vers}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ VERBATIM)
+ install(FILES ${syms} ${vers}
+ DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
# FDR mode runtime archive (addon for clang_rt.xray)
add_compiler_rt_runtime(clang_rt.xray-fdr
STATIC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38993.142357.patch
Type: text/x-patch
Size: 2939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180413/b8364cce/attachment.bin>
More information about the llvm-commits
mailing list