[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)

Brian Cain via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 14:12:36 PDT 2024


================
@@ -1520,10 +1520,14 @@ bool tools::addSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
 }
 
 bool tools::addXRayRuntime(const ToolChain&TC, const ArgList &Args, ArgStringList &CmdArgs) {
-  if (Args.hasArg(options::OPT_shared))
-    return false;
-
-  if (TC.getXRayArgs().needsXRayRt()) {
+  if (Args.hasArg(options::OPT_shared)) {
+    if (TC.getXRayArgs().needsXRayDSORt()) {
+      CmdArgs.push_back("-whole-archive");
----------------
androm3da wrote:

Why do we use `-whole-archive` here but `--whole-archive` below?  Do `ld` and `ld-alikes` all accept both?  Probably makes more sense to have `--whole-archive` here.

(same goes for `-no-whole-archive` below)

https://github.com/llvm/llvm-project/pull/90959


More information about the cfe-commits mailing list