================
@@ -259,6 +260,45 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
+  // Add sanitizer libraries.
+  const SanitizerArgs &Sanitize = ToolChain.getSanitizerArgs(Args);
+  const char *sanitizer = nullptr;
+  bool NeedsSanitizerDeps = false;
+  // For now, only support address sanitizer.
+  if (Sanitize.needsAsanRt())
+    sanitizer = "AddressSanitizer";
+
+  if (sanitizer) {
+    if (Sanitize.needsSharedRt()) {
+      
ToolChain.getDriver().Diag(diag::err_drv_unsupported_shared_sanitizer_aix)
+          << sanitizer;
+      return;
+    }
+    NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+  }
+
+  // Add sanitizer runtime dependencies.
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+                   options::OPT_shared, options::OPT_r)) {
----------------
daltenty wrote:

It's unclear here why we include `options::OPT_shared`, as that isn't something 
that doesn't seem to happen on any other target. SInce this is special on AIX, 
I think we should add a comment explaining why.

https://github.com/llvm/llvm-project/pull/129925
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to