-
Notifications
You must be signed in to change notification settings - Fork 39
Add Windows ASAN support for x64 and ARM64 #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -325,10 +325,35 @@ if (COMPILER_IS_GCC_OR_CLANG) | |||||||||||||||||||||||||||||||||
| # -fsanitize=* flags, because check_cxx_compiler_flag will report it's | ||||||||||||||||||||||||||||||||||
| # unsupported, because it causes the build to fail if not used when linking. | ||||||||||||||||||||||||||||||||||
| if (ENABLE_SANITIZERS) | ||||||||||||||||||||||||||||||||||
| if (MSVC AND WTF_CPU_X86_64) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_LIBRARY clang_rt.asan_dynamic_runtime_thunk-x86_64 ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_RT_LIBRARY clang_rt.asan_dynamic-x86_64 PATHS ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "\"${CLANG_ASAN_LIBRARY}\" \"${CLANG_ASAN_RT_LIBRARY}\"") | ||||||||||||||||||||||||||||||||||
| if (MSVC) | ||||||||||||||||||||||||||||||||||
| # Auto-discover CLANG_LIB_PATH from the compiler if not explicitly set | ||||||||||||||||||||||||||||||||||
| if (NOT CLANG_LIB_PATH OR CLANG_LIB_PATH STREQUAL "") | ||||||||||||||||||||||||||||||||||
| execute_process( | ||||||||||||||||||||||||||||||||||
| COMMAND ${CMAKE_CXX_COMPILER} /clang:--print-resource-dir | ||||||||||||||||||||||||||||||||||
| OUTPUT_VARIABLE _CLANG_RESOURCE_DIR | ||||||||||||||||||||||||||||||||||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||||||||||||||||||||||||||||||||||
| ERROR_QUIET | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| if (_CLANG_RESOURCE_DIR) | ||||||||||||||||||||||||||||||||||
| set(CLANG_LIB_PATH "${_CLANG_RESOURCE_DIR}/lib/windows") | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (WTF_CPU_X86_64) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_LIBRARY clang_rt.asan_dynamic_runtime_thunk-x86_64 PATHS ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_RT_LIBRARY clang_rt.asan_dynamic-x86_64 PATHS ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| elseif (WTF_CPU_ARM64) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_LIBRARY clang_rt.asan_dynamic_runtime_thunk-aarch64 PATHS ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| find_library(CLANG_ASAN_RT_LIBRARY clang_rt.asan_dynamic-aarch64 PATHS ${CLANG_LIB_PATH}) | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+342
to
+348
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider explicit error for unsupported architectures. If Optional: Add explicit architecture check if (WTF_CPU_X86_64)
find_library(CLANG_ASAN_LIBRARY clang_rt.asan_dynamic_runtime_thunk-x86_64 PATHS ${CLANG_LIB_PATH})
find_library(CLANG_ASAN_RT_LIBRARY clang_rt.asan_dynamic-x86_64 PATHS ${CLANG_LIB_PATH})
elseif (WTF_CPU_ARM64)
find_library(CLANG_ASAN_LIBRARY clang_rt.asan_dynamic_runtime_thunk-aarch64 PATHS ${CLANG_LIB_PATH})
find_library(CLANG_ASAN_RT_LIBRARY clang_rt.asan_dynamic-aarch64 PATHS ${CLANG_LIB_PATH})
+ else ()
+ message(FATAL_ERROR "ASAN on MSVC is only supported for x86_64 and ARM64 architectures.")
endif ()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (CLANG_ASAN_LIBRARY AND CLANG_ASAN_RT_LIBRARY) | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "\"${CLANG_ASAN_LIBRARY}\" \"${CLANG_ASAN_RT_LIBRARY}\"") | ||||||||||||||||||||||||||||||||||
| message(STATUS "Found ASAN libraries: ${CLANG_ASAN_LIBRARY} ${CLANG_ASAN_RT_LIBRARY}") | ||||||||||||||||||||||||||||||||||
| else () | ||||||||||||||||||||||||||||||||||
| message(FATAL_ERROR "ASAN libraries not found at CLANG_LIB_PATH=${CLANG_LIB_PATH}. " | ||||||||||||||||||||||||||||||||||
| "Ensure LLVM is installed with ASAN runtime libraries for this architecture.") | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| else () | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "-lpthread") | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
|
|
@@ -337,14 +362,21 @@ if (COMPILER_IS_GCC_OR_CLANG) | |||||||||||||||||||||||||||||||||
| if (${SANITIZER} MATCHES "address") | ||||||||||||||||||||||||||||||||||
| WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS("-fno-omit-frame-pointer -fno-optimize-sibling-calls") | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_COMPILER_FLAGS "-fsanitize=address ${SANITIZER_COMPILER_FLAGS}") | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "-fsanitize=address ${SANITIZER_LINK_FLAGS}") | ||||||||||||||||||||||||||||||||||
| # On MSVC (clang-cl), CMake passes linker flags directly to lld-link which | ||||||||||||||||||||||||||||||||||
| # doesn't understand -fsanitize=. The ASAN .lib files are already in | ||||||||||||||||||||||||||||||||||
| # SANITIZER_LINK_FLAGS from the find_library block above. | ||||||||||||||||||||||||||||||||||
| if (NOT MSVC) | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "-fsanitize=address ${SANITIZER_LINK_FLAGS}") | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| elseif (${SANITIZER} MATCHES "undefined") | ||||||||||||||||||||||||||||||||||
| # Please keep these options synchronized with Tools/sanitizer/ubsan.xcconfig | ||||||||||||||||||||||||||||||||||
| WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS("-fno-omit-frame-pointer -fno-delete-null-pointer-checks -fno-optimize-sibling-calls") | ||||||||||||||||||||||||||||||||||
| # -fsanitize=vptr is disabled because incompatible with -fno-rtti | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_COMPILER_FLAGS "-fsanitize=undefined -fno-sanitize=vptr ${SANITIZER_COMPILER_FLAGS}") | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "-fsanitize=undefined ${SANITIZER_LINK_FLAGS}") | ||||||||||||||||||||||||||||||||||
| if (NOT MSVC) | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_LINK_FLAGS "-fsanitize=undefined ${SANITIZER_LINK_FLAGS}") | ||||||||||||||||||||||||||||||||||
| endif () | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| elseif (${SANITIZER} MATCHES "thread" AND NOT MSVC) | ||||||||||||||||||||||||||||||||||
| set(SANITIZER_COMPILER_FLAGS "-fsanitize=thread ${SANITIZER_COMPILER_FLAGS}") | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,6 +45,15 @@ $output = if ($env:WEBKIT_OUTPUT_DIR) { $env:WEBKIT_OUTPUT_DIR } else { "bun-web | |||||||||||||||||||||||||||||||||||||||||||
| $WebKitBuild = if ($env:WEBKIT_BUILD_DIR) { $env:WEBKIT_BUILD_DIR } else { "WebKitBuild" } | ||||||||||||||||||||||||||||||||||||||||||||
| $CMAKE_BUILD_TYPE = if ($env:CMAKE_BUILD_TYPE) { $env:CMAKE_BUILD_TYPE } else { "Release" } | ||||||||||||||||||||||||||||||||||||||||||||
| $BUN_WEBKIT_VERSION = if ($env:BUN_WEBKIT_VERSION) { $env:BUN_WEBKIT_VERSION } else { $(git rev-parse HEAD) } | ||||||||||||||||||||||||||||||||||||||||||||
| $ENABLE_SANITIZERS = if ($env:ENABLE_SANITIZERS) { $env:ENABLE_SANITIZERS } else { "" } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # When sanitizers are enabled, force asserts on. Otherwise leave as AUTO (CMake default). | ||||||||||||||||||||||||||||||||||||||||||||
| if ($ENABLE_SANITIZERS) { | ||||||||||||||||||||||||||||||||||||||||||||
| Write-Host ":: Sanitizers enabled: $ENABLE_SANITIZERS" | ||||||||||||||||||||||||||||||||||||||||||||
| $ENABLE_ASSERTS = "ON" | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| $ENABLE_ASSERTS = "AUTO" | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Build ICU statically (idempotent - skips if already built) | ||||||||||||||||||||||||||||||||||||||||||||
| $ICU_STATIC_ROOT = Join-Path $WebKitBuild "icu" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -62,9 +71,15 @@ $env:PATH = $PathWithPerl | |||||||||||||||||||||||||||||||||||||||||||
| $env:CFLAGS = "/Zi" | ||||||||||||||||||||||||||||||||||||||||||||
| $env:CXXFLAGS = "/Zi" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| $CmakeMsvcRuntimeLibrary = "MultiThreaded" | ||||||||||||||||||||||||||||||||||||||||||||
| if ($CMAKE_BUILD_TYPE -eq "Debug") { | ||||||||||||||||||||||||||||||||||||||||||||
| $CmakeMsvcRuntimeLibrary = "MultiThreadedDebug" | ||||||||||||||||||||||||||||||||||||||||||||
| # clang-cl's ASAN does not support debug CRT (/MTd, /MDd) — only release CRT (/MT, /MD). | ||||||||||||||||||||||||||||||||||||||||||||
| # Always use static release CRT (/MT) for ASAN builds regardless of build type. | ||||||||||||||||||||||||||||||||||||||||||||
| if ($ENABLE_SANITIZERS) { | ||||||||||||||||||||||||||||||||||||||||||||
| $CmakeMsvcRuntimeLibrary = "MultiThreaded" | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| $CmakeMsvcRuntimeLibrary = "MultiThreaded" | ||||||||||||||||||||||||||||||||||||||||||||
| if ($CMAKE_BUILD_TYPE -eq "Debug") { | ||||||||||||||||||||||||||||||||||||||||||||
| $CmakeMsvcRuntimeLibrary = "MultiThreadedDebug" | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+74
to
83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Minor: Redundant assignment in non-ASAN path. Line 79 sets This works correctly but could be simplified: Optional simplification } else {
- $CmakeMsvcRuntimeLibrary = "MultiThreaded"
if ($CMAKE_BUILD_TYPE -eq "Debug") {
$CmakeMsvcRuntimeLibrary = "MultiThreadedDebug"
+ } else {
+ $CmakeMsvcRuntimeLibrary = "MultiThreaded"
}
}📝 Committable suggestion
Suggested change
🧰 Tools🪛 PSScriptAnalyzer (1.24.0)[warning] Missing BOM encoding for non-ASCII encoded file 'windows-release.ps1' (PSUseBOMForUnicodeEncodedFile) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| $NoWebassembly = if ($env:NO_WEBASSEMBLY) { $env:NO_WEBASSEMBLY } else { $false } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -75,6 +90,7 @@ $WebAssemblyState = if ($NoWebassembly) { "OFF" } else { "ON" } | |||||||||||||||||||||||||||||||||||||||||||
| if ($Platform -eq "ARM64") { | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangPath = "C:/LLVM/bin/clang-cl.exe" | ||||||||||||||||||||||||||||||||||||||||||||
| $LldLinkPath = "C:/LLVM/bin/lld-link.exe" | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangLibPath = "C:/LLVM/lib/clang" | ||||||||||||||||||||||||||||||||||||||||||||
| # Note: The LLVM SEH unwind bug on Windows ARM64 (llvm/llvm-project#47432) is worked | ||||||||||||||||||||||||||||||||||||||||||||
| # around by disabling the probe functionality in MacroAssemblerARM64.cpp rather than | ||||||||||||||||||||||||||||||||||||||||||||
| # using compiler flags. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -84,38 +100,68 @@ if ($Platform -eq "ARM64") { | |||||||||||||||||||||||||||||||||||||||||||
| $ClangPath = "clang-cl" | ||||||||||||||||||||||||||||||||||||||||||||
| $LldLinkPath = "lld-link" | ||||||||||||||||||||||||||||||||||||||||||||
| $ARM64SehWorkaround = "" | ||||||||||||||||||||||||||||||||||||||||||||
| # Discover the LLVM lib path from the scoop-installed clang-cl | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangFullPath = (Get-Command clang-cl -ErrorAction SilentlyContinue).Source | ||||||||||||||||||||||||||||||||||||||||||||
| if ($ClangFullPath) { | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangLibPath = Join-Path (Split-Path (Split-Path $ClangFullPath)) "lib/clang" | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangLibPath = "" | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| cmake -S . -B $WebKitBuild ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DPORT="JSCOnly" ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_STATIC_JSC=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DUSE_THIN_ARCHIVES=OFF ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_JIT=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_DFG_JIT=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_FTL_JIT=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_WEBASSEMBLY_BBQJIT=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_WEBASSEMBLY_OMGJIT=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_SAMPLING_PROFILER=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_WEBASSEMBLY=${WebAssemblyState}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DUSE_BUN_JSC_ADDITIONS=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DUSE_BUN_EVENT_LOOP=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_ROOT=${ICU_STATIC_ROOT}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_LIBRARY=${ICU_STATIC_LIBRARY}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_INCLUDE_DIR=${ICU_STATIC_INCLUDE_DIR}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_COMPILER=${ClangPath}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_COMPILER=${ClangPath}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_LINKER=${LldLinkPath}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG /DU_STATIC_IMPLEMENTATION ${ARM64SehWorkaround}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG /DU_STATIC_IMPLEMENTATION /clang:-fno-c++-static-destructors ${ARM64SehWorkaround}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_FLAGS_DEBUG=/Zi /FS /O0 /Ob0 /DU_STATIC_IMPLEMENTATION ${ARM64SehWorkaround}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_FLAGS_DEBUG=/Zi /FS /O0 /Ob0 /DU_STATIC_IMPLEMENTATION /clang:-fno-c++-static-destructors ${ARM64SehWorkaround}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| -DENABLE_REMOTE_INSPECTOR=ON ` | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_MSVC_RUNTIME_LIBRARY=${CmakeMsvcRuntimeLibrary}" ` | ||||||||||||||||||||||||||||||||||||||||||||
| -G Ninja | ||||||||||||||||||||||||||||||||||||||||||||
| # TODO: "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" ` | ||||||||||||||||||||||||||||||||||||||||||||
| # Discover the ASAN runtime library path for CMake | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangRtLibPath = "" | ||||||||||||||||||||||||||||||||||||||||||||
| if ($ENABLE_SANITIZERS -and $ClangLibPath) { | ||||||||||||||||||||||||||||||||||||||||||||
| # Find the versioned directory (e.g., lib/clang/21/lib/windows) | ||||||||||||||||||||||||||||||||||||||||||||
| $versionDirs = Get-ChildItem -Path $ClangLibPath -Directory -ErrorAction SilentlyContinue | Sort-Object Name -Descending | ||||||||||||||||||||||||||||||||||||||||||||
| foreach ($vdir in $versionDirs) { | ||||||||||||||||||||||||||||||||||||||||||||
| $candidate = Join-Path $vdir.FullName "lib/windows" | ||||||||||||||||||||||||||||||||||||||||||||
| if (Test-Path $candidate) { | ||||||||||||||||||||||||||||||||||||||||||||
| $ClangRtLibPath = $candidate | ||||||||||||||||||||||||||||||||||||||||||||
| Write-Host ":: Found Clang runtime lib path: $ClangRtLibPath" | ||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| $cmakeArgs = @( | ||||||||||||||||||||||||||||||||||||||||||||
| "-S", ".", | ||||||||||||||||||||||||||||||||||||||||||||
| "-B", $WebKitBuild, | ||||||||||||||||||||||||||||||||||||||||||||
| "-DPORT=JSCOnly", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_STATIC_JSC=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DUSE_THIN_ARCHIVES=OFF", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_JIT=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_DFG_JIT=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_FTL_JIT=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_WEBASSEMBLY_BBQJIT=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_WEBASSEMBLY_OMGJIT=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_SAMPLING_PROFILER=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_WEBASSEMBLY=${WebAssemblyState}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DUSE_BUN_JSC_ADDITIONS=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DUSE_BUN_EVENT_LOOP=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_ROOT=${ICU_STATIC_ROOT}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_LIBRARY=${ICU_STATIC_LIBRARY}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DICU_INCLUDE_DIR=${ICU_STATIC_INCLUDE_DIR}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_COMPILER=${ClangPath}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_COMPILER=${ClangPath}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_LINKER=${LldLinkPath}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG /DU_STATIC_IMPLEMENTATION ${ARM64SehWorkaround}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG /DU_STATIC_IMPLEMENTATION /clang:-fno-c++-static-destructors ${ARM64SehWorkaround}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_C_FLAGS_DEBUG=/Zi /FS /O0 /Ob0 /DU_STATIC_IMPLEMENTATION ${ARM64SehWorkaround}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCMAKE_CXX_FLAGS_DEBUG=/Zi /FS /O0 /Ob0 /DU_STATIC_IMPLEMENTATION /clang:-fno-c++-static-destructors ${ARM64SehWorkaround}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_REMOTE_INSPECTOR=ON", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_SANITIZERS=${ENABLE_SANITIZERS}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DENABLE_ASSERTS=${ENABLE_ASSERTS}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-DCLANG_LIB_PATH=${ClangRtLibPath}", | ||||||||||||||||||||||||||||||||||||||||||||
| "-G", "Ninja" | ||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| $cmakeArgs += "-DCMAKE_MSVC_RUNTIME_LIBRARY=${CmakeMsvcRuntimeLibrary}" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| cmake @cmakeArgs | ||||||||||||||||||||||||||||||||||||||||||||
| if ($LASTEXITCODE -ne 0) { throw "cmake failed with exit code $LASTEXITCODE" } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Workaround for what is probably a CMake bug | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -168,6 +214,19 @@ if ($CMAKE_BUILD_TYPE -eq "Release") { | |||||||||||||||||||||||||||||||||||||||||||
| Copy-Item "$ICU_STATIC_LIBRARY/icuuc.lib" "$output/lib/sicuucd.lib" -Force | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Copy ASAN runtime DLLs to output when sanitizers are enabled | ||||||||||||||||||||||||||||||||||||||||||||
| if ($ENABLE_SANITIZERS -and $ClangRtLibPath) { | ||||||||||||||||||||||||||||||||||||||||||||
| $asanArch = if ($Platform -eq "ARM64") { "aarch64" } else { "x86_64" } | ||||||||||||||||||||||||||||||||||||||||||||
| $asanDll = "clang_rt.asan_dynamic-${asanArch}.dll" | ||||||||||||||||||||||||||||||||||||||||||||
| $asanDllPath = Join-Path $ClangRtLibPath $asanDll | ||||||||||||||||||||||||||||||||||||||||||||
| if (Test-Path $asanDllPath) { | ||||||||||||||||||||||||||||||||||||||||||||
| Copy-Item $asanDllPath "$output/bin/$asanDll" -Force | ||||||||||||||||||||||||||||||||||||||||||||
| Write-Host ":: Copied ASAN runtime DLL: $asanDll" | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| throw "ASAN runtime DLL not found at $asanDllPath" | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Add-Content -Path $output/include/cmakeconfig.h -Value "`#define BUN_WEBKIT_VERSION `"$BUN_WEBKIT_VERSION`"" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Copy-Item -r -Force $WebKitBuild/JavaScriptCore/DerivedSources/* $output/include/JavaScriptCore | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Windows ASAN uses only
addresssanitizer, unlike macOS/Linux which useaddress,undefined.The Windows ASAN entries only enable the
addresssanitizer, while macOS and Linux ASAN builds enable bothaddress,undefined. If this is intentional (e.g., UBSan not fully supported with clang-cl on Windows), consider adding a brief comment explaining the difference for maintainability.The ARM64 exclusion comment is helpful and appreciated.
🤖 Prompt for AI Agents