Skip to content

Commit

Permalink
cr-patches: update for 6312
Browse files Browse the repository at this point in the history
  • Loading branch information
licy183 committed Mar 22, 2024
1 parent 399c8b1 commit 73f79d0
Show file tree
Hide file tree
Showing 13 changed files with 1,215 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common-files/apply-chromium-patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def execute(args, p):
break
else:
applied_patches.append(patch_path)
if need_revert:
if need_revert and not is_dry_run_mode:
ope_str = "re-apply" if is_revert_mode else "revert"
logger.info("%sing patches due to previous error...", ope_str.capitalize())
for patch_path in applied_patches[::-1]:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
std::bit_cast doesn't exist in libstdcxx 10

--- a/base/numerics/byte_conversions.h
+++ b/base/numerics/byte_conversions.h
@@ -11,6 +11,7 @@
#include <span>
#include <type_traits>

+#include "absl/base/casts.h"
#include "base/numerics/basic_ops_impl.h"

namespace base::numerics {
@@ -80,7 +81,7 @@
// storage, and explicit big endian for network order.
inline constexpr float FloatFromNativeEndian(
std::span<const uint8_t, 4u> bytes) {
- return std::bit_cast<float>(U32FromNativeEndian(bytes));
+ return absl::bit_cast<float>(U32FromNativeEndian(bytes));
}
// Returns a double with the value in `bytes` interpreted as the native endian
// encoding of the number for the machine.
@@ -91,7 +92,7 @@
// storage, and explicit big endian for network order.
inline constexpr double DoubleFromNativeEndian(
std::span<const uint8_t, 8u> bytes) {
- return std::bit_cast<double>(U64FromNativeEndian(bytes));
+ return absl::bit_cast<double>(U64FromNativeEndian(bytes));
}

// Returns a uint8_t with the value in `bytes` interpreted as a little-endian
@@ -156,7 +157,7 @@
// buffer.
inline constexpr float FloatFromLittleEndian(
std::span<const uint8_t, 4u> bytes) {
- return std::bit_cast<float>(U32FromLittleEndian(bytes));
+ return absl::bit_cast<float>(U32FromLittleEndian(bytes));
}
// Returns a double with the value in `bytes` interpreted as a little-endian
// encoding of the integer.
@@ -168,7 +169,7 @@
// buffer.
inline constexpr double DoubleFromLittleEndian(
std::span<const uint8_t, 8u> bytes) {
- return std::bit_cast<double>(U64FromLittleEndian(bytes));
+ return absl::bit_cast<double>(U64FromLittleEndian(bytes));
}

// Returns a uint8_t with the value in `bytes` interpreted as a big-endian
@@ -223,7 +224,7 @@
// that were always in memory, such as when stored in shared-memory (or through
// IPC) as a byte buffer.
inline constexpr float FloatFromBigEndian(std::span<const uint8_t, 4u> bytes) {
- return std::bit_cast<float>(U32FromBigEndian(bytes));
+ return absl::bit_cast<float>(U32FromBigEndian(bytes));
}
// Returns a double with the value in `bytes` interpreted as a big-endian
// encoding of the integer.
@@ -234,7 +235,7 @@
// IPC) as a byte buffer.
inline constexpr double DoubleFromBigEndian(
std::span<const uint8_t, 8u> bytes) {
- return std::bit_cast<double>(U64FromBigEndian(bytes));
+ return absl::bit_cast<double>(U64FromBigEndian(bytes));
}

// Returns a byte array holding the value of a uint8_t encoded as the native
@@ -285,7 +286,7 @@
// byte buffer. Prefer an explicit little endian when storing data into external
// storage, and explicit big endian for network order.
inline constexpr std::array<uint8_t, 4u> FloatToNativeEndian(float val) {
- return U32ToNativeEndian(std::bit_cast<uint32_t>(val));
+ return U32ToNativeEndian(absl::bit_cast<uint32_t>(val));
}
// Returns a byte array holding the value of a double encoded as the native
// endian encoding of the number for the machine.
@@ -295,7 +296,7 @@
// byte buffer. Prefer an explicit little endian when storing data into external
// storage, and explicit big endian for network order.
inline constexpr std::array<uint8_t, 8u> DoubleToNativeEndian(double val) {
- return U64ToNativeEndian(std::bit_cast<uint64_t>(val));
+ return U64ToNativeEndian(absl::bit_cast<uint64_t>(val));
}

// Returns a byte array holding the value of a uint8_t encoded as the
@@ -351,7 +352,7 @@
// memory, such as when stored in shared-memory (or passed through IPC) as a
// byte buffer.
inline constexpr std::array<uint8_t, 4u> FloatToLittleEndian(float val) {
- return internal::ToLittleEndian(std::bit_cast<uint32_t>(val));
+ return internal::ToLittleEndian(absl::bit_cast<uint32_t>(val));
}
// Returns a byte array holding the value of a double encoded as the
// little-endian encoding of the number.
@@ -362,7 +363,7 @@
// memory, such as when stored in shared-memory (or passed through IPC) as a
// byte buffer.
inline constexpr std::array<uint8_t, 8u> DoubleToLittleEndian(double val) {
- return internal::ToLittleEndian(std::bit_cast<uint64_t>(val));
+ return internal::ToLittleEndian(absl::bit_cast<uint64_t>(val));
}

// Returns a byte array holding the value of a uint8_t encoded as the big-endian
@@ -418,7 +419,7 @@
// IPC) as a byte buffer. Use the little-endian encoding for storing and reading
// from storage.
inline constexpr std::array<uint8_t, 4u> FloatToBigEndian(float val) {
- return internal::ToLittleEndian(ByteSwap(std::bit_cast<uint32_t>(val)));
+ return internal::ToLittleEndian(ByteSwap(absl::bit_cast<uint32_t>(val)));
}
// Returns a byte array holding the value of a double encoded as the big-endian
// encoding of the number.
@@ -429,7 +430,7 @@
// IPC) as a byte buffer. Use the little-endian encoding for storing and reading
// from storage.
inline constexpr std::array<uint8_t, 8u> DoubleToBigEndian(double val) {
- return internal::ToLittleEndian(ByteSwap(std::bit_cast<uint64_t>(val)));
+ return internal::ToLittleEndian(ByteSwap(absl::bit_cast<uint64_t>(val)));
}

} // namespace base::numerics
45 changes: 45 additions & 0 deletions common-files/chromium-patches/compiler-clang-lib-dir/6312.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--- a/build/config/clang/clang.gni
+++ b/build/config/clang/clang.gni
@@ -35,6 +35,9 @@
# Set to true to enable output of ThinLTO index and import files used for
# creating a Chromium MLGO corpus in the ThinLTO case.
lld_emit_indexes_and_imports = false
+
+ custom_toolchain_clang_base_path = ""
+ custom_toolchain_clang_version = ""
}

