[go: nahoru, domu]

Skip to content

Commit

Permalink
chromium: rebase patches for M126
Browse files Browse the repository at this point in the history
Note that we can't just update previous patches in place, as that would
prevent electron-source and ungoogled-chrome (< M126) from building.
  • Loading branch information
emilylange committed Jun 12, 2024
1 parent bda04d2 commit 7f36179
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkgs/applications/networking/browsers/chromium/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,15 @@ let
# Chromium reads initial_preferences from its own executable directory
# This patch modifies it to read /etc/chromium/initial_preferences
./patches/chromium-initial-prefs.patch
] ++ lib.optionals (chromiumVersionAtLeast "120") [
# We need to revert this patch to build M120+ with LLVM 17:
] ++ lib.optionals (versionRange "120" "126") [
# Partial revert to build M120+ with LLVM 17:
# https://github.com/chromium/chromium/commit/02b6456643700771597c00741937e22068b0f956
# https://github.com/chromium/chromium/commit/69736ffe943ff996d4a88d15eb30103a8c854e29
./patches/chromium-120-llvm-17.patch
] ++ lib.optionals (chromiumVersionAtLeast "126") [
# Rebased variant of patch right above to build M126+ with LLVM 17.
# staging-next will bump LLVM to 18, so we will be able to drop this soon.
./patches/chromium-126-llvm-17.patch
] ++ lib.optionals (!chromiumVersionAtLeast "119.0.6024.0") [
# Fix build with at-spi2-core ≥ 2.49
# This version is still needed for electron.
Expand All @@ -286,11 +292,14 @@ let
commit = "b9bef8e9555645fc91fab705bec697214a39dbc1";
hash = "sha256-CJ1v/qc8+nwaHQR9xsx08EEcuVRbyBfCZCm/G7hRY+4=";
})
] ++ lib.optionals (chromiumVersionAtLeast "121") [
] ++ lib.optionals (versionRange "121" "126") [
# M121 is the first version to require the new rust toolchain.
# Partial revert of https://github.com/chromium/chromium/commit/3687976b0c6d36cf4157419a24a39f6770098d61
# allowing us to use our rustc and our clang.
./patches/chromium-121-rust.patch
] ++ lib.optionals (chromiumVersionAtLeast "126") [
# Rebased variant of patch right above to build M126+ with our rust and our clang.
./patches/chromium-126-rust.patch
];

postPatch = ''
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 6efe967eb0a1c..590a2c274ac13 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -568,24 +568,6 @@ config("compiler") {
}
}

- # TODO(crbug.com/40283598): This causes binary size growth and potentially
- # other problems.
- # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version.
- if (default_toolchain != "//build/toolchain/cros:target" &&
- !llvm_android_mainline) {
- cflags += [
- "-mllvm",
- "-split-threshold-for-reg-with-hint=0",
- ]
- if (use_thin_lto && is_a_target_toolchain) {
- if (is_win) {
- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
- } else {
- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
- }
- }
- }
-
# TODO(crbug.com/40192287): Investigate why/if this should be needed.
if (is_win) {
cflags += [ "/clang:-ffp-contract=off" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 6efe967eb0a1c..2ddae4efacbfa 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1653,16 +1653,6 @@ config("runtime_library") {
configs += [ "//build/config/c++:runtime_library" ]
}

- # Rust and C++ both provide intrinsics for LLVM to call for math operations. We
- # want to use the C++ intrinsics, not the ones in the Rust compiler_builtins
- # library. The Rust symbols are marked as weak, so that they can be replaced by
- # the C++ symbols. This config ensures the C++ symbols exist and are strong in
- # order to cause that replacement to occur by explicitly linking in clang's
- # compiler-rt library.
- if (is_clang && toolchain_has_rust) {
- configs += [ "//build/config/clang:compiler_builtins" ]
- }
-
# TODO(crbug.com/40570904): Come up with a better name for is POSIX + Fuchsia
# configuration.
if (is_posix || is_fuchsia) {

0 comments on commit 7f36179

Please sign in to comment.