Skip to content

Commit

Permalink
Merge pull request #93152 from RandomShaper/prebuilt_asan
Browse files Browse the repository at this point in the history
Enable usage of asan-enabled versions of prebuilt libraries
  • Loading branch information
akien-mga committed Jul 2, 2024
2 parents 1ebd12a + d1eebd3 commit abfce31
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ def spawn_capture(sh, escape, cmd, args, env):
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 = [
Expand Down Expand Up @@ -567,17 +575,17 @@ def spawn_capture(sh, escape, cmd, args, env):
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"])
if env["angle_libs"] != "":
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"])
Expand Down Expand Up @@ -613,12 +621,6 @@ def spawn_capture(sh, escape, cmd, args, env):
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
Expand Down

0 comments on commit abfce31

Please sign in to comment.