# We don't really need to collect a corpus for the host tools, just for the target.
--- a/build/config/clang/BUILD.gn
+++ b/build/config/clang/BUILD.gn
@@ -5,6 +5,8 @@
import("//build/config/rust.gni")
import("clang.gni")

+import("//v8/gni/snapshot_toolchain.gni")
+
if (is_ios) {
import("//build/config/ios/config.gni") # For `target_environment`
}
@@ -186,6 +186,21 @@
}

_clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib"
+
+ if (is_a_target_toolchain && current_toolchain != v8_snapshot_toolchain) {
+ _dir = "linux"
+ _clang_lib_dir = "$custom_toolchain_clang_base_path/lib/clang/$custom_toolchain_clang_version/lib"
+ if (current_cpu == "x64") {
+ _suffix = "-x86_64-android"
+ } else if (current_cpu == "arm") {
+ _suffix = "-arm-android"
+ } else if (current_cpu == "arm64") {
+ _suffix = "-aarch64-android"
+ } else {
+ assert(false) # Unhandled cpu type
+ }
+ }
+
_lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}"
libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -7,6 +7,8 @@
import("//build/config/sanitizers/sanitizers.gni")
import("//build/toolchain/toolchain.gni")

+import("//v8/gni/snapshot_toolchain.gni")
+
if (is_android) {
import("//build/config/android/config.gni")
}
@@ -98,6 +100,8 @@
# a platform. Mostly applicable to Windows, where new versions can handle ANSI
# escape sequences but it's not reliable in general.
force_rustc_color_output = false
+
+ custom_target_rust_abi_target = ""
}

# Use a separate declare_args so these variables' defaults can depend on the
@@ -165,7 +169,7 @@
# TODO(crbug.com/1278030): To build unit tests for Android we need to build
# them as a dylib and put them into an APK. We should reuse all the same logic
# for gtests from the `//testing/test:test` template.
-can_build_rust_unit_tests = toolchain_has_rust && !is_android
+can_build_rust_unit_tests = toolchain_has_rust && !is_android && false

# We want to store rust_sysroot as a source-relative variable for ninja
# portability. In practice if an external toolchain was specified, it might
@@ -280,6 +284,12 @@
}
}

+if (!toolchain_for_rust_host_build_tools && current_toolchain != v8_snapshot_toolchain && current_toolchain != host_toolchain) {
+ if (custom_target_rust_abi_target != "") {
+ rust_abi_target = custom_target_rust_abi_target
+ }
+}
+
assert(!toolchain_has_rust || rust_abi_target != "")

# This variable is passed to the Rust libstd build.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/build/config/c++/c++.gni
+++ b/build/config/c++/c++.gni
@@ -6,6 +6,8 @@
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")

