https://github.com/mgcarrasco created https://github.com/llvm/llvm-project/pull/183529
The AMD path doesn't use spirv-link, and the driver was incorrectly adding flags for it, which broke the build. The regression was introduced in https://github.com/llvm/llvm-project/commit/1870f3face71d6da2bc0095f751dd1b961b7e4c0. Without this PR's fix, the following assertion is triggered [here](https://github.com/llvm/llvm-project/blob/aa3d6b37c7945bfb4c261dd994689de2a2de25bf/clang/lib/Driver/ToolChains/HIPAMD.cpp#L43) when the LLVM bitcode is linked because unexpected flags are forwarded: ```clang::driver::InputInfo::getFilename() const: Assertion `isFilename() && "Invalid accessor."' failed.``` >From 2ed19405e01d6198c25c58dc9f054ea4a27113ee Mon Sep 17 00:00:00 2001 From: Manuel Carrasco <[email protected]> Date: Thu, 26 Feb 2026 07:59:28 -0600 Subject: [PATCH] [Driver][SPIRV] Fix SPIR-V build for AMD. The AMD path doesn't use spirv-link, and the driver was incorrectly adding flags for it, which broke the build. --- clang/lib/Driver/ToolChains/Clang.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 0aa93e2e46814..7eafa1395b131 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -9374,8 +9374,11 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, // For SPIR-V, pass some extra flags to `spirv-link`, the out-of-tree // SPIR-V linker. `spirv-link` isn't called in LTO mode so restrict these // flags to normal compilation. - if (TC->getTriple().isSPIRV() && !C.getDriver().isUsingLTO() && - !C.getDriver().isUsingOffloadLTO()) { + // SPIR-V for AMD doesn't use spirv-link and therefore doesn't need these + // flags. + if (TC->getTriple().isSPIRV() && + TC->getTriple().getVendor() != llvm::Triple::VendorType::AMD && + !C.getDriver().isUsingLTO() && !C.getDriver().isUsingOffloadLTO()) { // For SPIR-V some functions will be defined by the runtime so allow // unresolved symbols in `spirv-link`. LinkerArgs.emplace_back("--allow-partial-linkage"); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
