diff options
| author | Stefan Boberg <[email protected]> | 2026-03-17 19:52:50 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-17 19:52:50 +0100 |
| commit | 581903063c4f9ea68200c47bfbc5d16746a4c5c6 (patch) | |
| tree | 2cdf093a9765911a7496f567db642fd90e311fc8 /src | |
| parent | Fix two potential SIGSEGV paths during early startup (diff) | |
| parent | Suppressed C5105 when building rpmalloc (#852) (diff) | |
| download | zen-sb/compute-batch.tar.xz zen-sb/compute-batch.zip | |
Merge branch 'main' into sb/compute-batchsb/compute-batch
Diffstat (limited to 'src')
| -rw-r--r-- | src/zencore/include/zencore/memory/fmalloc.h | 11 | ||||
| -rw-r--r-- | src/zencore/xmake.lua | 4 | ||||
| -rw-r--r-- | src/zenserver/xmake.lua | 18 |
3 files changed, 24 insertions, 9 deletions
diff --git a/src/zencore/include/zencore/memory/fmalloc.h b/src/zencore/include/zencore/memory/fmalloc.h index 0c183cfd0..c50a9729c 100644 --- a/src/zencore/include/zencore/memory/fmalloc.h +++ b/src/zencore/include/zencore/memory/fmalloc.h @@ -9,6 +9,7 @@ // Detect if any sanitizers are enabled. #if defined(__has_feature) +// Clang: query each sanitizer individually # if __has_feature(address_sanitizer) # define ZEN_ADDRESS_SANITIZER 1 # endif @@ -21,8 +22,14 @@ # if __has_feature(leak_sanitizer) # define ZEN_LEAK_SANITIZER 1 # endif -#elif defined(__SANITIZE_ADDRESS__) // For Windows -# define ZEN_ADDRESS_SANITIZER 1 +#else +// MSVC and GCC: check predefined macros set by the compiler when sanitizers are active +# if defined(__SANITIZE_ADDRESS__) // MSVC (ASAN only), GCC +# define ZEN_ADDRESS_SANITIZER 1 +# endif +# if defined(__SANITIZE_THREAD__) // GCC +# define ZEN_THREAD_SANITIZER 1 +# endif #endif #if !defined(ZEN_ADDRESS_SANITIZER) diff --git a/src/zencore/xmake.lua b/src/zencore/xmake.lua index 171f4c533..b08975df1 100644 --- a/src/zencore/xmake.lua +++ b/src/zencore/xmake.lua @@ -21,7 +21,7 @@ target('zencore') add_deps("rpmalloc") end - if has_config("zenmimalloc") then + if has_config("zenmimalloc") and not use_asan then add_packages("mimalloc") end @@ -47,7 +47,7 @@ target('zencore') {public=true} ) - if has_config("zensentry") then + if has_config("zensentry") and not use_asan then add_packages("sentry-native") if is_os("windows") then diff --git a/src/zenserver/xmake.lua b/src/zenserver/xmake.lua index 394745211..b619c5548 100644 --- a/src/zenserver/xmake.lua +++ b/src/zenserver/xmake.lua @@ -39,11 +39,11 @@ target("zenserver") add_packages("oidctoken") add_packages("nomad") - if has_config("zenmimalloc") then + if has_config("zenmimalloc") and not use_asan then add_packages("mimalloc") end - if has_config("zensentry") then + if has_config("zensentry") and not use_asan then add_packages("sentry-native") end @@ -142,11 +142,19 @@ target("zenserver") table.insert(args, "--detach=false") + -- On Windows the ASAN runtime is a DLL whose directory must be on PATH; + -- runenvs.make collects that (and any other Windows package run envs). + local addenvs, setenvs + if is_host("windows") then + import("private.action.run.runenvs") + addenvs, setenvs = runenvs.make(target) + end + -- debugging? if option.get("debug") then - debugger.run(targetfile, args, {curdir = rundir}) + debugger.run(targetfile, args, {curdir = rundir, addenvs = addenvs, setenvs = setenvs}) else - os.execv(targetfile, args, {curdir = rundir, detach = option.get("detach")}) + os.execv(targetfile, args, {curdir = rundir, detach = option.get("detach"), addenvs = addenvs, setenvs = setenvs}) end end) @@ -177,7 +185,7 @@ target("zenserver") end end - if has_config("zensentry") then + if has_config("zensentry") and not target:policy("build.sanitizer.address") then local pkg = target:pkg("sentry-native") if pkg then local installdir = pkg:installdir() |