+import("//v8/gni/snapshot_toolchain.gni")
+
declare_args() {
# Use in-tree libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of the system C++ library for C++
@@ -42,6 +44,8 @@

use_custom_libcxx =
use_custom_libcxx || (use_custom_libcxx_for_host && !is_a_target_toolchain)
+use_custom_libcxx =
+ use_custom_libcxx || (use_custom_libcxx_for_host && current_toolchain == v8_snapshot_toolchain)
use_custom_libcxx = use_custom_libcxx && !is_nacl

declare_args() {
46 changes: 41 additions & 5 deletions common-files/chromium-patches/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@
"chromium-no-set-process-title/5615.patch": {
"start": 5615
},
"chromium-numerics-byte_conversions-no-std-bit_cast/6312.patch": {
"start": 6312
},
"chromium-redefine-termios2/5359.patch": {
"start": 5359
},
Expand All @@ -321,6 +324,12 @@
"start": 5481,
"end": 5487
},
"compiler-clang-lib-dir/6312.patch": {
"start": 6312
},
"compiler-custom-rust-abi-target-triple/6312.patch": {
"start": 6312
},
"compiler-no-unused-but-set-variable/4389.patch": {
"start": 4389,
"end": 4472
Expand Down Expand Up @@ -387,6 +396,9 @@
"compiler-use-android-target/5414.patch": {
"start": 5414
},
"compiler-use-custom-libcxx-for-v8/6312.patch": {
"start": 6312
},
"cpuinfo-android-arm/5249.patch": {
"start": 5249,
"end": 6260
Expand Down Expand Up @@ -512,6 +524,9 @@
"perfetto-no-pthread_getname_np/6099.patch": {
"start": 6099
},
"performance_manager-context_collection-no-constexpr-operator-equal/6312.patch": {
"start": 6312
},
"persistent_histogram_allocator-constructor/6045.patch": {
"start": 6045
},
Expand All @@ -537,24 +552,37 @@
"end": 6260
},
"resource_attribution-query_params-no-constexpr-operator-equal/6261.patch": {
"start": 6261
"start": 6261,
"end": 6311
},
"resource_attribution-query_params-no-constexpr-operator-equal/6312.patch": {
"start": 6312
},
"revert-blink-v8-cxx20/6167.patch": {
"start": 6167,
"end": 6260
},
"revert-blink-v8-cxx20/6261.patch": {
"start": 6261
"start": 6261,
"end": 6311
},
"revert-blink-v8-cxx20/6312.patch": {
"start": 6312
},
"revert-blink-v8-cxx20-2/6261.patch": {
"start": 6261
"start": 6261,
"end": 6311
},
"revert-blink-v8-cxx20-2/6312.patch": {
"start": 6312
},
"revert-rust-qr-scanner/6167.patch": {
"start": 6167,
"end": 6260
},
"revert-rust-qr-scanner/6261.patch": {
"start": 6261
"start": 6261,
"end": 6261
},
"revert-split-out-ios-shared-feed-protos/5615.patch": {
"start": 5615,
Expand All @@ -564,6 +592,9 @@
"start": 9999999,
"comment": "Disable since 115.0.5790.98-1"
},
"simple_url_pattern_matcher-no-constexpr-string/6312.patch" : {
"start": 6312
},
"sql-VirtualCursor-standard-layout/5359.patch": {
"start": 5359,
"end": 5734
Expand Down Expand Up @@ -613,7 +644,9 @@
"end": 5413
},
"undo-internal-alloc/6261.patch": {
"start": 6261
"start": 6261,
"end": 6261,
"comment": "Disable since 123.0.6312.58, from which clang and libcxx shipped by chromium is used to build host binaries"
},
"unity-fix-dynamic-loaded-libraries/4389.patch": {
"start": 4389
Expand Down Expand Up @@ -795,6 +828,9 @@
"z-iwyu-material_color_utilities-include-cmath/5938.patch": {
"start": 5938
},
"z-iwyu-preview_cancel_reason-include-string/6312.patch": {
"start": 6312
},
"z-iwyu-sensor_reading-inttypes/5993.patch": {
"start": 5993,
"end": 6044
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/components/performance_manager/resource_attribution/context_collection.h
+++ b/components/performance_manager/resource_attribution/context_collection.h
@@ -28,7 +28,7 @@
ContextCollection(const ContextCollection& other);
ContextCollection& operator=(const ContextCollection& other);

- friend constexpr bool operator==(const ContextCollection&,
+ friend bool operator==(const ContextCollection&,
const ContextCollection&) = default;

// Adds `context` to the collection.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error: defaulted definition of equality comparison operator cannot be declared constexpr because it invokes a non-constexpr comparison function

--- a/components/performance_manager/resource_attribution/query_params.h
+++ b/components/performance_manager/resource_attribution/query_params.h
@@ -67,7 +67,7 @@
QueryParams(const QueryParams& other);
QueryParams& operator=(const QueryParams& other);

- friend constexpr bool operator==(const QueryParams&,
+ friend bool operator==(const QueryParams&,
const QueryParams&) = default;

// Resource types to measure.
Loading

0 comments on commit 73f79d0

Please sign in to comment.