Merge pull request #93152 from RandomShaper/prebuilt_asan

Enable usage of asan-enabled versions of prebuilt libraries
This commit is contained in:
Rémi Verschelde 2024-07-02 17:27:31 +02:00
commit abfce31ba7
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -500,6 +500,14 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
if env["arch"] == "x86_64":
env.AppendUnique(CPPDEFINES=["_WIN64"])
# Sanitizers
prebuilt_lib_extra_suffix = ""
if env["use_asan"]:
env.extra_suffix += ".san"
prebuilt_lib_extra_suffix = ".san"
env.Append(CCFLAGS=["/fsanitize=address"])
env.Append(LINKFLAGS=["/INFERASANLIBS"])
## Libs
LIBS = [
@ -567,7 +575,7 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
LIBS += ["WinPixEventRuntime"]
env.Append(LIBPATH=[env["mesa_libs"] + "/bin"])
LIBS += ["libNIR.windows." + env["arch"]]
LIBS += ["libNIR.windows." + env["arch"] + prebuilt_lib_extra_suffix]
if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
@ -575,9 +583,9 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
env.AppendUnique(CPPDEFINES=["EGL_STATIC"])
env.Append(LIBPATH=[env["angle_libs"]])
LIBS += [
"libANGLE.windows." + env["arch"],
"libEGL.windows." + env["arch"],
"libGLES.windows." + env["arch"],
"libANGLE.windows." + env["arch"] + prebuilt_lib_extra_suffix,
"libEGL.windows." + env["arch"] + prebuilt_lib_extra_suffix,
"libGLES.windows." + env["arch"] + prebuilt_lib_extra_suffix,
]
LIBS += ["dxgi", "d3d9", "d3d11"]
env.Prepend(CPPPATH=["#thirdparty/angle/include"])
@ -613,12 +621,6 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
env.Prepend(CPPPATH=[p for p in str(os.getenv("INCLUDE")).split(";")])
env.Append(LIBPATH=[p for p in str(os.getenv("LIB")).split(";")])
# Sanitizers
if env["use_asan"]:
env.extra_suffix += ".san"
env.Append(LINKFLAGS=["/INFERASANLIBS"])
env.Append(CCFLAGS=["/fsanitize=address"])
# Incremental linking fix
env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
env["BUILDERS"]["Program"] = methods.precious_program