Base: codex-main originale (prima del fork aKode)
This commit is contained in:
37
patches/BUILD.bazel
Normal file
37
patches/BUILD.bazel
Normal file
@@ -0,0 +1,37 @@
|
||||
exports_files([
|
||||
"opusic_sys_install_headers.patch",
|
||||
"rules_cc_windows_native_llvm.patch",
|
||||
"abseil_windows_gnullvm_thread_identity.patch",
|
||||
"bzip2_windows_stack_args.patch",
|
||||
"llvm_rusty_v8_custom_libcxx.patch",
|
||||
"llvm_windows_arm64_powl.patch",
|
||||
"llvm_windows_mingw_compat.patch",
|
||||
"mxc-sdk_utf8_resources.patch",
|
||||
"rules_rust_build_script_tools_transition.patch",
|
||||
"rules_rust_compiler_thp.patch",
|
||||
"rules_rust_process_wrapper_param_file.patch",
|
||||
"rules_rust_release_build_script_profile.patch",
|
||||
"rules_rust_windows_execroot_separators.patch",
|
||||
"rules_rust_windows_msvc_direct_link_args.patch",
|
||||
"rules_rust_windows_process_wrapper_skip_temp_outputs.patch",
|
||||
"rules_foreign_cc_make_cppflags.patch",
|
||||
"rules_foreign_cc_make_xcompile.patch",
|
||||
"rules_foreign_cc_make_msvc_stdint.patch",
|
||||
"rules_rs_build_script_deps_annotation.patch",
|
||||
"rules_rs_rust_debug_modes.patch",
|
||||
"rules_rs_windows_msvc_linker.patch",
|
||||
"rules_rs_workspace_package_version.patch",
|
||||
"rules_rs_zlib_snapshot_urls.patch",
|
||||
"rusty_v8_prebuilt_out_dir.patch",
|
||||
"ring_windows_msvc_include_dirs.patch",
|
||||
"tikv-jemalloc-sys_make_env.patch",
|
||||
"tikv-jemalloc-sys_dependency_flags.patch",
|
||||
"tonic-zstd-level1.patch",
|
||||
"v8_array_sort_elements_kind.patch",
|
||||
"v8_source_portability.patch",
|
||||
"webrtc-sys_hermetic_darwin_sysroot.patch",
|
||||
"windows-link.patch",
|
||||
"windows-support-remote-case-aliases.patch",
|
||||
"windows-support-native-tools.patch",
|
||||
"xz_windows_stack_args.patch",
|
||||
])
|
||||
16
patches/abseil_windows_gnullvm_thread_identity.patch
Normal file
16
patches/abseil_windows_gnullvm_thread_identity.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
# What: avoid MinGW pthread TLS linkage in Abseil thread identity selection.
|
||||
# Scope: one MinGW-specific preprocessor branch in Abseil's internal
|
||||
# thread-identity mode selection; no other Abseil behavior changes.
|
||||
|
||||
diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h
|
||||
--- a/absl/base/internal/thread_identity.h
|
||||
+++ b/absl/base/internal/thread_identity.h
|
||||
@@ -217,6 +217,8 @@
|
||||
#error ABSL_THREAD_IDENTITY_MODE cannot be directly set
|
||||
#elif defined(ABSL_FORCE_THREAD_IDENTITY_MODE)
|
||||
#define ABSL_THREAD_IDENTITY_MODE ABSL_FORCE_THREAD_IDENTITY_MODE
|
||||
+#elif defined(__MINGW32__)
|
||||
+#define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11
|
||||
#elif defined(_WIN32) && !defined(__MINGW32__)
|
||||
#define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11
|
||||
#elif defined(__APPLE__) && defined(ABSL_HAVE_THREAD_LOCAL)
|
||||
23
patches/bzip2_windows_stack_args.patch
Normal file
23
patches/bzip2_windows_stack_args.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/BUILD.bazel b/BUILD.bazel
|
||||
--- a/BUILD.bazel
|
||||
+++ b/BUILD.bazel
|
||||
@@ -28,4 +28,11 @@ cc_library(
|
||||
defines = [
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
],
|
||||
+ copts = select({
|
||||
+ "@platforms//os:windows": [
|
||||
+ "-fno-stack-protector",
|
||||
+ "-mno-stack-arg-probe",
|
||||
+ ],
|
||||
+ "//conditions:default": [],
|
||||
+ }),
|
||||
includes = ["."],
|
||||
diff --git a/MODULE.bazel b/MODULE.bazel
|
||||
--- a/MODULE.bazel
|
||||
+++ b/MODULE.bazel
|
||||
@@ -4,3 +4,4 @@ module(
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_cc", version = "0.0.10")
|
||||
+bazel_dep(name = "platforms", version = "1.0.0")
|
||||
108
patches/llvm_rusty_v8_custom_libcxx.patch
Normal file
108
patches/llvm_rusty_v8_custom_libcxx.patch
Normal file
@@ -0,0 +1,108 @@
|
||||
diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel
|
||||
index fa00156236..c9e4348172 100644
|
||||
--- a/toolchain/BUILD.bazel
|
||||
+++ b/toolchain/BUILD.bazel
|
||||
@@ -1,5 +1,6 @@
|
||||
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
|
||||
+load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag", "string_setting")
|
||||
load("@rules_cc//cc/toolchains:actions.bzl", "cc_action_type_set")
|
||||
load("@rules_cc//cc/toolchains:artifacts.bzl", "cc_artifact_name_pattern")
|
||||
load("@rules_cc//cc/toolchains/impl:documented_api.bzl", "cc_args_list")
|
||||
@@ -64,6 +65,15 @@ config_setting(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
-
|
||||
+
|
||||
+selects.config_setting_group(
|
||||
+ name = "runtimes_all_with_rusty_v8_custom_libcxx",
|
||||
+ match_all = [
|
||||
+ ":runtimes_all",
|
||||
+ "@@//third_party/v8:use_rusty_v8_custom_libcxx",
|
||||
+ ],
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
config_setting(
|
||||
name = "runtimes_stage1",
|
||||
flag_values = {
|
||||
@@ -270,11 +280,16 @@ cc_args_list(
|
||||
|
||||
# TODO(cerisier): extract those into proper semantic args list.
|
||||
# TODO(zbarsky): This must match llvm/toolchains/llvm.bzl
|
||||
+_DEFAULT_CXXSTDLIB_HEADER_ARGS = select({
|
||||
+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [],
|
||||
+ "//conditions:default": [
|
||||
+ "//toolchain/args:cxxstdlib_headers_include_search_paths",
|
||||
+ ],
|
||||
+})
|
||||
+
|
||||
cc_args_list(
|
||||
name = "linux_toolchain_args",
|
||||
- args = [
|
||||
- "//toolchain/args:cxxstdlib_headers_include_search_paths",
|
||||
- ] + select({
|
||||
+ args = _DEFAULT_CXXSTDLIB_HEADER_ARGS + select({
|
||||
"//platforms/config:musl": [
|
||||
"//toolchain/args/linux:kernel_headers_include_search_paths",
|
||||
"//toolchain/args/linux:musl_libc_headers_include_search_paths",
|
||||
@@ -302,8 +317,7 @@ cc_args_list(
|
||||
# TODO(zbarsky): This must match llvm/toolchains/llvm.bzl
|
||||
cc_args_list(
|
||||
name = "windows_toolchain_args",
|
||||
- args = [
|
||||
- "//toolchain/args:cxxstdlib_headers_include_search_paths",
|
||||
+ args = _DEFAULT_CXXSTDLIB_HEADER_ARGS + [
|
||||
"//toolchain/args/windows:mingw_headers_include_search_paths",
|
||||
],
|
||||
)
|
||||
diff --git a/toolchain/llvm/llvm.bzl b/toolchain/llvm/llvm.bzl
|
||||
index d36d8b94bd..900aa908d5 100644
|
||||
--- a/toolchain/llvm/llvm.bzl
|
||||
+++ b/toolchain/llvm/llvm.bzl
|
||||
@@ -297,18 +297,23 @@ def declare_llvm_targets(*, suffix = ""):
|
||||
],
|
||||
)
|
||||
|
||||
+ default_cxxstdlib_target_headers = select({
|
||||
+ "@llvm//toolchain:runtimes_all_with_rusty_v8_custom_libcxx": [],
|
||||
+ "@llvm//toolchain:runtimes_stage1": [],
|
||||
+ "@llvm//toolchain:runtimes_stage1_hosted": [],
|
||||
+ "@llvm//toolchain:runtimes_none": [],
|
||||
+ "//conditions:default": [
|
||||
+ "@llvm//runtimes/cxxstdlib:headers_include_search_directory",
|
||||
+ "@llvm//runtimes/cxxstdlib:abi_headers_include_search_directory",
|
||||
+ ],
|
||||
+ })
|
||||
+
|
||||
# This must match //toolchain:linux_toolchain_args
|
||||
include_path(
|
||||
name = "linux_target_headers",
|
||||
srcs = [
|
||||
":builtin_resource_dir",
|
||||
- ] + select({
|
||||
- "@llvm//toolchain:runtimes_all": [
|
||||
- "@llvm//runtimes/cxxstdlib:headers_include_search_directory",
|
||||
- "@llvm//runtimes/cxxstdlib:abi_headers_include_search_directory",
|
||||
- ],
|
||||
- "//conditions:default": [],
|
||||
- }) + [
|
||||
+ ] + default_cxxstdlib_target_headers + [
|
||||
"@kernel_headers//:kernel_headers_directory",
|
||||
"@llvm//sanitizers:sanitizers_headers_include_search_directory",
|
||||
] + select({
|
||||
@@ -324,13 +329,7 @@ def declare_llvm_targets(*, suffix = ""):
|
||||
name = "windows_target_headers",
|
||||
srcs = [
|
||||
":builtin_resource_dir",
|
||||
- ] + select({
|
||||
- "@llvm//toolchain:runtimes_all": [
|
||||
- "@llvm//runtimes/cxxstdlib:headers_include_search_directory",
|
||||
- "@llvm//runtimes/cxxstdlib:abi_headers_include_search_directory",
|
||||
- ],
|
||||
- "//conditions:default": [],
|
||||
- }) + [
|
||||
+ ] + default_cxxstdlib_target_headers + [
|
||||
"@mingw//:mingw_generated_headers_crt_directory",
|
||||
"@mingw//:mingw_w64_headers_include_directory",
|
||||
"@mingw//:mingw_w64_headers_crt_directory",
|
||||
25
patches/llvm_windows_arm64_powl.patch
Normal file
25
patches/llvm_windows_arm64_powl.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
# What: provide and link MinGW's ARM64 long-double `powl` compatibility shim.
|
||||
# Why: Windows ARM64 uses 64-bit long doubles, but LLVM's Bazel source list
|
||||
# omits the upstream `powl -> pow` implementation and its default link flags
|
||||
# omit the MinGW extension archive that owns the shim.
|
||||
|
||||
diff --git a/runtimes/mingw/crt_sources.bzl b/runtimes/mingw/crt_sources.bzl
|
||||
--- a/runtimes/mingw/crt_sources.bzl
|
||||
+++ b/runtimes/mingw/crt_sources.bzl
|
||||
@@ -420,4 +420,5 @@
|
||||
MINGWEX_ARM64_SRCS = [
|
||||
+ "math/arm-common/powl.c",
|
||||
"math/sincos.c",
|
||||
"math/sincosf.c",
|
||||
"math/arm-common/sincosl.c",
|
||||
diff --git a/toolchain/args/windows/BUILD.bazel b/toolchain/args/windows/BUILD.bazel
|
||||
--- a/toolchain/args/windows/BUILD.bazel
|
||||
+++ b/toolchain/args/windows/BUILD.bazel
|
||||
@@ -45,5 +45,6 @@ cc_args(
|
||||
args = [
|
||||
"-L{mingw_import_library_search_path}",
|
||||
"-L{mingw_crt_library_search_path}",
|
||||
-
|
||||
+ "-lmingwex",
|
||||
+
|
||||
# Clang will respect the user's chosen CRT variant.
|
||||
50
patches/llvm_windows_mingw_compat.patch
Normal file
50
patches/llvm_windows_mingw_compat.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
# What: provide MinGW compatibility archives required by Windows gnullvm links.
|
||||
# Why: clang and prebuilt MSVC archives can request these names even though the
|
||||
# hermetic MinGW runtime does not publish them by default.
|
||||
|
||||
diff --git a/runtimes/mingw/BUILD.bazel b/runtimes/mingw/BUILD.bazel
|
||||
--- a/runtimes/mingw/BUILD.bazel
|
||||
+++ b/runtimes/mingw/BUILD.bazel
|
||||
@@ -386,14 +386,42 @@ stub_library(
|
||||
name = "stdc++",
|
||||
)
|
||||
|
||||
+# Clang may inject -lssp and -lssp_nonshared for windows-gnu links.
|
||||
+# Provide compatibility archives in the MinGW runtime search directory.
|
||||
+stub_library(
|
||||
+ name = "ssp",
|
||||
+)
|
||||
+
|
||||
+stub_library(
|
||||
+ name = "ssp_nonshared",
|
||||
+)
|
||||
+
|
||||
+# Prebuilt MSVC archives can carry /DEFAULTLIB:libcmt.lib and
|
||||
+# /DEFAULTLIB:oldnames.lib directives. Provide MinGW-compatible stand-ins so
|
||||
+# lld can satisfy the lookup under windows-gnullvm.
|
||||
+stub_library(
|
||||
+ name = "libcmt",
|
||||
+)
|
||||
+
|
||||
+copy_file(
|
||||
+ name = "oldnames",
|
||||
+ src = ":moldname",
|
||||
+ out = "liboldnames.a",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
copy_to_directory(
|
||||
name = "mingw_crt_library_search_directory",
|
||||
srcs = [
|
||||
+ ":libcmt",
|
||||
":m",
|
||||
":mingw32",
|
||||
":mingwex",
|
||||
":moldname",
|
||||
+ ":oldnames",
|
||||
":pthread",
|
||||
+ ":ssp",
|
||||
+ ":ssp_nonshared",
|
||||
":stdc++",
|
||||
":uuid",
|
||||
":winpthread",
|
||||
7
patches/mxc-sdk_utf8_resources.patch
Normal file
7
patches/mxc-sdk_utf8_resources.patch
Normal file
@@ -0,0 +1,7 @@
|
||||
diff --git a/src/mxc-sdk/build/build_mxc_build_common.rs b/src/mxc-sdk/build/build_mxc_build_common.rs
|
||||
--- a/src/mxc-sdk/build/build_mxc_build_common.rs
|
||||
+++ b/src/mxc-sdk/build/build_mxc_build_common.rs
|
||||
@@ -104,2 +104,3 @@ fn embed_version_info_for_binary_windows(
|
||||
let output = compiler
|
||||
+ .arg("/c65001")
|
||||
.arg("/nologo")
|
||||
26
patches/opusic_sys_install_headers.patch
Normal file
26
patches/opusic_sys_install_headers.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
--- a/opus/CMakeLists.txt
|
||||
+++ b/opus/CMakeLists.txt
|
||||
@@ -301,13 +301,22 @@
|
||||
get_library_version(OPUS_LIBRARY_VERSION OPUS_LIBRARY_VERSION_MAJOR)
|
||||
message(DEBUG "Opus library version: ${OPUS_LIBRARY_VERSION}")
|
||||
|
||||
+# Build-script inputs can be relative symlinks. Materialize public headers so
|
||||
+# CMake does not preserve links that become dangling in the install prefix.
|
||||
+foreach(header IN LISTS Opus_PUBLIC_HEADER)
|
||||
+ get_filename_component(header_name "${header}" NAME)
|
||||
+ set(install_header "${CMAKE_CURRENT_BINARY_DIR}/public_headers/${header_name}")
|
||||
+ configure_file("${header}" "${install_header}" COPYONLY)
|
||||
+ list(APPEND Opus_INSTALL_HEADERS "${install_header}")
|
||||
+endforeach()
|
||||
+
|
||||
set_target_properties(opus
|
||||
PROPERTIES SOVERSION
|
||||
${OPUS_LIBRARY_VERSION_MAJOR}
|
||||
VERSION
|
||||
${OPUS_LIBRARY_VERSION}
|
||||
PUBLIC_HEADER
|
||||
- "${Opus_PUBLIC_HEADER}")
|
||||
+ "${Opus_INSTALL_HEADERS}")
|
||||
|
||||
target_include_directories(
|
||||
opus
|
||||
112
patches/ring_windows_msvc_include_dirs.patch
Normal file
112
patches/ring_windows_msvc_include_dirs.patch
Normal file
@@ -0,0 +1,112 @@
|
||||
diff --git a/build.rs b/build.rs
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -346,7 +346,27 @@
|
||||
// we want to optimize for minimizing the build tools required: No Perl,
|
||||
// no nasm, etc.
|
||||
let generated_dir = if !is_git {
|
||||
- c_root_dir.join(PREGENERATED)
|
||||
+ let pregenerated_dir = c_root_dir.join(PREGENERATED);
|
||||
+ if target.os == WINDOWS && target.env == "msvc"
|
||||
+ {
|
||||
+ let mut pending = vec![(pregenerated_dir.clone(), out_dir.clone())];
|
||||
+ while let Some((src_dir, dst_dir)) = pending.pop() {
|
||||
+ fs::create_dir_all(&dst_dir).unwrap();
|
||||
+ for entry in fs::read_dir(&src_dir).unwrap() {
|
||||
+ let entry = entry.unwrap();
|
||||
+ let src_path = entry.path();
|
||||
+ let dst_path = dst_dir.join(entry.file_name());
|
||||
+ if entry.file_type().unwrap().is_dir() {
|
||||
+ pending.push((src_path, dst_path));
|
||||
+ } else {
|
||||
+ fs::copy(&src_path, &dst_path).unwrap();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ out_dir.clone()
|
||||
+ } else {
|
||||
+ pregenerated_dir
|
||||
+ }
|
||||
} else {
|
||||
generate_sources_and_preassemble(
|
||||
&out_dir,
|
||||
@@ -561,7 +581,13 @@
|
||||
let compiler = c.get_compiler();
|
||||
// FIXME: On Windows AArch64 we currently must use Clang to compile C code
|
||||
let compiler = if target.os == WINDOWS && target.arch == AARCH64 && !compiler.is_like_clang() {
|
||||
- let _ = c.compiler("clang");
|
||||
+ // Keep inherited MSVC flags compatible with the selected Clang driver.
|
||||
+ let clang = if compiler.is_like_msvc() {
|
||||
+ "clang-cl"
|
||||
+ } else {
|
||||
+ "clang"
|
||||
+ };
|
||||
+ let _ = c.compiler(clang);
|
||||
c.get_compiler()
|
||||
} else {
|
||||
compiler
|
||||
@@ -569,6 +595,15 @@
|
||||
|
||||
let _ = c.include(c_root_dir.join("include"));
|
||||
let _ = c.include(include_dir);
|
||||
+ let _ = c.include(c_root_dir.join("third_party").join("fiat"));
|
||||
+ if compiler.is_like_msvc() {
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("curve25519"));
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("limbs"));
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("aes"));
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("bn"));
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("ec"));
|
||||
+ let _ = c.include(c_root_dir.join("crypto").join("poly1305"));
|
||||
+ }
|
||||
for f in cpp_flags(&compiler) {
|
||||
let _ = c.flag(f);
|
||||
}
|
||||
diff --git a/crypto/curve25519/curve25519.c b/crypto/curve25519/curve25519.c
|
||||
index 99d7d7fbb..2f69ad560 100644
|
||||
--- a/crypto/curve25519/curve25519.c
|
||||
+++ b/crypto/curve25519/curve25519.c
|
||||
@@ -47,11 +47,11 @@
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
-#include "../../third_party/fiat/curve25519_64.h"
|
||||
+#include "curve25519_64.h"
|
||||
#elif defined(OPENSSL_64_BIT)
|
||||
-#include "../../third_party/fiat/curve25519_64_msvc.h"
|
||||
+#include "curve25519_64_msvc.h"
|
||||
#else
|
||||
-#include "../../third_party/fiat/curve25519_32.h"
|
||||
+#include "curve25519_32.h"
|
||||
#endif
|
||||
|
||||
|
||||
diff --git a/crypto/curve25519/curve25519_64_adx.c b/crypto/curve25519/curve25519_64_adx.c
|
||||
index 88964a9dd..b660f55f4 100644
|
||||
--- a/crypto/curve25519/curve25519_64_adx.c
|
||||
+++ b/crypto/curve25519/curve25519_64_adx.c
|
||||
@@ -19,5 +19,5 @@
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
||||
-#include "../../third_party/fiat/curve25519_64_adx.h"
|
||||
+#include "curve25519_64_adx.h"
|
||||
#endif
|
||||
diff --git a/crypto/fipsmodule/ec/p256.c b/crypto/fipsmodule/ec/p256.c
|
||||
index 0117916da..4224d1192 100644
|
||||
--- a/crypto/fipsmodule/ec/p256.c
|
||||
+++ b/crypto/fipsmodule/ec/p256.c
|
||||
@@ -50,11 +50,11 @@
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
-#include "../../../third_party/fiat/p256_64.h"
|
||||
+#include "p256_64.h"
|
||||
#elif defined(OPENSSL_64_BIT)
|
||||
-#include "../../../third_party/fiat/p256_64_msvc.h"
|
||||
+#include "p256_64_msvc.h"
|
||||
#else
|
||||
-#include "../../../third_party/fiat/p256_32.h"
|
||||
+#include "p256_32.h"
|
||||
#endif
|
||||
|
||||
|
||||
109
patches/rules_cc_windows_native_llvm.patch
Normal file
109
patches/rules_cc_windows_native_llvm.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
# Reuse rules_cc's installed SDK setup with an explicitly declared LLVM repo.
|
||||
# Only the V8 repository has native_llvm; ordinary local_config_cc keeps its
|
||||
# installed compiler and input files. Track the fetched LLVM tools and resources
|
||||
# as action inputs so changes to the pin invalidate cached compilation and links.
|
||||
diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl
|
||||
--- a/cc/private/toolchain/windows_cc_configure.bzl
|
||||
+++ b/cc/private/toolchain/windows_cc_configure.bzl
|
||||
@@ -539,6 +539,12 @@
|
||||
The path to the LLVM installation, or None if not found.
|
||||
"""
|
||||
|
||||
+ # Codex's opt-in V8 toolchain supplies a Bazel-fetched compiler.
|
||||
+ # Ordinary cc_autoconf repositories have no such attribute.
|
||||
+ llvm_label = getattr(repository_ctx.attr, "native_llvm", None)
|
||||
+ if llvm_label:
|
||||
+ return str(repository_ctx.path(llvm_label).dirname).replace("/", "\\")
|
||||
+
|
||||
# 1. Check if BAZEL_LLVM is already set by user.
|
||||
bazel_llvm = _get_path_env_var(repository_ctx, "BAZEL_LLVM")
|
||||
if bazel_llvm:
|
||||
@@ -602,7 +608,7 @@
|
||||
|
||||
def _use_clang_cl(repository_ctx):
|
||||
"""Returns True if USE_CLANG_CL is set to 1."""
|
||||
- return _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1"
|
||||
+ return getattr(repository_ctx.attr, "native_llvm", None) != None or _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1"
|
||||
|
||||
def _find_missing_llvm_tools(repository_ctx, llvm_path):
|
||||
"""Check if any required tool is missing under given LLVM path."""
|
||||
@@ -716,6 +722,7 @@
|
||||
|
||||
build_tools["CL"] = find_llvm_tool(repository_ctx, llvm_path, "clang-cl.exe")
|
||||
build_tools["ML"] = find_msvc_tool(repository_ctx, vc_path, "ml64.exe", "x64")
|
||||
+ build_tools["DUMPBIN"] = find_msvc_tool(repository_ctx, vc_path, "dumpbin.exe", target_arch)
|
||||
build_tools["LINK"] = find_llvm_tool(repository_ctx, llvm_path, "lld-link.exe")
|
||||
if not build_tools["LINK"]:
|
||||
build_tools["LINK"] = find_msvc_tool(repository_ctx, vc_path, "link.exe", "x64")
|
||||
@@ -923,6 +930,12 @@
|
||||
)
|
||||
|
||||
template_vars = dict()
|
||||
+ native_llvm = getattr(repository_ctx.attr, "native_llvm", None)
|
||||
+ for group in ["compiler_files", "linker_files", "archiver_files", "all_files"]:
|
||||
+ files = [str(native_llvm.same_package_label(group))] if native_llvm else []
|
||||
+ if native_llvm and group == "all_files":
|
||||
+ files.append(":msvc_compiler_files")
|
||||
+ template_vars["%{native_llvm_" + group + "}"] = repr(files)
|
||||
msvc_vars_x64 = _get_msvc_vars(repository_ctx, paths, "x64")
|
||||
template_vars.update(msvc_vars_x64)
|
||||
template_vars.update(_get_clang_cl_vars(repository_ctx, paths, msvc_vars_x64, "x64"))
|
||||
diff --git a/cc/private/toolchain/BUILD.windows.tpl b/cc/private/toolchain/BUILD.windows.tpl
|
||||
--- a/cc/private/toolchain/BUILD.windows.tpl
|
||||
+++ b/cc/private/toolchain/BUILD.windows.tpl
|
||||
@@ -67,7 +67,22 @@
|
||||
"%{msvc_deps_scanner_wrapper_path_x64}",
|
||||
"%{msvc_deps_scanner_wrapper_path_arm}",
|
||||
"%{msvc_deps_scanner_wrapper_path_arm64}",
|
||||
- ]
|
||||
+ ] + %{native_llvm_compiler_files}
|
||||
+)
|
||||
+
|
||||
+filegroup(
|
||||
+ name = "msvc_all_files",
|
||||
+ srcs = %{native_llvm_all_files},
|
||||
+)
|
||||
+
|
||||
+filegroup(
|
||||
+ name = "msvc_linker_files",
|
||||
+ srcs = %{native_llvm_linker_files},
|
||||
+)
|
||||
+
|
||||
+filegroup(
|
||||
+ name = "msvc_archiver_files",
|
||||
+ srcs = %{native_llvm_archiver_files},
|
||||
)
|
||||
|
||||
# Hardcoded toolchain, legacy behaviour.
|
||||
@@ -301,12 +316,12 @@
|
||||
name = "cc-compiler-x64_windows",
|
||||
toolchain_identifier = "msvc_x64",
|
||||
toolchain_config = ":msvc_x64",
|
||||
- all_files = ":empty",
|
||||
- ar_files = ":empty",
|
||||
+ all_files = ":msvc_all_files",
|
||||
+ ar_files = ":msvc_archiver_files",
|
||||
as_files = ":msvc_compiler_files",
|
||||
compiler_files = ":msvc_compiler_files",
|
||||
dwp_files = ":empty",
|
||||
- linker_files = ":empty",
|
||||
+ linker_files = ":msvc_linker_files",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
supports_param_files = 1,
|
||||
@@ -526,12 +541,12 @@
|
||||
name = "cc-compiler-arm64_windows",
|
||||
toolchain_identifier = "msvc_arm64",
|
||||
toolchain_config = ":msvc_arm64",
|
||||
- all_files = ":empty",
|
||||
- ar_files = ":empty",
|
||||
+ all_files = ":msvc_all_files",
|
||||
+ ar_files = ":msvc_archiver_files",
|
||||
as_files = ":msvc_compiler_files",
|
||||
compiler_files = ":msvc_compiler_files",
|
||||
dwp_files = ":empty",
|
||||
- linker_files = ":empty",
|
||||
+ linker_files = ":msvc_linker_files",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
supports_param_files = 1,
|
||||
15
patches/rules_foreign_cc_make_cppflags.patch
Normal file
15
patches/rules_foreign_cc_make_cppflags.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/foreign_cc/built_tools/make_build.bzl b/foreign_cc/built_tools/make_build.bzl
|
||||
--- a/foreign_cc/built_tools/make_build.bzl
|
||||
+++ b/foreign_cc/built_tools/make_build.bzl
|
||||
@@ -114,6 +114,11 @@
|
||||
"ARFLAGS": _join_flags_list(ctx.workspace_name, arflags),
|
||||
"CC": absolute_cc,
|
||||
"CFLAGS": _join_flags_list(ctx.workspace_name, non_sysroot_cflags),
|
||||
+ # Configure's preprocessor checks need the declared header paths too.
|
||||
+ "CPPFLAGS": " ".join([
|
||||
+ "$${CPPFLAGS:-}$$",
|
||||
+ _join_flags_list(ctx.workspace_name, non_sysroot_cflags),
|
||||
+ ]).strip(),
|
||||
"LD": absolute_ld,
|
||||
"LDFLAGS": _join_flags_list(ctx.workspace_name, non_sysroot_ldflags),
|
||||
})
|
||||
13
patches/rules_foreign_cc_make_msvc_stdint.patch
Normal file
13
patches/rules_foreign_cc_make_msvc_stdint.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/foreign_cc/built_tools/make_build.bzl b/foreign_cc/built_tools/make_build.bzl
|
||||
--- a/foreign_cc/built_tools/make_build.bzl
|
||||
+++ b/foreign_cc/built_tools/make_build.bzl
|
||||
@@ -35,6 +35,9 @@
|
||||
build_str += " gcc"
|
||||
dist_dir = "GccRel"
|
||||
else:
|
||||
+ # Modern MSVC provides stdint.h, including the intmax_t types that
|
||||
+ # Make's legacy Windows config otherwise replaces with macros.
|
||||
+ build_str = 'export CL="$${CL:-}$$ /DHAVE_STDINT_H=1"\n' + build_str
|
||||
dist_dir = "WinRel"
|
||||
|
||||
script = [
|
||||
10
patches/rules_foreign_cc_make_xcompile.patch
Normal file
10
patches/rules_foreign_cc_make_xcompile.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
diff --git a/toolchains/private/BUILD.bazel b/toolchains/private/BUILD.bazel
|
||||
--- a/toolchains/private/BUILD.bazel
|
||||
+++ b/toolchains/private/BUILD.bazel
|
||||
@@ -23,5 +23,6 @@
|
||||
make_tool(
|
||||
name = "make_tool",
|
||||
srcs = "@gnumake_src//:all_srcs",
|
||||
+ configure_xcompile = True,
|
||||
tags = ["manual"],
|
||||
)
|
||||
58
patches/rules_rs_build_script_deps_annotation.patch
Normal file
58
patches/rules_rs_build_script_deps_annotation.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
# What: restore explicit build-script dependency annotations used by Codex.
|
||||
# Scope: rules_rs crate-universe annotation plumbing only.
|
||||
|
||||
diff --git a/rs/extensions.bzl b/rs/extensions.bzl
|
||||
--- a/rs/extensions.bzl
|
||||
+++ b/rs/extensions.bzl
|
||||
@@ -321,7 +321,7 @@ def _generate_hub_and_spokes(
|
||||
kwargs = dict(
|
||||
hub_name = hub_name,
|
||||
gen_build_script = annotation.gen_build_script,
|
||||
- build_script_deps = [],
|
||||
+ build_script_deps = annotation.build_script_deps,
|
||||
build_script_deps_select = _select(feature_resolutions.build_deps),
|
||||
build_script_data = annotation.build_script_data,
|
||||
build_script_data_select = annotation.build_script_data_select,
|
||||
@@ -881,9 +881,9 @@ _annotation = tag_class(
|
||||
"build_script_data_select": _label_list_dict(
|
||||
doc = "Labels to add to a crate's `cargo_build_script::data` attribute, keyed by platform triplet.",
|
||||
),
|
||||
- # "build_script_deps": attr.label_list(
|
||||
- # doc = "A list of labels to add to a crate's `cargo_build_script::deps` attribute.",
|
||||
- # ),
|
||||
+ "build_script_deps": attr.string_list(
|
||||
+ doc = "A list of labels to add to a crate's `cargo_build_script::deps` attribute.",
|
||||
+ ),
|
||||
"build_script_env": attr.string_dict(
|
||||
doc = "Additional environment variables to set on a crate's `cargo_build_script::env` attribute.",
|
||||
),
|
||||
diff --git a/rs/private/annotations.bzl b/rs/private/annotations.bzl
|
||||
--- a/rs/private/annotations.bzl
|
||||
+++ b/rs/private/annotations.bzl
|
||||
@@ -2,6 +2,7 @@ def _crate_annotation(
|
||||
additive_build_file = None,
|
||||
additive_build_file_content = "",
|
||||
gen_build_script = "auto",
|
||||
+ build_script_deps = [],
|
||||
build_script_data = [],
|
||||
build_script_data_select = {},
|
||||
build_script_env = {},
|
||||
@@ -30,6 +31,7 @@ def _crate_annotation(
|
||||
additive_build_file = additive_build_file,
|
||||
additive_build_file_content = additive_build_file_content,
|
||||
gen_build_script = gen_build_script,
|
||||
+ build_script_deps = build_script_deps,
|
||||
build_script_data = build_script_data,
|
||||
build_script_data_select = build_script_data_select,
|
||||
build_script_env = build_script_env,
|
||||
diff --git a/rs/private/repository_utils.bzl b/rs/private/repository_utils.bzl
|
||||
--- a/rs/private/repository_utils.bzl
|
||||
+++ b/rs/private/repository_utils.bzl
|
||||
@@ -298,6 +298,6 @@ rust_crate_attrs = {
|
||||
"hub_name": attr.string(),
|
||||
"gen_build_script": attr.string(),
|
||||
- "build_script_deps": attr.label_list(),
|
||||
+ "build_script_deps": attr.string_list(),
|
||||
"build_script_deps_select": _label_list_dict(),
|
||||
"build_script_data": attr.label_list(),
|
||||
"build_script_data_select": _label_list_dict(),
|
||||
42
patches/rules_rs_rust_debug_modes.patch
Normal file
42
patches/rules_rs_rust_debug_modes.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
diff --git a/rs/toolchains/declare_rustc_toolchains.bzl b/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
--- a/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
+++ b/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
@@ -45,6 +45,14 @@
|
||||
},
|
||||
)
|
||||
source_stdlib_building_select[config_setting] = "@rules_rs//rs/private:empty_stdlib"
|
||||
+
|
||||
+ # Apple targets default to packed dSYMs and invoke dsymutil at link time.
|
||||
+ # The Linux remote Rust action has no dsymutil. Match Cargo release's
|
||||
+ # split-debuginfo policy so line/full info remains available before packaging.
|
||||
+ darwin_debug_flags = select({
|
||||
+ "@platforms//os:macos": ["-Csplit-debuginfo=off"],
|
||||
+ "//conditions:default": [],
|
||||
+ })
|
||||
-
|
||||
+
|
||||
for triple in execs:
|
||||
exec_triple = _parse_triple(triple)
|
||||
@@ -152,8 +160,20 @@
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
default_edition = edition,
|
||||
- extra_exec_rustc_flags = _rustc_flags_to_select(extra_exec_rustc_flags),
|
||||
- extra_rustc_flags = _rustc_flags_to_select(extra_rustc_flags),
|
||||
+ extra_exec_rustc_flags = _rustc_flags_to_select(extra_exec_rustc_flags) + darwin_debug_flags,
|
||||
+ extra_rustc_flags = _rustc_flags_to_select(extra_rustc_flags) + darwin_debug_flags,
|
||||
+ # Retain source locations through linking; release packaging owns
|
||||
+ # extracting and stripping symbols. Keep -c dbg for full debugging.
|
||||
+ debug_info = {
|
||||
+ "dbg": "full",
|
||||
+ "fastbuild": "line-tables-only",
|
||||
+ "opt": "line-tables-only",
|
||||
+ },
|
||||
+ strip_level = {
|
||||
+ "dbg": "none",
|
||||
+ "fastbuild": "none",
|
||||
+ "opt": "none",
|
||||
+ },
|
||||
exec_triple = triple,
|
||||
target_triple = select(target_triple_select),
|
||||
visibility = ["//visibility:public"],
|
||||
15
patches/rules_rs_windows_msvc_linker.patch
Normal file
15
patches/rules_rs_windows_msvc_linker.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
# What: use Rust's bundled direct linker for Windows x86_64 and ARM64 MSVC toolchains.
|
||||
# Scope: standard and bootstrap rules_rs Rust toolchains targeting x86_64 and ARM64 MSVC.
|
||||
|
||||
diff --git a/rs/toolchains/declare_rustc_toolchains.bzl b/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
--- a/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
+++ b/rs/toolchains/declare_rustc_toolchains.bzl
|
||||
@@ -88,6 +88,8 @@ def declare_rustc_toolchains(
|
||||
llvm_cov = "@llvm//tools:llvm-cov",
|
||||
llvm_profdata = "@llvm//tools:llvm-profdata",
|
||||
linker = select({
|
||||
+ "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": "{}rust-lld".format(rustc_repo_label),
|
||||
+ "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": "{}rust-lld".format(rustc_repo_label),
|
||||
"@platforms//cpu:wasm32": "{}rust-lld".format(rustc_repo_label),
|
||||
"@platforms//cpu:wasm64": "{}rust-lld".format(rustc_repo_label),
|
||||
"//conditions:default": None,
|
||||
15
patches/rules_rs_workspace_package_version.patch
Normal file
15
patches/rules_rs_workspace_package_version.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
# What: expose resolved Cargo workspace package names and versions in DEP_DATA.
|
||||
# Scope: rules_rs workspace metadata only.
|
||||
|
||||
diff --git a/rs/private/cargo_workspace_graph.bzl b/rs/private/cargo_workspace_graph.bzl
|
||||
--- a/rs/private/cargo_workspace_graph.bzl
|
||||
+++ b/rs/private/cargo_workspace_graph.bzl
|
||||
@@ -762,6 +762,8 @@ def workspace_dep_data(
|
||||
"deps": deps,
|
||||
"deps_by_platform": deps_by_platform,
|
||||
"dev_deps": dev_deps,
|
||||
"dev_deps_by_platform": dev_deps_by_platform,
|
||||
+ "package_name": package["name"],
|
||||
"shared_libraries": shared_libraries,
|
||||
+ "version": package["version"],
|
||||
}
|
||||
27
patches/rules_rs_zlib_snapshot_urls.patch
Normal file
27
patches/rules_rs_zlib_snapshot_urls.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
# Fetch Linux zlib from Launchpad with the pinned Ubuntu snapshot as a fallback.
|
||||
# Follow https://github.com/hermeticbuild/rules_rs/commit/ee9a99d0a8e7784b3104dd188123750443cf2c26
|
||||
# while keeping this rules_rs version's package versions and SHA-256 hashes.
|
||||
|
||||
diff --git a/rs/private/rustc_repository.bzl b/rs/private/rustc_repository.bzl
|
||||
--- a/rs/private/rustc_repository.bzl
|
||||
+++ b/rs/private/rustc_repository.bzl
|
||||
@@ -11,11 +11,17 @@ _LINUX_ZLIB = {
|
||||
"aarch64": struct(
|
||||
libdir = "usr/lib/aarch64-linux-gnu",
|
||||
sha256 = "cbe3d39ec32d3cc27c021ae4af11e7c67bdf9d700d573207e0941d4038056278",
|
||||
- url = "https://ports.ubuntu.com/ubuntu-ports/pool/main/z/zlib/zlib1g_1.3.dfsg-3.1ubuntu2.1_arm64.deb",
|
||||
+ url = [
|
||||
+ "https://launchpad.net/ubuntu/+archive/primary/+files/zlib1g_1.3.dfsg-3.1ubuntu2.1_arm64.deb",
|
||||
+ "https://snapshot.ubuntu.com/ubuntu/20260801T000000Z/pool/main/z/zlib/zlib1g_1.3.dfsg-3.1ubuntu2.1_arm64.deb",
|
||||
+ ],
|
||||
),
|
||||
"x86_64": struct(
|
||||
libdir = "usr/lib/x86_64-linux-gnu",
|
||||
sha256 = "7074b6a2f6367a10d280c00a1cb02e74277709180bab4f2491a2f355ab2d6c20",
|
||||
- url = "https://archive.ubuntu.com/ubuntu/pool/main/z/zlib/zlib1g_1.3.dfsg-3.1ubuntu2.1_amd64.deb",
|
||||
+ url = [
|
||||
+ "https://launchpad.net/ubuntu/+archive/primary/+files/zlib1g_1.3.dfsg-3.1ubuntu2.1_amd64.deb",
|
||||
+ "https://snapshot.ubuntu.com/ubuntu/20260801T000000Z/pool/main/z/zlib/zlib1g_1.3.dfsg-3.1ubuntu2.1_amd64.deb",
|
||||
+ ],
|
||||
),
|
||||
}
|
||||
19
patches/rules_rust_build_script_tools_transition.patch
Normal file
19
patches/rules_rust_build_script_tools_transition.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
diff --git a/cargo/private/cargo_build_script.bzl b/cargo/private/cargo_build_script.bzl
|
||||
--- a/cargo/private/cargo_build_script.bzl
|
||||
+++ b/cargo/private/cargo_build_script.bzl
|
||||
@@ -396,3 +396,8 @@ def _cargo_build_script_impl(ctx):
|
||||
+ script_tools = []
|
||||
+ for target in ctx.attr.tools:
|
||||
+ script_tools.append(target[DefaultInfo].files)
|
||||
+ script_tools.append(target[DefaultInfo].default_runfiles.files)
|
||||
+
|
||||
workspace_name = ctx.label.workspace_name
|
||||
if not workspace_name:
|
||||
workspace_name = ctx.workspace_name
|
||||
@@ -581,5 +586,5 @@ def _cargo_build_script_impl(ctx):
|
||||
direct = [
|
||||
ctx.executable._cargo_build_script_runner,
|
||||
] + ([toolchain.target_json] if toolchain.target_json else []),
|
||||
- transitive = script_data + toolchain_tools,
|
||||
+ transitive = script_data + script_tools + toolchain_tools,
|
||||
)
|
||||
103
patches/rules_rust_compiler_thp.patch
Normal file
103
patches/rules_rust_compiler_thp.patch
Normal file
@@ -0,0 +1,103 @@
|
||||
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
|
||||
--- a/rust/private/rustc.bzl
|
||||
+++ b/rust/private/rustc.bzl
|
||||
@@ -1203,6 +1203,15 @@
|
||||
expand_directories = False,
|
||||
)
|
||||
|
||||
+ # The process wrapper must decide on the execution worker. Its seccomp
|
||||
+ # and huge-page policy can differ from the analysis host's configuration.
|
||||
+ if (
|
||||
+ tool_file == toolchain.rustc and
|
||||
+ toolchain.exec_triple.str in ("x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu") and
|
||||
+ crate_info.root.short_path.startswith("codex-rs/")
|
||||
+ ):
|
||||
+ process_wrapper_flags.add("--try-rustc-thp", "true")
|
||||
+
|
||||
# Arguments for launching the tool from the process wrapper. Add the tool as
|
||||
# a `File` so Bazel's path mapping can rewrite the location.
|
||||
rustc_path = ctx.actions.args()
|
||||
diff --git a/util/process_wrapper/options.rs b/util/process_wrapper/options.rs
|
||||
--- a/util/process_wrapper/options.rs
|
||||
+++ b/util/process_wrapper/options.rs
|
||||
@@ -69,6 +69,12 @@
|
||||
let mut rustc_output_format_raw = None;
|
||||
let mut flags = Flags::new();
|
||||
let mut require_explicit_unstable_features = None;
|
||||
+ let mut try_rustc_thp = None;
|
||||
+ flags.define_flag(
|
||||
+ "--try-rustc-thp",
|
||||
+ "Advise huge pages for a known compatible rustc if this worker permits it.",
|
||||
+ &mut try_rustc_thp,
|
||||
+ );
|
||||
flags.define_repeated_flag("--subst", "", &mut subst_mapping_raw);
|
||||
flags.define_flag("--stable-status-file", "", &mut stable_status_file_raw);
|
||||
flags.define_flag("--volatile-status-file", "", &mut volatile_status_file_raw);
|
||||
@@ -260,7 +266,7 @@
|
||||
|
||||
// Prepare the environment variables, unifying those read from files with the ones
|
||||
// of the current process.
|
||||
- let vars = environment_block(
|
||||
+ let mut vars = environment_block(
|
||||
environment_file_block,
|
||||
&stable_stamp_mappings,
|
||||
&volatile_stamp_mappings,
|
||||
@@ -286,6 +292,10 @@
|
||||
)
|
||||
})?;
|
||||
|
||||
+ if try_rustc_thp.as_deref() == Some("true") && compiler_may_advise(&vars) {
|
||||
+ vars.insert("MALLOC_CONF".to_owned(), "thp:always".to_owned());
|
||||
+ }
|
||||
+
|
||||
Ok(Options {
|
||||
executable: exec_path.to_owned(),
|
||||
child_arguments: args.to_vec(),
|
||||
@@ -298,6 +308,47 @@
|
||||
output_file,
|
||||
rustc_output_format,
|
||||
})
|
||||
+}
|
||||
+
|
||||
+// Checking /proc and sysfs needs no optional syscall that a sandbox may
|
||||
+// reject or trap. Unknown worker policies fail closed to the existing behavior.
|
||||
+#[cfg(target_os = "linux")]
|
||||
+fn compiler_may_advise(vars: &HashMap<String, String>) -> bool {
|
||||
+ if vars.keys().any(|key| {
|
||||
+ ["MALLOC_", "_RJEM_", "JEMALLOC_", "MIMALLOC_", "TCMALLOC_", "GLIBC_"]
|
||||
+ .iter()
|
||||
+ .any(|prefix| key.starts_with(prefix))
|
||||
+ || matches!(
|
||||
+ key.as_str(),
|
||||
+ "LD_PRELOAD" | "LD_AUDIT" | "ASAN_OPTIONS" | "LSAN_OPTIONS"
|
||||
+ | "MSAN_OPTIONS" | "TSAN_OPTIONS"
|
||||
+ )
|
||||
+ }) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ for path in ["/etc/malloc.conf", "/etc/jemalloc.conf", "/etc/ld.so.preload"] {
|
||||
+ match std::fs::symlink_metadata(path) {
|
||||
+ Err(error) if error.kind() == io::ErrorKind::NotFound => {}
|
||||
+ _ => return false,
|
||||
+ }
|
||||
+ }
|
||||
+ let Ok(status) = std::fs::read_to_string("/proc/self/status") else {
|
||||
+ return false;
|
||||
+ };
|
||||
+ let Ok(enabled) = std::fs::read_to_string("/sys/kernel/mm/transparent_hugepage/enabled") else {
|
||||
+ return false;
|
||||
+ };
|
||||
+ let field = |key: &str| {
|
||||
+ status.lines().filter_map(|line| line.split_once(':'))
|
||||
+ .find_map(|(name, value)| (name == key).then(|| value.trim()))
|
||||
+ };
|
||||
+ field("Seccomp") == Some("0") && field("THP_enabled") == Some("1")
|
||||
+ && (enabled.contains("[always]") || enabled.contains("[madvise]"))
|
||||
+}
|
||||
+
|
||||
+#[cfg(not(target_os = "linux"))]
|
||||
+fn compiler_may_advise(_: &HashMap<String, String>) -> bool {
|
||||
+ false
|
||||
}
|
||||
|
||||
fn args_from_file(paths: Vec<String>) -> Result<Vec<String>, OptionError> {
|
||||
38
patches/rules_rust_process_wrapper_param_file.patch
Normal file
38
patches/rules_rust_process_wrapper_param_file.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
|
||||
--- a/rust/private/rustc.bzl
|
||||
+++ b/rust/private/rustc.bzl
|
||||
@@ -1121,6 +1121,9 @@
|
||||
|
||||
# Wrapper args first
|
||||
process_wrapper_flags = ctx.actions.args()
|
||||
+ # Build-script file paths can exceed Windows' command-line limit by themselves.
|
||||
+ process_wrapper_flags.set_param_file_format("multiline")
|
||||
+ process_wrapper_flags.use_param_file("@%s")
|
||||
|
||||
for build_env_file in build_env_files:
|
||||
process_wrapper_flags.add("--env-file", build_env_file)
|
||||
diff --git a/util/process_wrapper/options.rs b/util/process_wrapper/options.rs
|
||||
--- a/util/process_wrapper/options.rs
|
||||
+++ b/util/process_wrapper/options.rs
|
||||
@@ -136,10 +136,17 @@
|
||||
&mut require_explicit_unstable_features,
|
||||
);
|
||||
|
||||
- let mut child_args = match flags
|
||||
- .parse(env::args().collect())
|
||||
- .map_err(OptionError::FlagError)?
|
||||
- {
|
||||
+ let mut args: Vec<String> = env::args().collect();
|
||||
+ // Bazel may spill the leading wrapper arguments to a multiline params file.
|
||||
+ // Read them verbatim; child rustc @files after `--` are handled separately.
|
||||
+ if let Some(path) = args.get(1).and_then(|arg| arg.strip_prefix('@')) {
|
||||
+ let contents = std::fs::read_to_string(path).map_err(|err| {
|
||||
+ OptionError::Generic(format!("reading wrapper arguments from {path:?}: {err}"))
|
||||
+ })?;
|
||||
+ args.splice(1..2, contents.lines().map(str::to_owned));
|
||||
+ }
|
||||
+
|
||||
+ let mut child_args = match flags.parse(args).map_err(OptionError::FlagError)? {
|
||||
ParseOutcome::Help(help) => {
|
||||
eprintln!("{help}");
|
||||
exit(0);
|
||||
118
patches/rules_rust_release_build_script_profile.patch
Normal file
118
patches/rules_rust_release_build_script_profile.patch
Normal file
@@ -0,0 +1,118 @@
|
||||
--- a/cargo/private/cargo_build_script.bzl
|
||||
+++ b/cargo/private/cargo_build_script.bzl
|
||||
@@ -3,6 +3,7 @@
|
||||
load("@apple_support//lib:apple_support.bzl", "apple_support")
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
+load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS")
|
||||
load("@rules_cc//cc:action_names.bzl", "ACTION_NAMES")
|
||||
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
|
||||
load("//rust:defs.bzl", "rust_common")
|
||||
@@ -11,6 +12,7 @@
|
||||
# buildifier: disable=bzl-visibility
|
||||
load(
|
||||
"//rust/private:rustc.bzl",
|
||||
+ "collect_extra_rustc_flags",
|
||||
"get_compilation_mode_opts",
|
||||
"get_linker_and_args",
|
||||
)
|
||||
@@ -23,6 +25,7 @@
|
||||
"expand_dict_value_locations",
|
||||
"find_cc_toolchain",
|
||||
"find_toolchain",
|
||||
+ "is_exec_configuration",
|
||||
_name_to_crate_name = "name_to_crate_name",
|
||||
)
|
||||
|
||||
@@ -66,6 +69,43 @@
|
||||
},
|
||||
executable = True,
|
||||
)
|
||||
+
|
||||
+def _release_user_opts(ctx, flags):
|
||||
+ # Bazel 9.2's default exec transition appends -g0 to host copts/cxxopts on
|
||||
+ # non-Windows servers. Remove only that suffix; preserve explicit -g0.
|
||||
+ # https://github.com/bazelbuild/bazel/blob/9.2.0/src/main/starlark/builtins_bzl/common/builtin_exec_platforms.bzl
|
||||
+ if is_exec_configuration(ctx) and "@platforms//os:windows" not in HOST_CONSTRAINTS and flags and flags[-1] == "-g0":
|
||||
+ return flags[:-1]
|
||||
+ return flags
|
||||
+
|
||||
+def _cargo_profile_native_flags(flags):
|
||||
+ # Let cc-rs/cmake derive optimization and debug info from Cargo's profile.
|
||||
+ # Filter toolchain defaults only; explicit user flags are appended afterwards.
|
||||
+ profile_defaults = [
|
||||
+ "-O0",
|
||||
+ "-O1",
|
||||
+ "-O2",
|
||||
+ "-O3",
|
||||
+ "-Og",
|
||||
+ "-Os",
|
||||
+ "-Oz",
|
||||
+ "-Ofast",
|
||||
+ "-g0",
|
||||
+ "-DNDEBUG",
|
||||
+ "-DNDEBUG=1",
|
||||
+ "/Od",
|
||||
+ "/O1",
|
||||
+ "/O2",
|
||||
+ "/Ox",
|
||||
+ "/Ob0",
|
||||
+ "/Ob1",
|
||||
+ "/Ob2",
|
||||
+ "/Ob3",
|
||||
+ "/Oi",
|
||||
+ "/DNDEBUG",
|
||||
+ "/DNDEBUG=1",
|
||||
+ ]
|
||||
+ return [flag for flag in flags if flag not in profile_defaults]
|
||||
|
||||
def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
|
||||
"""Gather cc environment variables from the given `cc_toolchain`
|
||||
@@ -469,6 +509,22 @@
|
||||
env["CARGO_PKG_VERSION_PRE"] = patch[1] if len(patch) > 1 else ""
|
||||
env["CARGO_PKG_VERSION"] = ctx.attr.version
|
||||
|
||||
+ cargo_release_profile = _feature_enabled(ctx, "cargo-release-profile")
|
||||
+ if cargo_release_profile:
|
||||
+ # Compatibility with Cargo release profiles that retain debug info:
|
||||
+ # DEBUG describes symbol generation, not debug assertions. Read the
|
||||
+ # consuming crate's configuration, not the build-script executable's.
|
||||
+ debug_info = get_compilation_mode_opts(ctx, toolchain).debug_info
|
||||
+ flags = collect_extra_rustc_flags(ctx, toolchain, None, "rlib")
|
||||
+ for flag in flags:
|
||||
+ # Accept both -Copt-level=N and the split -C opt-level=N spelling.
|
||||
+ codegen = flag.removeprefix("-C").removeprefix("--codegen=")
|
||||
+ if codegen.startswith("opt-level="):
|
||||
+ env["OPT_LEVEL"] = codegen.removeprefix("opt-level=")
|
||||
+ elif codegen.startswith("debuginfo="):
|
||||
+ debug_info = codegen.removeprefix("debuginfo=")
|
||||
+ env["DEBUG"] = "false" if debug_info in ["0", "none"] else "true"
|
||||
+
|
||||
# Pull in env vars which may be required for the cc_toolchain to work (e.g. on OSX, the SDK version).
|
||||
# We hope that the linker env is sufficient for the whole cc_toolchain.
|
||||
cc_toolchain, feature_configuration = find_cc_toolchain(ctx)
|
||||
@@ -484,6 +540,13 @@
|
||||
if cc_toolchain:
|
||||
# MSVC requires INCLUDE to be set
|
||||
cc_c_args, cc_cxx_args, cc_env = get_cc_compile_args_and_env(cc_toolchain, feature_configuration)
|
||||
+ if cargo_release_profile:
|
||||
+ # Preserve SDK, ABI, CRT and security options. User copts and crate
|
||||
+ # build_script_env overrides retain precedence over these defaults.
|
||||
+ copts = _release_user_opts(ctx, ctx.fragments.cpp.copts)
|
||||
+ cxxopts = _release_user_opts(ctx, ctx.fragments.cpp.cxxopts)
|
||||
+ cc_c_args = _cargo_profile_native_flags(cc_c_args) + copts + ctx.fragments.cpp.conlyopts
|
||||
+ cc_cxx_args = _cargo_profile_native_flags(cc_cxx_args) + copts + cxxopts
|
||||
include = cc_env.get("INCLUDE")
|
||||
if include:
|
||||
if toolchain.exec_triple.str.find("windows") > 0:
|
||||
@@ -837,6 +900,10 @@
|
||||
"_cargo_manifest_dir_filename_suffixes_to_retain": attr.label(
|
||||
default = Label("//cargo/settings:cargo_manifest_dir_filename_suffixes_to_retain"),
|
||||
),
|
||||
+ "_extra_exec_rustc_flag": attr.label(default = Label("//rust/settings:extra_exec_rustc_flag")),
|
||||
+ "_extra_exec_rustc_flags": attr.label(default = Label("//rust/settings:extra_exec_rustc_flags")),
|
||||
+ "_extra_rustc_flag": attr.label(default = Label("//rust/settings:extra_rustc_flag")),
|
||||
+ "_extra_rustc_flags": attr.label(default = Label("//rust/settings:extra_rustc_flags")),
|
||||
"_debug_std_streams_output_group": attr.label(
|
||||
default = Label("//cargo/settings:debug_std_streams_output_group"),
|
||||
),
|
||||
52
patches/rules_rust_windows_execroot_separators.patch
Normal file
52
patches/rules_rust_windows_execroot_separators.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
--- a/cargo/private/cargo_build_script_runner/lib.rs
|
||||
+++ b/cargo/private/cargo_build_script_runner/lib.rs
|
||||
@@ -337,9 +337,18 @@
|
||||
return "${pwd}".to_owned();
|
||||
}
|
||||
|
||||
- value
|
||||
+ let redacted = value
|
||||
.replace(&format!("{exec_root}/"), "${pwd}/")
|
||||
- .replace(&format!("{exec_root}\\"), "${pwd}\\")
|
||||
+ .replace(&format!("{exec_root}\\"), "${pwd}\\");
|
||||
+ #[cfg(windows)]
|
||||
+ let redacted = {
|
||||
+ // pkg-config can emit forward slashes for the same Windows root.
|
||||
+ let root = exec_root.replace('\\', "/");
|
||||
+ redacted
|
||||
+ .replace(&format!("{root}/"), "${pwd}/")
|
||||
+ .replace(&format!("{root}\\"), "${pwd}\\")
|
||||
+ };
|
||||
+ redacted
|
||||
}
|
||||
|
||||
/// Redact for env vars: uses the generic `${out_dir}` token, resolved
|
||||
@@ -630,6 +639,28 @@
|
||||
link_search_paths:
|
||||
"-L${pwd}/${bazel-out/cfg/bin/pkg/_bs.out_dir}\n-L${pwd}/other/path".to_owned(),
|
||||
}
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ #[cfg(windows)]
|
||||
+ #[test]
|
||||
+ fn windows_include_metadata_redacts_both_root_spellings() {
|
||||
+ let root = r"D:\o\execroot\_main";
|
||||
+ let forward = root.replace('\\', "/");
|
||||
+ let outputs = vec![BuildScriptOutput::DepEnv(format!(
|
||||
+ "INCLUDE={forward}/include;{root}\\lib;{forward}-other/include"
|
||||
+ ))];
|
||||
+ assert_eq!(
|
||||
+ BuildScriptOutput::outputs_to_dep_env(&outputs, "glib", root),
|
||||
+ format!("DEP_GLIB_INCLUDE=${{pwd}}/include;${{pwd}}\\lib;{forward}-other/include")
|
||||
+ );
|
||||
+ let directory = std::env::current_dir().unwrap();
|
||||
+ let directory = directory.to_str().unwrap();
|
||||
+ let forward = directory.replace('\\', "/");
|
||||
+ let outputs = vec![BuildScriptOutput::DepEnv(format!("INCLUDE={forward}/."))];
|
||||
+ assert_eq!(
|
||||
+ BuildScriptOutput::nonhermetic_absolute_paths(&outputs, directory, ""),
|
||||
+ Vec::<String>::new()
|
||||
);
|
||||
}
|
||||
|
||||
109
patches/rules_rust_windows_msvc_direct_link_args.patch
Normal file
109
patches/rules_rust_windows_msvc_direct_link_args.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
--- a/rust/private/rustc.bzl
|
||||
+++ b/rust/private/rustc.bzl
|
||||
@@ -438,4 +438,11 @@
|
||||
use_bpf_linker = toolchain.target_arch in ("bpfeb", "bpfel") and toolchain.linker
|
||||
- if not ld or toolchain.linker_preference == "rust" or use_bpf_linker:
|
||||
+ use_windows_msvc_linker = (
|
||||
+ toolchain.target_arch in ("x86_64", "aarch64") and
|
||||
+ toolchain.target_os == "windows" and
|
||||
+ toolchain.target_abi == "msvc" and
|
||||
+ toolchain.linker != None and
|
||||
+ toolchain.linker_preference != "cc"
|
||||
+ )
|
||||
+ if not ld or toolchain.linker_preference == "rust" or use_bpf_linker or use_windows_msvc_linker:
|
||||
ld = toolchain.linker.path
|
||||
ld_is_direct_driver = toolchain.linker_type == "direct"
|
||||
@@ -468,11 +468,25 @@
|
||||
filtered_args.append(version)
|
||||
# Keep library search path flags
|
||||
|
||||
+ elif processed_arg == "-L" and i + 1 < len(link_args):
|
||||
+ path = link_args[i + 1]
|
||||
+ if ld_is_direct_driver and toolchain.target_os == "windows" and toolchain.target_abi == "msvc":
|
||||
+ skip_next = True
|
||||
+ continue
|
||||
+ filtered_args.extend([processed_arg, path])
|
||||
+ skip_next = True
|
||||
+
|
||||
elif processed_arg.startswith("-L"):
|
||||
+ if ld_is_direct_driver and toolchain.target_os == "windows" and toolchain.target_abi == "msvc":
|
||||
+ continue
|
||||
filtered_args.append(processed_arg)
|
||||
# Keep sysroot flags (as single or two-part arguments)
|
||||
|
||||
elif processed_arg == "--sysroot" or processed_arg.startswith("--sysroot="):
|
||||
+ if ld_is_direct_driver and toolchain.target_os == "windows" and toolchain.target_abi == "msvc":
|
||||
+ if processed_arg == "--sysroot" and i + 1 < len(link_args):
|
||||
+ skip_next = True
|
||||
+ continue
|
||||
filtered_args.append(processed_arg)
|
||||
if processed_arg == "--sysroot" and i + 1 < len(link_args):
|
||||
# Two-part argument, keep the next arg too
|
||||
@@ -2943,8 +2957,10 @@
|
||||
use_pic,
|
||||
ambiguous_libs,
|
||||
get_lib_name,
|
||||
+ for_windows = False,
|
||||
for_darwin = False,
|
||||
- flavor_msvc = False):
|
||||
+ flavor_msvc = False,
|
||||
+ use_direct_driver = False):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
@@ -2952,8 +2968,10 @@
|
||||
use_pic (_type_): _description_
|
||||
ambiguous_libs (_type_): _description_
|
||||
get_lib_name (_type_): _description_
|
||||
+ for_windows (bool, optional): _description_. Defaults to False.
|
||||
for_darwin (bool, optional): _description_. Defaults to False.
|
||||
flavor_msvc (bool, optional): _description_. Defaults to False.
|
||||
+ use_direct_driver (bool, optional): _description_. Defaults to False.
|
||||
|
||||
Returns:
|
||||
_type_: _description_
|
||||
@@ -2997,6 +3015,11 @@
|
||||
):
|
||||
return [] if for_darwin else ["-lstatic=%s" % get_lib_name(artifact)]
|
||||
|
||||
+ if for_windows and flavor_msvc and use_direct_driver and not artifact.basename.endswith(".lib"):
|
||||
+ return [
|
||||
+ "-Clink-arg={}".format(artifact.path),
|
||||
+ ]
|
||||
+
|
||||
if flavor_msvc:
|
||||
return [
|
||||
"-lstatic=%s" % get_lib_name(artifact),
|
||||
@@ -3045,7 +3068,7 @@
|
||||
])
|
||||
elif include_link_flags:
|
||||
get_lib_name = get_lib_name_for_windows if flavor_msvc else get_lib_name_default
|
||||
- ret.extend(portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, flavor_msvc = flavor_msvc))
|
||||
+ ret.extend(portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, for_windows = True, flavor_msvc = flavor_msvc, use_direct_driver = use_direct_driver))
|
||||
|
||||
# Windows toolchains can inherit POSIX defaults like -pthread from C deps,
|
||||
# which fails to link with the MinGW/LLD toolchain. Drop them here.
|
||||
@@ -3257,11 +3280,18 @@
|
||||
format_each = "-Lnative=%s",
|
||||
)
|
||||
if include_link_flags:
|
||||
- args.add_all(
|
||||
- runtime_libs,
|
||||
- map_each = get_lib_name,
|
||||
- format_each = static_runtime_link_format,
|
||||
- )
|
||||
+ if toolchain.target_os == "windows" and toolchain.target_abi == "msvc" and use_direct_link_driver:
|
||||
+ for runtime_lib in runtime_libs.to_list():
|
||||
+ if runtime_lib.basename.endswith(".lib"):
|
||||
+ args.add(get_lib_name(runtime_lib), format = static_runtime_link_format)
|
||||
+ else:
|
||||
+ args.add(runtime_lib.path, format = "--codegen=link-arg=%s")
|
||||
+ else:
|
||||
+ args.add_all(
|
||||
+ runtime_libs,
|
||||
+ map_each = get_lib_name,
|
||||
+ format_each = static_runtime_link_format,
|
||||
+ )
|
||||
|
||||
def _get_dirname(file):
|
||||
"""A helper function for `_add_native_link_flags`.
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/util/process_wrapper/main.rs
|
||||
+++ b/util/process_wrapper/main.rs
|
||||
@@ -213,6 +213,12 @@ fn consolidate_dependency_search_paths(
|
||||
let file_name_lower = file_name
|
||||
.to_string_lossy()
|
||||
.to_ascii_lowercase();
|
||||
+ if file_name_lower.contains(".tmp") || file_name_lower.ends_with(".rcgu.o") {
|
||||
+ // Native Windows Rust link actions can leave transient `*.exe.tmp*` and
|
||||
+ // per-codegen-unit `*.rcgu.o` outputs next to the final binary.
|
||||
+ // Those are not stable linker search-path inputs.
|
||||
+ continue;
|
||||
+ }
|
||||
if !seen.insert(file_name_lower) {
|
||||
continue;
|
||||
}
|
||||
78
patches/rusty_v8_prebuilt_out_dir.patch
Normal file
78
patches/rusty_v8_prebuilt_out_dir.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
# Make rusty_v8 use the Bazel-provided archive and bindings. Mark the Git
|
||||
# checkout's vendored third_party directory as a package so rules_rs does not
|
||||
# stage libc++ test names containing '=' as Cargo build-script runfiles.
|
||||
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -543,10 +543,15 @@
|
||||
}
|
||||
|
||||
fn static_lib_name(suffix: &str) -> String {
|
||||
- let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
- if target_os == "windows" {
|
||||
+ let target = env::var("TARGET").unwrap();
|
||||
+ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
+ if target.contains("windows-gnullvm") {
|
||||
+ // rustc looks for GNU-style archive names when bundling `-lstatic` on the
|
||||
+ // gnullvm targets, even though the prebuilt release is a COFF `.lib`.
|
||||
+ format!("librusty_v8{suffix}.a")
|
||||
+ } else if target_os == "windows" {
|
||||
format!("rusty_v8{suffix}.lib")
|
||||
} else {
|
||||
format!("librusty_v8{suffix}.a")
|
||||
}
|
||||
}
|
||||
@@ -577,7 +577,23 @@
|
||||
path
|
||||
}
|
||||
|
||||
+fn out_dir_abs() -> PathBuf {
|
||||
+ let cwd = env::current_dir().unwrap();
|
||||
+
|
||||
+ // target/debug/build/rusty_v8-d9e5a424d4f96994/out/
|
||||
+ let out_dir = env::var_os("OUT_DIR").expect(
|
||||
+ "The 'OUT_DIR' environment is not set (it should be something like \
|
||||
+ 'target/debug/rusty_v8-{hash}').",
|
||||
+ );
|
||||
+
|
||||
+ cwd.join(out_dir)
|
||||
+}
|
||||
+
|
||||
fn static_lib_dir() -> PathBuf {
|
||||
+ if env::var_os("RUSTY_V8_ARCHIVE").is_some() {
|
||||
+ return out_dir_abs().join("gn_out").join("obj");
|
||||
+ }
|
||||
+
|
||||
build_dir().join("gn_out").join("obj")
|
||||
}
|
||||
|
||||
@@ -794,22 +810,23 @@
|
||||
}
|
||||
|
||||
fn print_link_flags() {
|
||||
+ let target = env::var("TARGET").unwrap();
|
||||
println!("cargo:rustc-link-lib=static=rusty_v8");
|
||||
let should_dyn_link_libcxx = env::var("CARGO_FEATURE_USE_CUSTOM_LIBCXX")
|
||||
.is_err()
|
||||
+ || (target.contains("apple") && env::var("RUSTY_V8_ARCHIVE").is_ok())
|
||||
|| env::var("GN_ARGS").is_ok_and(|gn_args| {
|
||||
gn_args
|
||||
.split_whitespace()
|
||||
.any(|ba| ba == "use_custom_libcxx=false")
|
||||
});
|
||||
|
||||
if should_dyn_link_libcxx {
|
||||
// Based on https://github.com/alexcrichton/cc-rs/blob/fba7feded71ee4f63cfe885673ead6d7b4f2f454/src/lib.rs#L2462
|
||||
if let Ok(stdlib) = env::var("CXXSTDLIB") {
|
||||
if !stdlib.is_empty() {
|
||||
println!("cargo:rustc-link-lib=dylib={stdlib}");
|
||||
}
|
||||
} else {
|
||||
- let target = env::var("TARGET").unwrap();
|
||||
if target.contains("msvc") {
|
||||
// nothing to link to
|
||||
} else if target.contains("apple")
|
||||
--- /dev/null
|
||||
+++ b/third_party/BUILD.bazel
|
||||
@@ -0,0 +1 @@
|
||||
+package(default_visibility = ["//visibility:private"])
|
||||
38
patches/tikv-jemalloc-sys_dependency_flags.patch
Normal file
38
patches/tikv-jemalloc-sys_dependency_flags.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
diff --git a/jemalloc/Makefile.in b/jemalloc/Makefile.in
|
||||
--- a/jemalloc/Makefile.in
|
||||
+++ b/jemalloc/Makefile.in
|
||||
@@ -508,7 +508,7 @@
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
|
||||
ifdef CC_MM
|
||||
- @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
+ @$(CC) $(CFLAGS) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
endif
|
||||
|
||||
$(C_SYMS): %.sym:
|
||||
@@ -532,7 +532,7 @@
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(CXXFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
|
||||
ifdef CC_MM
|
||||
- @$(CXX) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
+ @$(CXX) $(CXXFLAGS) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
endif
|
||||
|
||||
ifneq ($(SOREV),$(SO))
|
||||
@@ -589,14 +589,14 @@
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(CFLAGS) -c $(CPPFLAGS) -DJEMALLOC_STRESS_TEST -I$(srcroot)test/include -I$(objroot)test/include $(CTARGET) $<
|
||||
ifdef CC_MM
|
||||
- @$(CC) -MM $(CPPFLAGS) -DJEMALLOC_STRESS_TEST -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
+ @$(CC) $(CFLAGS) -MM $(CPPFLAGS) -DJEMALLOC_STRESS_TEST -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
endif
|
||||
|
||||
$(objroot)test/stress/pa/%.$(O): $(srcroot)test/stress/pa/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(CXXFLAGS) -c $(CPPFLAGS) -I$(srcroot)test/include -I$(objroot)test/include $(CTARGET) $<
|
||||
ifdef CC_MM
|
||||
- @$(CXX) -MM $(CPPFLAGS) -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
+ @$(CXX) $(CXXFLAGS) -MM $(CPPFLAGS) -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
|
||||
endif
|
||||
|
||||
build_lib_shared: $(DSOS)
|
||||
13
patches/tikv-jemalloc-sys_make_env.patch
Normal file
13
patches/tikv-jemalloc-sys_make_env.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/build.rs b/build.rs
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -331,7 +331,8 @@
|
||||
run_and_log(&mut cmd, &build_dir.join("config.log"));
|
||||
|
||||
// Make:
|
||||
- let make = make_cmd(&host);
|
||||
+ let make = read_and_watch_env("MAKE").unwrap_or_else(|_| make_cmd(&host).to_owned());
|
||||
+ let make = make.as_str();
|
||||
run(&mut make_command(make, &build_dir, &num_jobs));
|
||||
|
||||
// Skip watching this environment variables to avoid rebuild in CI.
|
||||
14
patches/tonic-zstd-level1.patch
Normal file
14
patches/tonic-zstd-level1.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/src/codec/compression.rs
|
||||
+++ b/src/codec/compression.rs
|
||||
@@ -239,8 +239,9 @@
|
||||
CompressionEncoding::Zstd => {
|
||||
let mut zstd_encoder = Encoder::new(
|
||||
&decompressed_buf[0..len],
|
||||
- // FIXME: support customizing the compression level
|
||||
- zstd::DEFAULT_COMPRESSION_LEVEL,
|
||||
+ // Favor CodeModeHost response latency over compression ratio.
|
||||
+ // Level 1 is the fastest positive level and matches the benchmark.
|
||||
+ 1,
|
||||
)?;
|
||||
std::io::copy(&mut zstd_encoder, &mut out_writer)?;
|
||||
}
|
||||
163
patches/v8_array_sort_elements_kind.patch
Normal file
163
patches/v8_array_sort_elements_kind.patch
Normal file
@@ -0,0 +1,163 @@
|
||||
# What: backport CVE-2026-85046 to V8 15.2.124.1 by rejecting mixed
|
||||
# elements kinds when inlining Array.prototype.sort.
|
||||
# Scope: Maglev/TurboFan implementation guards and the upstream regression test.
|
||||
# Upstream M152 fix: https://github.com/v8/v8/commit/94c34b200ae9caf83d06c167a070746a1c7e825c
|
||||
# CVE advisory: https://chromereleases.googleblog.com/2026/09/stable-channel-update-for-desktop_01882797386.html
|
||||
|
||||
diff --git a/orig/v8-15.2.124.1/src/compiler/js-call-reducer.cc b/mod/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
index e8707261d3e2..0e2d9bfd0a74 100644
|
||||
--- a/orig/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
+++ b/mod/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
@@ -4068,6 +4068,10 @@ class IteratingArrayBuiltinHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
+ all_elements_kinds_equal_ = std::all_of(
|
||||
+ receiver_maps.begin(), receiver_maps.end(),
|
||||
+ [&](MapRef map) { return map.elements_kind() == elements_kind_; });
|
||||
+
|
||||
// TODO(jgruber): May only be needed for holey elements kinds.
|
||||
if (!dependencies->DependOnNoElementsProtector()) return;
|
||||
|
||||
@@ -4083,10 +4087,13 @@ class IteratingArrayBuiltinHelper {
|
||||
Control control() const { return control_; }
|
||||
MapInference* inference() { return &inference_; }
|
||||
ElementsKind elements_kind() const { return elements_kind_; }
|
||||
+ // False when elements_kind() is a union over differing receiver kinds.
|
||||
+ bool all_elements_kinds_equal() const { return all_elements_kinds_equal_; }
|
||||
|
||||
private:
|
||||
bool can_reduce_ = false;
|
||||
bool has_stability_dependency_ = false;
|
||||
+ bool all_elements_kinds_equal_ = false;
|
||||
Node* receiver_;
|
||||
Effect effect_;
|
||||
Control control_;
|
||||
@@ -4126,6 +4133,11 @@ Reduction JSCallReducer::ReduceArraySort(Node* node,
|
||||
IteratingArrayBuiltinHelper h(node, broker(), jsgraph(), dependencies());
|
||||
if (!h.can_reduce()) return h.inference()->NoChange();
|
||||
|
||||
+ // The union kind is only an upper bound on each receiver's own kind. Loads
|
||||
+ // through it widen and are sound; stores narrow and are not. Unlike the
|
||||
+ // iterating builtins, sort writes its snapshot back into the receiver.
|
||||
+ if (!h.all_elements_kinds_equal()) return h.inference()->NoChange();
|
||||
+
|
||||
// Only non-holey, non-double PACKED kinds are supported. Holey arrays need
|
||||
// hole handling; double arrays need a FixedDoubleArray temp copy.
|
||||
if (IsHoleyElementsKind(h.elements_kind())) return h.inference()->NoChange();
|
||||
diff --git a/orig/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc b/mod/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
index c40cadb32d92..c6ae7f791267 100644
|
||||
--- a/orig/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
+++ b/mod/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
@@ -9797,6 +9797,16 @@ MaybeReduceResult MaglevGraphBuilder::TryReduceArrayPrototypeSort(
|
||||
" array iteration");
|
||||
}
|
||||
|
||||
+ // The union kind is only an upper bound on each receiver's own kind. Loads
|
||||
+ // through it widen and are sound; stores narrow and are not. Unlike the
|
||||
+ // iterating builtins, sort writes its snapshot back into the receiver.
|
||||
+ if (std::any_of(possible_maps->begin(), possible_maps->end(),
|
||||
+ [&](compiler::MapRef map) {
|
||||
+ return map.elements_kind() != elements_kind;
|
||||
+ })) {
|
||||
+ FAIL(" to reduce Array.prototype.sort - receiver elements kinds disagree");
|
||||
+ }
|
||||
+
|
||||
// Holey arrays require holes to be moved to the end of the sorted result
|
||||
// (ECMA-262 23.1.3.30 step 5, skip-holes mode). The insertion sort does
|
||||
// not implement this, so bail out for any holey kind.
|
||||
diff --git a/orig/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js b/mod/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js
|
||||
new file mode 100644
|
||||
index 000000000000..e60a974f8784
|
||||
--- /dev/null
|
||||
+++ b/mod/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js
|
||||
@@ -0,0 +1,89 @@
|
||||
+// Copyright 2026 the V8 project authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+// Flags: --allow-natives-syntax --maglev
|
||||
+
|
||||
+// The inlined sort snapshots the receiver's elements, runs comparefn, then
|
||||
+// copies the snapshot back specialized on the receiver's elements kind. With
|
||||
+// polymorphic {PACKED_SMI,PACKED} feedback that kind is the union
|
||||
+// PACKED_ELEMENTS, which no longer describes a receiver that comparefn has
|
||||
+// narrowed back to PACKED_SMI_ELEMENTS.
|
||||
+
|
||||
+function sort(a) {
|
||||
+ function compare() {
|
||||
+ a.fill(0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return a.sort(compare);
|
||||
+}
|
||||
+
|
||||
+%PrepareFunctionForOptimization(sort);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sort([1, 2]);
|
||||
+ sort([{}, {}]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sort);
|
||||
+sort([1, 2]);
|
||||
+
|
||||
+const object = {};
|
||||
+const bad = [object, {}];
|
||||
+sort(bad);
|
||||
+
|
||||
+// A Smi-elements array must never hold a HeapObject.
|
||||
+assertFalse(%HasSmiElements(bad) && bad[0] === object);
|
||||
+
|
||||
+// Mixed-kind feedback is not inlined, but still sorts correctly.
|
||||
+function sortMixed(a) {
|
||||
+ return a.sort((x, y) => x - y);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortMixed);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortMixed([2, 1]);
|
||||
+ sortMixed([{}, {}]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortMixed);
|
||||
+assertEquals([1, 2, 3], sortMixed([3, 1, 2]));
|
||||
+
|
||||
+// Same via a Smi/double mix, whose union kind PACKED_DOUBLE_ELEMENTS is
|
||||
+// rejected by the double bailout rather than the kind-agreement one.
|
||||
+function sortDouble(a) {
|
||||
+ function compare(x, y) {
|
||||
+ a.fill(0);
|
||||
+ return x - y;
|
||||
+ }
|
||||
+ return a.sort(compare);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortDouble);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortDouble([2, 1]);
|
||||
+ sortDouble([2.5, 1.5]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortDouble);
|
||||
+sortDouble([2, 1]);
|
||||
+// The sort writes its snapshot back, so comparefn's fill is not observable.
|
||||
+assertEquals([1.5, 2.5], sortDouble([2.5, 1.5]));
|
||||
+
|
||||
+// Sites whose receiver kinds agree keep the inlined path, including when the
|
||||
+// maps themselves differ.
|
||||
+function withProperty() {
|
||||
+ const a = [{}, {}];
|
||||
+ a.foo = 1;
|
||||
+ return a;
|
||||
+}
|
||||
+function sortSameKind(a) {
|
||||
+ return a.sort((x, y) => 0);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortSameKind);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortSameKind([{}, {}]);
|
||||
+ sortSameKind(withProperty());
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortSameKind);
|
||||
+sortSameKind([{}, {}]);
|
||||
+assertOptimized(sortSameKind);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortSameKind([{}, {}]);
|
||||
+ sortSameKind(withProperty());
|
||||
+}
|
||||
+assertOptimized(sortSameKind);
|
||||
194
patches/v8_source_portability.patch
Normal file
194
patches/v8_source_portability.patch
Normal file
@@ -0,0 +1,194 @@
|
||||
# What: make upstream V8 sources build cleanly in this hermetic toolchain setup.
|
||||
# Scope: minimal source-level portability fixes only, such as libexecinfo guards,
|
||||
# weak glibc symbol handling, and warning annotations; no dependency
|
||||
# include-path rewrites or intentional V8 feature changes.
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/bits.h b/mod/v8-15.0.245.2/src/base/bits.h
|
||||
index 179a10f..4791e96 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/bits.h
|
||||
+++ b/mod/v8-15.0.245.2/src/base/bits.h
|
||||
@@ -270,11 +270,17 @@ inline constexpr uint32_t RoundDownToPowerOfTwo32(uint32_t value) {
|
||||
}
|
||||
|
||||
// Precondition: 0 <= shift < 32
|
||||
+#ifdef RotateRight32
|
||||
+#undef RotateRight32
|
||||
+#endif
|
||||
inline constexpr uint32_t RotateRight32(uint32_t value, uint32_t shift) {
|
||||
return (value >> shift) | (value << ((32 - shift) & 31));
|
||||
}
|
||||
|
||||
// Precondition: 0 <= shift < 32
|
||||
+#ifdef RotateLeft32
|
||||
+#undef RotateLeft32
|
||||
+#endif
|
||||
inline constexpr uint32_t RotateLeft32(uint32_t value, uint32_t shift) {
|
||||
return (value << shift) | (value >> ((32 - shift) & 31));
|
||||
}
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/debug/stack_trace_posix.cc b/mod/v8-15.0.245.2/src/base/debug/stack_trace_posix.cc
|
||||
index 6176ed4..a02043d 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/mod/v8-15.0.245.2/src/base/debug/stack_trace_posix.cc
|
||||
@@ -64,6 +64,7 @@ namespace {
|
||||
volatile sig_atomic_t in_signal_handler = 0;
|
||||
bool dump_stack_in_signal_handler = true;
|
||||
|
||||
+#if HAVE_EXECINFO_H
|
||||
// The prefix used for mangled symbols, per the Itanium C++ ABI:
|
||||
// http://www.codesourcery.com/cxx-abi/abi.html#mangling
|
||||
const char kMangledSymbolPrefix[] = "_Z";
|
||||
@@ -73,7 +74,6 @@ const char kMangledSymbolPrefix[] = "_Z";
|
||||
const char kSymbolCharacters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||
|
||||
-#if HAVE_EXECINFO_H
|
||||
// Demangles C++ symbols in the given text. Example:
|
||||
//
|
||||
// "out/Debug/base_unittests(_ZN10StackTraceC1Ev+0x20) [0x817778c]"
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/export-template.h b/mod/v8-15.0.245.2/src/base/export-template.h
|
||||
index 861cfe4..1e73954 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/export-template.h
|
||||
+++ b/mod/v8-15.0.245.2/src/base/export-template.h
|
||||
@@ -153,8 +153,10 @@
|
||||
|
||||
EXPORT_TEMPLATE_TEST(DEFAULT, );
|
||||
EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default"))));
|
||||
+#if defined(_MSC_VER)
|
||||
EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
|
||||
EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
|
||||
+#endif
|
||||
|
||||
#undef EXPORT_TEMPLATE_TEST
|
||||
#undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/platform/platform-posix.cc b/mod/v8-15.0.245.2/src/base/platform/platform-posix.cc
|
||||
index dfb30b6..6ce12a5 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/platform/platform-posix.cc
|
||||
+++ b/mod/v8-15.0.245.2/src/base/platform/platform-posix.cc
|
||||
@@ -95,7 +95,7 @@ extern int madvise(caddr_t, size_t, int);
|
||||
#endif
|
||||
|
||||
#if defined(V8_LIBC_GLIBC)
|
||||
-extern "C" void* __libc_stack_end;
|
||||
+extern "C" void* __libc_stack_end V8_WEAK;
|
||||
#endif
|
||||
|
||||
namespace v8 {
|
||||
@@ -1476,7 +1476,8 @@ Stack::StackSlot Stack::ObtainCurrentThreadStackStart() {
|
||||
// __libc_stack_end is process global and thus is only valid for
|
||||
// the main thread. Check whether this is the main thread by checking
|
||||
// __libc_stack_end is within the thread's stack.
|
||||
- if ((base <= __libc_stack_end) && (__libc_stack_end <= stack_start)) {
|
||||
+ if (__libc_stack_end != nullptr &&
|
||||
+ (base <= __libc_stack_end) && (__libc_stack_end <= stack_start)) {
|
||||
DCHECK(MainThreadIsCurrentThread());
|
||||
return __libc_stack_end;
|
||||
}
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/platform/platform-win32.cc b/mod/v8-15.0.245.2/src/base/platform/platform-win32.cc
|
||||
index 11f9772..854a682 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/platform/platform-win32.cc
|
||||
+++ b/mod/v8-15.0.245.2/src/base/platform/platform-win32.cc
|
||||
@@ -20,7 +20,11 @@
|
||||
#include <windows.h>
|
||||
|
||||
// This has to come after windows.h.
|
||||
+#ifdef __MINGW32__
|
||||
+#include <versionhelpers.h>
|
||||
+#else
|
||||
#include <VersionHelpers.h>
|
||||
+#endif
|
||||
#include <dbghelp.h> // For SymLoadModule64 and al.
|
||||
#include <malloc.h> // For _msize()
|
||||
#include <mmsystem.h> // For timeGetTime().
|
||||
@@ -69,9 +73,7 @@ static_assert(offsetof(V8_CRITICAL_SECTION, SpinCount) ==
|
||||
// Extra functions for MinGW. Most of these are the _s functions which are in
|
||||
// the Microsoft Visual Studio C++ CRT.
|
||||
#ifdef __MINGW32__
|
||||
-
|
||||
-
|
||||
-#ifndef __MINGW64_VERSION_MAJOR
|
||||
+#if !defined(__MINGW64_VERSION_MAJOR)
|
||||
|
||||
#define _TRUNCATE 0
|
||||
#define STRUNCATE 80
|
||||
@@ -81,9 +83,6 @@ inline void MemoryFence() {
|
||||
__asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier));
|
||||
}
|
||||
|
||||
-#endif // __MINGW64_VERSION_MAJOR
|
||||
-
|
||||
-
|
||||
int localtime_s(tm* out_tm, const time_t* time) {
|
||||
tm* posix_local_time_struct = localtime_r(time, out_tm);
|
||||
if (posix_local_time_struct == nullptr) return 1;
|
||||
@@ -134,6 +133,8 @@ int strncpy_s(char* dest, size_t dest_size, const char* source, size_t count) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#endif // !defined(__MINGW64_VERSION_MAJOR)
|
||||
+
|
||||
#endif // __MINGW32__
|
||||
|
||||
namespace v8 {
|
||||
@@ -743,8 +744,10 @@ void OS::StrNCpy(char* dest, int length, const char* src, size_t n) {
|
||||
}
|
||||
|
||||
|
||||
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
#undef _TRUNCATE
|
||||
#undef STRUNCATE
|
||||
+#endif
|
||||
|
||||
DEFINE_LAZY_LEAKY_OBJECT_GETTER(RandomNumberGenerator,
|
||||
GetPlatformRandomNumberGenerator)
|
||||
@@ -1943,3 +1946,4 @@ Stack::StackSlot Stack::GetCurrentStackPosition() {
|
||||
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
+
|
||||
diff --git a/orig/v8-15.0.245.2/src/base/platform/time.cc b/mod/v8-15.0.245.2/src/base/platform/time.cc
|
||||
index 8c824e3..f8144d0 100644
|
||||
--- a/orig/v8-15.0.245.2/src/base/platform/time.cc
|
||||
+++ b/mod/v8-15.0.245.2/src/base/platform/time.cc
|
||||
@@ -782,12 +782,12 @@ bool ThreadTicks::IsSupported() {
|
||||
#elif defined(__PASE__)
|
||||
// Thread CPU time accounting is unavailable in PASE
|
||||
return false;
|
||||
+#elif defined(V8_OS_WIN)
|
||||
+ return IsSupportedWin();
|
||||
#elif (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
|
||||
defined(V8_OS_DARWIN) || defined(V8_OS_ANDROID) || \
|
||||
defined(V8_OS_SOLARIS) || defined(V8_OS_ZOS)
|
||||
return true;
|
||||
-#elif defined(V8_OS_WIN)
|
||||
- return IsSupportedWin();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -804,13 +804,13 @@ ThreadTicks ThreadTicks::Now() {
|
||||
return ThreadTicks(ComputeThreadTicks());
|
||||
#elif V8_OS_FUCHSIA
|
||||
return ThreadTicks(GetFuchsiaThreadTicks());
|
||||
+#elif V8_OS_WIN
|
||||
+ return ThreadTicks::GetForThread(::GetCurrentThread());
|
||||
#elif (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
|
||||
defined(V8_OS_ANDROID) || defined(V8_OS_ZOS)
|
||||
return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
|
||||
#elif V8_OS_SOLARIS
|
||||
return ThreadTicks(gethrvtime() / Time::kNanosecondsPerMicrosecond);
|
||||
-#elif V8_OS_WIN
|
||||
- return ThreadTicks::GetForThread(::GetCurrentThread());
|
||||
#else
|
||||
UNREACHABLE();
|
||||
#endif
|
||||
diff --git a/orig/v8-15.0.245.2/src/libplatform/default-thread-isolated-allocator.cc b/mod/v8-15.0.245.2/src/libplatform/default-thread-isolated-allocator.cc
|
||||
index bda0e43..b44f1d9 100644
|
||||
--- a/orig/v8-15.0.245.2/src/libplatform/default-thread-isolated-allocator.cc
|
||||
+++ b/mod/v8-15.0.245.2/src/libplatform/default-thread-isolated-allocator.cc
|
||||
@@ -23,7 +23,7 @@ extern int pkey_free(int pkey) V8_WEAK;
|
||||
|
||||
namespace {
|
||||
|
||||
-bool KernelHasPkruFix() {
|
||||
+[[maybe_unused]] bool KernelHasPkruFix() {
|
||||
// PKU was broken on Linux kernels before 5.13 (see
|
||||
// https://lore.kernel.org/all/20210623121456.399107624@linutronix.de/).
|
||||
// A fix is also included in the 5.4.182 and 5.10.103 versions ("x86/fpu:
|
||||
75
patches/webrtc-sys_hermetic_darwin_sysroot.patch
Normal file
75
patches/webrtc-sys_hermetic_darwin_sysroot.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
diff --git a/build.rs b/build.rs
|
||||
index 3b4a24a..6aa06ff 100644
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -15,1 +15,2 @@
|
||||
-use std::path::Path;
|
||||
+use std::fs;
|
||||
+use std::path::Path;
|
||||
@@ -118,1 +119,9 @@
|
||||
- println!("cargo:rustc-link-search=native={}", webrtc_lib.to_str().unwrap());
|
||||
+ let webrtc_link_lib = if env::var_os("WEBRTC_SYS_LINK_OUT_DIR").is_some() {
|
||||
+ let out_lib = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("lib");
|
||||
+ fs::create_dir_all(&out_lib).unwrap();
|
||||
+ fs::copy(webrtc_lib.join("libwebrtc.a"), out_lib.join("libwebrtc.a")).unwrap();
|
||||
+ out_lib
|
||||
+ } else {
|
||||
+ webrtc_lib
|
||||
+ };
|
||||
+ println!("cargo:rustc-link-search=native={}", webrtc_link_lib.to_str().unwrap());
|
||||
@@ -255,1 +264,1 @@
|
||||
- println!("cargo:rustc-link-lib=framework=Appkit");
|
||||
+ println!("cargo:rustc-link-lib=framework=AppKit");
|
||||
@@ -320,1 +329,18 @@
|
||||
- builder.warnings(false).compile("webrtcsys-cxx");
|
||||
+ builder.warnings(false).compile("webrtcsys-cxx");
|
||||
+ let cxxbridge_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("cxxbridge");
|
||||
+ let cxx_header = cxxbridge_dir.join("include/rust/cxx.h");
|
||||
+ if fs::symlink_metadata(&cxx_header)
|
||||
+ .is_ok_and(|metadata| metadata.file_type().is_symlink())
|
||||
+ {
|
||||
+ if let Ok(header) = fs::read(&cxx_header) {
|
||||
+ fs::remove_file(&cxx_header).unwrap();
|
||||
+ fs::write(&cxx_header, header).unwrap();
|
||||
+ }
|
||||
+ }
|
||||
+ let crate_link = cxxbridge_dir.join("crate/webrtc-sys");
|
||||
+ if fs::symlink_metadata(&crate_link)
|
||||
+ .is_ok_and(|metadata| metadata.file_type().is_symlink())
|
||||
+ {
|
||||
+ fs::remove_file(crate_link).unwrap();
|
||||
+ }
|
||||
+
|
||||
@@ -375,1 +384,3 @@
|
||||
- println!("cargo:rustc-link-lib={}", clang_rt);
|
||||
+ if env::var_os("WEBRTC_SYS_LINK_OUT_DIR").is_none() {
|
||||
+ println!("cargo:rustc-link-lib={}", clang_rt);
|
||||
+ }
|
||||
@@ -378,6 +389,21 @@
|
||||
- let sysroot = Command::new("xcrun").args(["--sdk", sdk, "--show-sdk-path"]).output().unwrap();
|
||||
-
|
||||
- let sysroot = String::from_utf8_lossy(&sysroot.stdout);
|
||||
- let sysroot = sysroot.trim();
|
||||
-
|
||||
- let search_dirs = Command::new("cc").arg("--print-search-dirs").output().unwrap();
|
||||
+ let sysroot = env::var("WEBRTC_SYS_DARWIN_SDK_PATH").unwrap_or_else(|_| {
|
||||
+ let output = Command::new("xcrun")
|
||||
+ .args(["--sdk", sdk, "--show-sdk-path"])
|
||||
+ .output()
|
||||
+ .unwrap();
|
||||
+ String::from_utf8_lossy(&output.stdout).into_owned()
|
||||
+ });
|
||||
+
|
||||
+ let sysroot = sysroot.as_str();
|
||||
+ let sysroot = sysroot.trim();
|
||||
+ builder.flag(format!("-F{sysroot}/System/Library/Frameworks"));
|
||||
+ builder.define("__APPLICATIONSERVICES__", None);
|
||||
+ builder.flag("-include");
|
||||
+ builder.flag("CoreGraphics/CoreGraphics.h");
|
||||
+ builder.include(format!("{sysroot}/usr/include"));
|
||||
+
|
||||
+ let cc = env::var("CC").unwrap_or_else(|_| "cc".to_string());
|
||||
+ let search_dirs = Command::new(cc)
|
||||
+ .arg("--print-search-dirs")
|
||||
+ .output()
|
||||
+ .unwrap();
|
||||
10
patches/windows-link.patch
Normal file
10
patches/windows-link.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index 2d5a2a2..6e8c4cd 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -1,4 +1,4 @@
|
||||
-#![doc = include_str!("../readme.md")]
|
||||
+#![doc = "windows-link"]
|
||||
#![no_std]
|
||||
|
||||
/// Defines an external function to import.
|
||||
166
patches/windows-support-native-tools.patch
Normal file
166
patches/windows-support-native-tools.patch
Normal file
@@ -0,0 +1,166 @@
|
||||
diff --git a/windows/private/extensions/msvc_runtime.bzl b/windows/private/extensions/msvc_runtime.bzl
|
||||
--- a/windows/private/extensions/msvc_runtime.bzl
|
||||
+++ b/windows/private/extensions/msvc_runtime.bzl
|
||||
@@ -204,13 +204,20 @@
|
||||
_keep_only_children(
|
||||
repository_ctx,
|
||||
repository_ctx.path("{}/Contents/VC/Tools/MSVC/{}".format(sysroot_dir, msvc_version)),
|
||||
- ["include", "lib"],
|
||||
+ ["include", "lib", "bin"],
|
||||
)
|
||||
_keep_only_children(
|
||||
repository_ctx,
|
||||
repository_ctx.path("{}/Contents/VC/Tools/MSVC/{}/lib".format(sysroot_dir, msvc_version)),
|
||||
architectures,
|
||||
)
|
||||
+
|
||||
+ # Keep native-host tools and their support files separate from runtime inputs.
|
||||
+ bin_dir = "{}/Contents/VC/Tools/MSVC/{}/bin".format(sysroot_dir, msvc_version)
|
||||
+ _keep_only_children(repository_ctx, repository_ctx.path(bin_dir), ["HostArm64" if arch == "arm64" else "Host" + arch for arch in architectures])
|
||||
+ for arch in architectures:
|
||||
+ host = "HostArm64" if arch == "arm64" else "Host" + arch
|
||||
+ _keep_only_children(repository_ctx, repository_ctx.path(bin_dir + "/" + host), [arch])
|
||||
|
||||
def _msvc_runtime_repository_impl(repository_ctx):
|
||||
_check_msvc_license_requirements(repository_ctx)
|
||||
diff --git a/windows/private/extensions/msvc_runtime.BUILD.bazel b/windows/private/extensions/msvc_runtime.BUILD.bazel
|
||||
--- a/windows/private/extensions/msvc_runtime.BUILD.bazel
|
||||
+++ b/windows/private/extensions/msvc_runtime.BUILD.bazel
|
||||
@@ -17,6 +17,7 @@
|
||||
name = "sysroot_files",
|
||||
srcs = glob(
|
||||
["__MSVC_RUNTIME_DIR__/**"],
|
||||
+ exclude = ["__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/**"],
|
||||
allow_empty = True,
|
||||
),
|
||||
)
|
||||
@@ -98,6 +99,7 @@
|
||||
"**/*.hh",
|
||||
"**/*.hpp",
|
||||
],
|
||||
+ exclude = ["__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/**"],
|
||||
allow_empty = True,
|
||||
),
|
||||
)
|
||||
@@ -106,6 +108,37 @@
|
||||
name = "libs",
|
||||
srcs = glob(
|
||||
["**/*.lib"],
|
||||
+ exclude = ["__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/**"],
|
||||
allow_empty = True,
|
||||
),
|
||||
)
|
||||
+
|
||||
+# Native build tools are opt-in; ordinary sysroot users keep only headers/libs.
|
||||
+
|
||||
+directory(
|
||||
+ name = "msvc_tools_x64_files",
|
||||
+ srcs = glob(
|
||||
+ ["__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/Hostx64/x64/**"],
|
||||
+ allow_empty = True,
|
||||
+ ),
|
||||
+)
|
||||
+
|
||||
+subdirectory(
|
||||
+ name = "msvc_tools_x64",
|
||||
+ parent = ":msvc_tools_x64_files",
|
||||
+ path = "__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/Hostx64/x64",
|
||||
+)
|
||||
+
|
||||
+directory(
|
||||
+ name = "msvc_tools_arm64_files",
|
||||
+ srcs = glob(
|
||||
+ ["__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/HostArm64/arm64/**"],
|
||||
+ allow_empty = True,
|
||||
+ ),
|
||||
+)
|
||||
+
|
||||
+subdirectory(
|
||||
+ name = "msvc_tools_arm64",
|
||||
+ parent = ":msvc_tools_arm64_files",
|
||||
+ path = "__MSVC_RUNTIME_DIR__/Contents/VC/Tools/MSVC/__MSVC_VERSION__/bin/HostArm64/arm64",
|
||||
+)
|
||||
diff --git a/windows/private/extensions/windows_sdk.bzl b/windows/private/extensions/windows_sdk.bzl
|
||||
--- a/windows/private/extensions/windows_sdk.bzl
|
||||
+++ b/windows/private/extensions/windows_sdk.bzl
|
||||
@@ -31,13 +31,18 @@
|
||||
def _keep_exposed_windows_sdk_files(repository_ctx, sysroot_dir, include_version, architectures):
|
||||
_keep_only_children(repository_ctx, repository_ctx.path(sysroot_dir), ["base"] + architectures)
|
||||
_keep_only_children(repository_ctx, repository_ctx.path("{}/base".format(sysroot_dir)), ["c"])
|
||||
- _keep_only_children(repository_ctx, repository_ctx.path("{}/base/c".format(sysroot_dir)), ["Include"])
|
||||
+ _keep_only_children(repository_ctx, repository_ctx.path("{}/base/c".format(sysroot_dir)), ["Include", "bin"])
|
||||
_keep_only_children(repository_ctx, repository_ctx.path("{}/base/c/Include".format(sysroot_dir)), [include_version])
|
||||
_keep_only_children(
|
||||
repository_ctx,
|
||||
repository_ctx.path("{}/base/c/Include/{}".format(sysroot_dir, include_version)),
|
||||
["ucrt", "shared", "um", "winrt"],
|
||||
)
|
||||
+
|
||||
+ # Resource and manifest tools share the selected SDK's versioned bin tree.
|
||||
+ bin_dir = "{}/base/c/bin".format(sysroot_dir)
|
||||
+ _keep_only_children(repository_ctx, repository_ctx.path(bin_dir), [include_version])
|
||||
+ _keep_only_children(repository_ctx, repository_ctx.path(bin_dir + "/" + include_version), architectures)
|
||||
|
||||
seen_architectures = {}
|
||||
for arch in architectures:
|
||||
diff --git a/windows/private/extensions/windows_sdk.BUILD.bazel b/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
--- a/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
+++ b/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
@@ -19,6 +19,7 @@
|
||||
name = "sysroot_files",
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/**"],
|
||||
+ exclude = ["__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/**"],
|
||||
allow_empty = True,
|
||||
) + _LOGICAL_ALIASES,
|
||||
)
|
||||
@@ -210,6 +211,7 @@
|
||||
"**/*.hh",
|
||||
"**/*.hpp",
|
||||
],
|
||||
+ exclude = ["__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/**"],
|
||||
allow_empty = True,
|
||||
) + [
|
||||
f
|
||||
@@ -222,6 +224,7 @@
|
||||
name = "libs",
|
||||
srcs = glob(
|
||||
["**/*.lib"],
|
||||
+ exclude = ["__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/**"],
|
||||
allow_empty = True,
|
||||
) + [
|
||||
f
|
||||
@@ -229,3 +232,33 @@
|
||||
if f.endswith(".lib")
|
||||
],
|
||||
)
|
||||
+
|
||||
+# Native build tools are opt-in; ordinary sysroot users keep only headers/libs.
|
||||
+
|
||||
+directory(
|
||||
+ name = "winsdk_tools_x64_files",
|
||||
+ srcs = glob(
|
||||
+ ["__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/x64/**"],
|
||||
+ allow_empty = True,
|
||||
+ ),
|
||||
+)
|
||||
+
|
||||
+subdirectory(
|
||||
+ name = "winsdk_tools_x64",
|
||||
+ parent = ":winsdk_tools_x64_files",
|
||||
+ path = "__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/x64",
|
||||
+)
|
||||
+
|
||||
+directory(
|
||||
+ name = "winsdk_tools_arm64_files",
|
||||
+ srcs = glob(
|
||||
+ ["__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/arm64/**"],
|
||||
+ allow_empty = True,
|
||||
+ ),
|
||||
+)
|
||||
+
|
||||
+subdirectory(
|
||||
+ name = "winsdk_tools_arm64",
|
||||
+ parent = ":winsdk_tools_arm64_files",
|
||||
+ path = "__WINSDK_DIR__/base/c/bin/__WINSDK_INCLUDE_VERSION__/arm64",
|
||||
+)
|
||||
235
patches/windows-support-remote-case-aliases.patch
Normal file
235
patches/windows-support-remote-case-aliases.patch
Normal file
@@ -0,0 +1,235 @@
|
||||
diff --git a/windows/private/extensions/windows_sdk.bzl b/windows/private/extensions/windows_sdk.bzl
|
||||
index 420cee4..16d2cf3 100644
|
||||
--- a/windows/private/extensions/windows_sdk.bzl
|
||||
+++ b/windows/private/extensions/windows_sdk.bzl
|
||||
@@ -133,19 +133,18 @@ def _repository_fs_is_case_sensitive(repository_ctx):
|
||||
def _apply_transformations(repository_ctx):
|
||||
transformations = repository_ctx.attr.transformations
|
||||
if not transformations:
|
||||
- return
|
||||
+ return []
|
||||
|
||||
sysroot = repository_ctx.path(_SYSROOT_DIR)
|
||||
if not sysroot.exists:
|
||||
- return
|
||||
- if not _repository_fs_is_case_sensitive(repository_ctx):
|
||||
- # Case-only aliases cannot be materialized on case-insensitive filesystems.
|
||||
- return
|
||||
+ return []
|
||||
+ repository_fs_is_case_sensitive = _repository_fs_is_case_sensitive(repository_ctx)
|
||||
|
||||
all_files = []
|
||||
_collect_files_recursive(sysroot, all_files)
|
||||
all_rel_files = [_relative_to_repo_root(repository_ctx, f) for f in all_files]
|
||||
created = {}
|
||||
+ logical_aliases = []
|
||||
|
||||
for src_pattern, transform in transformations.items():
|
||||
src_pattern = _normalize_relpath(src_pattern)
|
||||
@@ -165,11 +164,18 @@ def _apply_transformations(repository_ctx):
|
||||
if not dst_rel or dst_rel == src_rel or created.get(dst_rel, False):
|
||||
continue
|
||||
if repository_ctx.path(dst_rel).exists:
|
||||
+ if not repository_fs_is_case_sensitive and src_rel.lower() == dst_rel.lower():
|
||||
+ # Keep the alternate spelling as a Bazel source label. Bazel then
|
||||
+ # preserves that spelling in a case-sensitive remote input tree.
|
||||
+ logical_aliases.append(dst_rel)
|
||||
+ created[dst_rel] = True
|
||||
continue
|
||||
|
||||
repository_ctx.symlink(src_rel, dst_rel)
|
||||
created[dst_rel] = True
|
||||
|
||||
+ return sorted(logical_aliases)
|
||||
+
|
||||
def _windows_sdk_repository_impl(repository_ctx):
|
||||
if not repository_ctx.attr.windows_sdk_version:
|
||||
fail("windows_sdk_version must be set")
|
||||
@@ -220,8 +226,8 @@ def _windows_sdk_repository_impl(repository_ctx):
|
||||
"windows_sdk_include_versions",
|
||||
)
|
||||
|
||||
- _apply_transformations(repository_ctx)
|
||||
_keep_exposed_windows_sdk_files(repository_ctx, _SYSROOT_DIR, include_version, requested_architectures)
|
||||
+ logical_aliases = _apply_transformations(repository_ctx)
|
||||
|
||||
repository_ctx.template(
|
||||
"BUILD.bazel",
|
||||
@@ -229,6 +235,7 @@ def _windows_sdk_repository_impl(repository_ctx):
|
||||
substitutions = {
|
||||
"__WINSDK_DIR__": _SYSROOT_DIR,
|
||||
"__WINSDK_INCLUDE_VERSION__": include_version,
|
||||
+ "__WINSDK_LOGICAL_ALIASES__": repr(logical_aliases),
|
||||
},
|
||||
)
|
||||
|
||||
@@ -258,7 +265,9 @@ _WINDOWS_SDK_ATTR = {
|
||||
"transformations": attr.string_dict(
|
||||
default = {},
|
||||
doc = """
|
||||
- Dict of source path patterns to transformations applied when run on case-sensitive filesystems.
|
||||
+ Dict of source path patterns to transformations applied to extracted Windows SDK files.
|
||||
+ Case-only transformations are Bazel aliases on case-insensitive filesystems and symlinks on
|
||||
+ case-sensitive filesystems.
|
||||
|
||||
Supports exact paths and `**/*.ext` patterns. Use value `lowercase` to create lowercase aliases.
|
||||
|
||||
diff --git a/windows/private/extensions/windows_sdk.BUILD.bazel b/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
index 0d03f4e..199fdf0 100644
|
||||
--- a/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
+++ b/windows/private/extensions/windows_sdk.BUILD.bazel
|
||||
@@ -5,6 +5,8 @@ load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
+_LOGICAL_ALIASES = __WINSDK_LOGICAL_ALIASES__
|
||||
+
|
||||
config_setting(
|
||||
name = "windows_aarch64",
|
||||
constraint_values = [
|
||||
@@ -18,7 +20,7 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + _LOGICAL_ALIASES,
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -32,7 +34,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/ucrt/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/ucrt/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -46,7 +52,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/shared/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/shared/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -60,7 +70,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/um/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/um/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -74,7 +88,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/winrt/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/base/c/Include/__WINSDK_INCLUDE_VERSION__/winrt/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -88,7 +106,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/arm64/c/ucrt/arm64/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/arm64/c/ucrt/arm64/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -102,7 +124,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/x64/c/ucrt/x64/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/x64/c/ucrt/x64/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -116,7 +142,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/arm64/c/um/arm64/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/arm64/c/um/arm64/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -130,7 +160,11 @@ directory(
|
||||
srcs = glob(
|
||||
["__WINSDK_DIR__/x64/c/um/x64/**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.startswith("__WINSDK_DIR__/x64/c/um/x64/")
|
||||
+ ],
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
@@ -160,7 +194,7 @@ filegroup(
|
||||
srcs = glob(
|
||||
["**"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + _LOGICAL_ALIASES,
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -177,7 +211,11 @@ filegroup(
|
||||
"**/*.hpp",
|
||||
],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.endswith(".h") or f.endswith(".hh") or f.endswith(".hpp")
|
||||
+ ],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -185,5 +223,9 @@ filegroup(
|
||||
srcs = glob(
|
||||
["**/*.lib"],
|
||||
allow_empty = True,
|
||||
- ),
|
||||
+ ) + [
|
||||
+ f
|
||||
+ for f in _LOGICAL_ALIASES
|
||||
+ if f.endswith(".lib")
|
||||
+ ],
|
||||
)
|
||||
14
patches/xz_windows_stack_args.patch
Normal file
14
patches/xz_windows_stack_args.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git a/BUILD.bazel b/BUILD.bazel
|
||||
--- a/BUILD.bazel
|
||||
+++ b/BUILD.bazel
|
||||
@@ -154,6 +154,9 @@ cc_library(
|
||||
],
|
||||
copts = select({
|
||||
- "@platforms//os:windows": [],
|
||||
+ "@platforms//os:windows": [
|
||||
+ "-fno-stack-protector",
|
||||
+ "-mno-stack-arg-probe",
|
||||
+ ],
|
||||
"//conditions:default": ["-std=c99"],
|
||||
}),
|
||||
defines = select({
|
||||
Reference in New Issue
Block a user