Roll icu to 43953f57b037778a1b8005564afabe214834f7bd.
Embed the Flutter version of icutl.dat to keep \p{Emoji} etc working.
TEST=corelib/regexp/unicode-property-binary_test
Bug: https://github.com/dart-lang/sdk/issues/50248
Change-Id: I91124690160fead3e1ba841f4244595ba338387c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375180
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/DEPS b/DEPS
index cd9e92e..356c0d8 100644
--- a/DEPS
+++ b/DEPS
@@ -103,7 +103,7 @@
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
"cpu_features_rev": "936b9ab5515dead115606559502e3864958f7f6e",
"devtools_rev": "e77d6ce142b7bc737af3652f5727e449e84b7b03",
- "icu_rev": "81d656878ec611cb0b42d52c82e9dae93920d9ba",
+ "icu_rev": "43953f57b037778a1b8005564afabe214834f7bd",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"libcxx_rev": "44079a4cc04cdeffb9cfe8067bfb3c276fb2bab0",
"libcxxabi_rev": "2ce528fb5e0f92e57c97ec3ff53b75359d33af12",
diff --git a/build/config/arm.gni b/build/config/arm.gni
index fa9934f1..23489e3 100644
--- a/build/config/arm.gni
+++ b/build/config/arm.gni
@@ -76,3 +76,7 @@
}
}
}
+
+if (current_cpu == "arm64") {
+ arm_control_flow_integrity = "none"
+}
diff --git a/build/config/features.gni b/build/config/features.gni
new file mode 100644
index 0000000..976d628
--- /dev/null
+++ b/build/config/features.gni
@@ -0,0 +1,23 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file contains Chrome-feature-related build flags (see ui.gni for
+# UI-related ones). These should theoretically be moved to the build files of
+# the features themselves.
+#
+# However, today we have many "bad" dependencies on some of these flags from,
+# e.g. base, so they need to be global to match the GYP configuration. Also,
+# anything that needs a grit define must be in either this file or ui.gni.
+#
+# PLEASE TRY TO AVOID ADDING FLAGS TO THIS FILE in cases where grit isn't
+# required. See the declare_args block of BUILDCONFIG.gn for advice on how
+# to set up feature flags.
+
+if (is_android) {
+ import("//build/config/android/config.gni")
+}
+
+declare_args() {
+ use_blink = false
+}
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 2661780..52745a5 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -619,7 +619,7 @@
action(target_name) {
deps = invoker.deps
script = "../tools/bin_to_assembly.py"
- output = invoker.input + ".S"
+ output = "$target_gen_dir/$target_name.S"
args = [
"--input",
rebase_path(invoker.input, root_build_dir),
@@ -660,7 +660,7 @@
action(target_name) {
deps = invoker.deps
script = "../tools/bin_to_coff.py"
- output = invoker.input + ".o"
+ output = "$target_gen_dir/$target_name.obj"
args = [
"--input",
rebase_path(invoker.input, root_build_dir),
@@ -745,6 +745,19 @@
executable = false
}
+bin_to_linkable("icudtl_linkable") {
+ deps = []
+ if (exec_script("../tools/exists.py",
+ [ rebase_path("//third_party/icu/flutter/icudtl.dat") ],
+ "value")) {
+ input = "//third_party/icu/flutter/icudtl.dat"
+ } else {
+ input = "//flutter/third_party/icu/flutter/icudtl.dat"
+ }
+ symbol = "kIcuData"
+ executable = false
+}
+
source_set("dart_snapshot_cc") {
visibility = [ ":*" ]
deps = [
@@ -769,6 +782,12 @@
get_target_outputs(":platform_strong_dill_linkable")
}
+source_set("icudtl_cc") {
+ visibility = [ ":*" ]
+ deps = [ ":icudtl_linkable" ]
+ sources = get_target_outputs(":icudtl_linkable")
+}
+
template("dart_executable") {
use_product_mode = dart_runtime_mode == "release"
if (defined(invoker.use_product_mode)) {
@@ -813,13 +832,16 @@
}
deps = [
":crashpad",
+ ":icudtl_cc",
"//third_party/boringssl",
+ "//third_party/icu:icui18n",
+ "//third_party/icu:icuuc",
"//third_party/zlib",
]
if (is_fuchsia) {
deps += [ "$fuchsia_sdk/pkg/fdio" ]
}
- defines = extra_defines
+ defines = [ "DART_EMBED_ICU_DATA" ] + extra_defines
if (exclude_kernel_service) {
defines += [ "EXCLUDE_CFE_AND_KERNEL_PLATFORM" ]
}
@@ -831,6 +853,7 @@
"dart_embedder_api_impl.cc",
"error_exit.cc",
"error_exit.h",
+ "icu.cc",
"main_options.cc",
"main_options.h",
"options.cc",
@@ -928,6 +951,7 @@
"..:add_empty_macho_section_config",
]
extra_deps = [
+ ":icudtl_cc",
"..:libdart_precompiled_runtime",
"../platform:libdart_platform_precompiled_runtime",
]
diff --git a/runtime/bin/icu.cc b/runtime/bin/icu.cc
new file mode 100644
index 0000000..7eb4c05
--- /dev/null
+++ b/runtime/bin/icu.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "bin/icu.h"
+
+#include "unicode/udata.h"
+
+#include "platform/assert.h"
+
+#if defined(DART_EMBED_ICU_DATA)
+extern "C" const uint8_t kIcuData[];
+#endif
+
+namespace dart {
+namespace bin {
+
+#if defined(DART_EMBED_ICU_DATA)
+const uint8_t* icu_data = kIcuData;
+#endif
+
+void SetupICU() {
+#if defined(DART_EMBED_ICU_DATA)
+ // Setup ICU.
+ UErrorCode err_code = U_ZERO_ERROR;
+ udata_setCommonData(icu_data, &err_code);
+ if (err_code != U_ZERO_ERROR) {
+ FATAL("Failed to initialize ICU: %d\n", err_code);
+ }
+#endif
+}
+
+} // namespace bin
+} // namespace dart
diff --git a/runtime/bin/icu.h b/runtime/bin/icu.h
new file mode 100644
index 0000000..94b4800
--- /dev/null
+++ b/runtime/bin/icu.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_BIN_ICU_H_
+#define RUNTIME_BIN_ICU_H_
+
+namespace dart {
+namespace bin {
+
+void SetupICU();
+
+} // namespace bin
+} // namespace dart
+
+#endif // RUNTIME_BIN_ICU_H_
diff --git a/runtime/bin/main_impl.cc b/runtime/bin/main_impl.cc
index 934b351..6e2a86f 100644
--- a/runtime/bin/main_impl.cc
+++ b/runtime/bin/main_impl.cc
@@ -21,6 +21,7 @@
#include "bin/exe_utils.h"
#include "bin/file.h"
#include "bin/gzip.h"
+#include "bin/icu.h"
#include "bin/isolate_data.h"
#include "bin/loader.h"
#include "bin/main_options.h"
@@ -1171,6 +1172,8 @@
// Save the console state so we can restore it at shutdown.
Console::SaveConfig();
+ SetupICU();
+
// On Windows, the argv strings are code page encoded and not
// utf8. We need to convert them to utf8.
bool argv_converted = ShellUtils::GetUtf8Argv(argc, argv);
diff --git a/runtime/tools/exists.py b/runtime/tools/exists.py
new file mode 100755
index 0000000..58499e5
--- /dev/null
+++ b/runtime/tools/exists.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+# Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+import os
+import sys
+
+
+def main(args):
+ if os.path.isfile(args[1]):
+ print("true")
+ else:
+ print("false")
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index de02698..b5c6ef5 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -169,16 +169,12 @@
library_for_all_configs("libdart_vm") {
target_type = "source_set"
- extra_product_deps = [
- "//third_party/icu:icui18n_hidden_visibility",
- "//third_party/icu:icuuc_hidden_visibility",
- ]
- extra_nonproduct_deps = [
- ":libprotozero",
+ extra_product_deps = []
+ extra_nonproduct_deps = [ ":libprotozero" ]
+ extra_deps = [
"//third_party/icu:icui18n",
"//third_party/icu:icuuc",
]
- extra_deps = []
if (is_fuchsia) {
extra_deps += [
"$fuchsia_sdk/fidl/fuchsia.intl",