summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-05-25 21:48:58 +0800
committerGitHub <[email protected]>2026-05-25 21:48:58 +0800
commitde6bbeb47e1fe7b4c658807fdefd33739717609d (patch)
tree9323eed29912940b376b8253f696fb72e147fa6f
parentcc78b6e1448d464cc12c804df3b19b674c9ea0d6 (diff)
parent351ff30cc9dcc449af12344d1945f2af15fd699b (diff)
Merge pull request #7561 from DavidWang19/fix/clang-cl-lto-regression
Fix LTO regression for clang-cl introduced in #7525
-rw-r--r--xmake/core/package/package.lua4
-rw-r--r--xmake/rules/c++/config/optimization.lua4
2 files changed, 4 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 2a263f65b..2cf65f2a4 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2426,9 +2426,9 @@ function _instance:_generate_lto_configs(sourcekind)
if sourcekind then
local _, cc = self:tool(sourcekind)
local cflag = sourcekind == "cxx" and "cxxflags" or "cflags"
- if cc == "cl" or cc == "clang_cl" then
+ if cc == "cl" then
configs[cflag] = "-GL"
- elseif cc == "clang" or cc == "clangxx" or cc:startswith("zig") then
+ elseif cc == "clang" or cc == "clangxx" or cc == "clang_cl" or cc:startswith("zig") then
configs[cflag] = "-flto=thin"
elseif cc == "gcc" or cc == "gxx" then
configs[cflag] = "-flto"
diff --git a/xmake/rules/c++/config/optimization.lua b/xmake/rules/c++/config/optimization.lua
index 3df0be36c..6931c39fe 100644
--- a/xmake/rules/c++/config/optimization.lua
+++ b/xmake/rules/c++/config/optimization.lua
@@ -33,9 +33,9 @@ function _add_lto_optimization(target, sourcekind)
mxx = "mxxflags"
}
local cflag = flagnames[sourcekind] or (sourcekind == "cxx" and "cxxflags" or "cflags")
- if cc == "cl" or cc == "clang_cl" then
+ if cc == "cl" then
target:add(cflag, "-GL")
- elseif cc == "clang" or cc == "clangxx" or cc:startswith("zig") then
+ elseif cc == "clang" or cc == "clangxx" or cc == "clang_cl" or cc:startswith("zig") then
target:add(cflag, "-flto=thin")
elseif cc == "gcc" or cc == "gxx" then
target:add(cflag, "-flto")