================
@@ -0,0 +1,35 @@
+// End-to-end test for DYLD_INSERT_LIBRARIES injection.
+// Compiles a binary with XRay instrumentation but without the runtime linked,
+// then injects the XRay runtime dylib to discover and patch the sleds.
+
+// Build a dylib containing the XRay runtime:
+// RUN: %clang -shared -o %t.xray-rt.dylib \
+// RUN:   -Wl,-force_load,%xray_rt_path \
+// RUN:   -lc++
+
+// Build target binary with XRay sleds but without XRay runtime:
+// RUN: %clangxx -fxray-instrument -fxray-instruction-threshold=1 
-fno-xray-link-deps \
+// RUN:   %s -o %t.target
+
+// Inject and run — XRay should discover sleds in the host binary:
+// RUN: env DYLD_INSERT_LIBRARIES=%t.xray-rt.dylib \
+// RUN:   XRAY_OPTIONS="patch_premain=true verbosity=1" \
+// RUN:   %run %t.target 2>&1 | FileCheck %s
+
+// REQUIRES: target={{(arm64|x86_64)-apple-.*}}
+
+// CHECK: Registering {{[0-9]+}} new functions
----------------
DanBlackwell wrote:

Could this print `Registering 0 new functions`?

https://github.com/llvm/llvm-project/pull/196848
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to