diff options
| author | ruki <[email protected]> | 2025-06-21 22:35:36 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-21 22:35:36 +0800 |
| commit | 821fb017575b8e2bbff260a9c29fa2f4a74991a6 (patch) | |
| tree | 5659fc8f52b03ebe17ac42ed3ec2043b3de34975 | |
| parent | 9da165f03d6967aa1c82836527eb22702745421a (diff) | |
| parent | 749d449e2ff77f43771467b986aa203546f3a808 (diff) | |
Merge pull request #6567 from DownerCase/msvc-no-link-fsanitize-flag
Do not add -fsanitize flags to msvc linker
| -rw-r--r-- | xmake/core/package/package.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/c++/build_sanitizer/config.lua | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index df2be796c..9a1835950 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -2431,7 +2431,8 @@ function _instance:_generate_sanitizer_configs(checkmode, sourcekind) end -- add ldflags and shflags - if self:has_tool("ld", "link", "clang", "clangxx", "gcc", "gxx") then + -- msvc does not have an fsanitize linker flag, so the 'link' tool is excluded + if self:has_tool("ld", "clang", "clangxx", "gcc", "gxx") then configs.ldflags = "-fsanitize=" .. checkmode configs.shflags = "-fsanitize=" .. checkmode end diff --git a/xmake/rules/c++/build_sanitizer/config.lua b/xmake/rules/c++/build_sanitizer/config.lua index b2480eb73..1a82090fe 100644 --- a/xmake/rules/c++/build_sanitizer/config.lua +++ b/xmake/rules/c++/build_sanitizer/config.lua @@ -41,7 +41,8 @@ function _add_build_sanitizer(target, sourcekind, checkmode) end -- add ldflags and shflags - if target:has_tool("ld", "link", "clang", "clangxx", "gcc", "gxx") then + -- msvc does not have an fsanitize linker flag, so the 'link' tool is excluded + if target:has_tool("ld", "clang", "clangxx", "gcc", "gxx") then target:add("ldflags", "-fsanitize=" .. checkmode, {force = true}) target:add("shflags", "-fsanitize=" .. checkmode, {force = true}) end |
