[llvm-branch-commits] [Driver] Propagate -no-canonical-prefixes to clang-linker-wrapper (PR #184161)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 2 07:52:50 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This is necessary to support build environments where the toolchain
binaries are symlinks to files in a CAS. These environments will already
pass -no-canonical-prefixes, but it is currently not propagated through
clang-linker-wrapper, resulting in clang-linker-wrapper failing to find
other binaries that it needs to invoke.
---
Full diff: https://github.com/llvm/llvm-project/pull/184161.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+4)
- (modified) clang/test/Driver/hip-options.hip (+9)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7e544bd1042ea..8f8ee28897bd4 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9558,6 +9558,10 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
}
}
+ // Propagate -no-canonical-prefixes.
+ if (Args.hasArg(options::OPT_no_canonical_prefixes))
+ CmdArgs.push_back("--no-canonical-prefixes");
+
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("clang-linker-wrapper"));
diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip
index a6a66034f13de..2b4ae61122fbe 100644
--- a/clang/test/Driver/hip-options.hip
+++ b/clang/test/Driver/hip-options.hip
@@ -88,6 +88,15 @@
// HIPTHINLTO-NOT: "-cc1"{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-flto-unit"
// HIPTHINLTO: clang-linker-wrapper{{.*}} "--device-compiler=amdgcn-amd-amdhsa=-flto=thin"
+// Check -no-canonical-prefixes is propagated correctly.
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
+// RUN: --cuda-gpu-arch=gfx906 -foffload-lto=thin -fwhole-program-vtables -no-canonical-prefixes %s 2>&1 \
+// RUN: | FileCheck -check-prefix=HIPTHINLTO-NO-CANON-PREFIXES %s
+
+// Ensure that we invoke clang-linker-wrapper with --no-canonical-prefixes
+// HIPTHINLTO-NO-CANON-PREFIXES: clang-linker-wrapper{{.*}} "--no-canonical-prefixes"
+
// Check that -flto=thin is handled correctly, particularly with -fwhole-program-vtables.
//
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
``````````
</details>
https://github.com/llvm/llvm-project/pull/184161
More information about the llvm-branch-commits
mailing list