[clang] [OpenMP][ASan][Driver] Update build steps for OpenMP ASan. (PR #179636)

Amit Kumar Pandey via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 4 05:57:03 PST 2026


================
@@ -631,6 +631,20 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
                                  Args.getLastArgValue(options::OPT_mcpu_EQ))));
   }
   addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs);
+
+  // ASan instrumented OpenMP+Offload libraries are installed in default ROCm
+  // LLVM ASan custom path.
+  // Below code prepends the LLVM ASan custom path to pick ASan instrumented
+  // libompdevice.a.
+  const SanitizerArgs &SanArgs = getToolChain().getSanitizerArgs(Args);
+  if (SanArgs.needsAsanRt()) {
+    const AMDGPUToolChain &AMDGPU =
+        static_cast<const AMDGPUToolChain &>(getToolChain());
+    StringRef ASanPath = Args.MakeArgString(
+        AMDGPU.getRocmInstallationPath().str() + "/lib/llvm/lib/asan");
----------------
ampandey-1995 wrote:

`getAsanRTLPath` returns the absolute path of `asanrtl.bc` bitcode library which is `/opt/rocm/amdgcn/bitcode/asanrtl.bc` . 
The non-asan openmp libompdevice.a is installed in `/opt/rocm/llvm/lib/amdgcn-amd-amdhsa` and asan one in `/opt/rocm/llvm/lib/asan` by default.

I will check again how to avoid hardcoding this for asan. It dosen't happen for non-asan libompdevice.a.

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


More information about the cfe-commits mailing list