Skip to content

Commit 21222b6

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
Revert "[vm] Build dart2native dependencies with the normal "create_sdk" target"
This reverts commit a88a328. Reason for revert: Auto roller hasn't rolled previous changes from Dart yet. Those changes updated DEPS for icu/boringssl. We have to wait with this CL until the DEPS changes have been done in the engine. Original change's description: > [vm] Build dart2native dependencies with the normal "create_sdk" target > > This removes special logic for creating the `dart-sdk` we distribute > which used to build release and product mode and copied some binaries > from the latter into the former, before the SDK was actuallly ready to > test and distribute. > > This changes the GN build rules to build the necessary > gen_snapshot/dart_precompiled_runtime product binaries during the normal > release build. > > Normally during --mode=product builds the global build config in > //build/config/BUILDCONFIG.gn will set `-fvisibility=false`. > > => Doing so results in much smaller binaries - because only explicitly > exported symbols are visible, the rest can be tree shaken by the linker. > > Since we are building --mode=release, the `-fvisibility=false` will not > be set. In order to set the flag for the 2 special product-mode binaries > we need to add -fvisibility=hidden manually, in: > > * dart_product_config: Which is used for compiling VM sources. > * 3rd party double-conversion library > * 3rd party boringssl library > * 3rd party icu library > > The upstream CLs are: > > * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482 > * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407 > > Issue #42230 > > Change-Id: I3e47664d9fadb9ed1ad033bb17d46e769442f741 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150524 > Commit-Queue: Martin Kustermann <[email protected]> > Reviewed-by: Alexander Thomas <[email protected]> > Reviewed-by: Zach Anderson <[email protected]> [email protected],[email protected],[email protected],[email protected] Change-Id: Ied0f2f5b58dceb2b59bc2ac6e11e5fd717c8885e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151382 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent f369194 commit 21222b6

File tree

12 files changed

+199
-194
lines changed

12 files changed

+199
-194
lines changed

pkg/dart2native/bin/dart2native.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ final String dartaotruntime =
1919
path.join(binDir, 'dartaotruntime${executableSuffix}');
2020
final String genSnapshot =
2121
path.join(binDir, 'utils', 'gen_snapshot${executableSuffix}');
22+
final String platformDill =
23+
path.join(sdkDir, 'lib', '_internal', 'vm_platform_strong.dill');
2224
final String productPlatformDill =
2325
path.join(sdkDir, 'lib', '_internal', 'vm_platform_strong_product.dill');
2426

@@ -43,8 +45,20 @@ Future<void> generateNative(
4345
print('Generating AOT kernel dill.');
4446
}
4547

48+
// Prefer to use the product platform file, if available. Fall back to the
49+
// normal one (this happens if `out/<build-dir>/dart-sdk` is used).
50+
//
51+
// Background information: For the `dart-sdk` we distribute we build release
52+
// and product mode configurations. Then we have an extra bundling step
53+
// which will add product-mode
54+
// gen_snapshot/dartaotruntime/vm_platform_strong_product.dill to the
55+
// release SDK (see tools/bots/dart_sdk.py:CopyAotBinaries)
56+
final String platformFileToUse = File(productPlatformDill).existsSync()
57+
? productPlatformDill
58+
: platformDill;
59+
4660
final kernelResult = await generateAotKernel(dart, genKernel,
47-
productPlatformDill, sourceFile, kernelFile, packages, defines);
61+
platformFileToUse, sourceFile, kernelFile, packages, defines);
4862
if (kernelResult.exitCode != 0) {
4963
stderr.writeln(kernelResult.stdout);
5064
stderr.writeln(kernelResult.stderr);

runtime/BUILD.gn

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,8 @@ config("dart_maybe_product_config") {
4040
# If a DEBUG build has been specified it will be ignored.
4141
config("dart_product_config") {
4242
defines = []
43-
cflags = []
4443
if (!dart_debug) {
4544
defines += [ "PRODUCT" ]
46-
if (is_posix) {
47-
cflags = [
48-
# This is the equivalent from `build/config/BUILDCONFIG.gn` which includes
49-
# `build/config/gcc:symbol_visibility_hidden` in product mode.
50-
"-fvisibility=hidden",
51-
]
52-
}
5345
}
5446
}
5547

runtime/bin/BUILD.gn

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ build_libdart_builtin("libdart_builtin_product") {
6969
extra_configs = [
7070
"..:dart_product_config",
7171
"..:dart_os_config",
72-
"..:dart_arch_config",
7372
]
7473
}
7574

@@ -137,11 +136,7 @@ template("build_elf_loader") {
137136
}
138137

139138
build_elf_loader("elf_loader") {
140-
if (dart_runtime_mode == "release") {
141-
deps = [ ":libdart_builtin_product" ]
142-
} else {
143-
deps = [ ":libdart_builtin" ]
144-
}
139+
deps = [ ":libdart_builtin" ]
145140
}
146141

147142
build_elf_loader("elf_loader_product") {
@@ -517,12 +512,6 @@ dart_io("standalone_dart_io") {
517512
extra_deps = [ ":libdart_builtin" ]
518513
}
519514

520-
dart_io("standalone_dart_io_product") {
521-
extra_configs = [ "..:dart_product_config" ]
522-
extra_sources = []
523-
extra_deps = [ ":libdart_builtin_product" ]
524-
}
525-
526515
gen_snapshot_action("generate_snapshot_bin") {
527516
deps = [ "../vm:vm_platform_stripped" ]
528517
vm_snapshot_data = "$target_gen_dir/vm_snapshot_data.bin"
@@ -743,11 +732,6 @@ action("generate_abi_version_cc_file") {
743732
}
744733

745734
template("dart_executable") {
746-
use_product_mode = dart_runtime_mode == "release"
747-
if (defined(invoker.use_product_mode)) {
748-
use_product_mode = invoker.use_product_mode
749-
}
750-
751735
extra_configs = []
752736
if (defined(invoker.extra_configs)) {
753737
extra_configs += invoker.extra_configs
@@ -777,12 +761,8 @@ template("dart_executable") {
777761
"..:dart_arch_config",
778762
"..:dart_config",
779763
"..:dart_os_config",
764+
"..:dart_maybe_product_config",
780765
] + extra_configs
781-
if (use_product_mode) {
782-
configs += [ "..:dart_product_config" ]
783-
} else {
784-
configs += [ "..:dart_maybe_product_config" ]
785-
}
786766
if (target_os != current_os && target_os == "fuchsia") {
787767
# We already have these in the standalone build, but Fuchsia doesn't
788768
# have them. They are needed for running Fuchsia binaries built for the
@@ -795,17 +775,12 @@ template("dart_executable") {
795775
}
796776

797777
deps = [
798-
":crashpad",
799-
":generate_abi_version_cc_file",
800-
"//third_party/boringssl",
801-
"//third_party/zlib",
802-
]
803-
if (use_product_mode) {
804-
deps += [ ":standalone_dart_io_product" ]
805-
} else {
806-
deps += [ ":standalone_dart_io" ]
807-
}
808-
deps += extra_deps
778+
":standalone_dart_io",
779+
"//third_party/boringssl",
780+
"//third_party/zlib",
781+
":crashpad",
782+
":generate_abi_version_cc_file",
783+
] + extra_deps
809784

810785
defines = extra_defines
811786
if (exclude_kernel_service) {
@@ -913,27 +888,6 @@ dart_executable("dart_precompiled_runtime") {
913888
}
914889
}
915890

916-
dart_executable("dart_precompiled_runtime_product") {
917-
use_product_mode = true
918-
extra_configs = [ "..:dart_precompiled_runtime_config" ]
919-
extra_deps = [
920-
"..:libdart_precompiled_runtime_product",
921-
"../platform:libdart_platform_precompiled_runtime_product",
922-
]
923-
extra_sources = [
924-
"builtin.cc",
925-
"gzip.cc",
926-
"gzip.h",
927-
"loader.cc",
928-
"loader.h",
929-
"main.cc",
930-
"observatory_assets_empty.cc",
931-
"snapshot_empty.cc",
932-
]
933-
934-
extra_deps += [ ":elf_loader_product" ]
935-
}
936-
937891
executable("process_test") {
938892
sources = [ "process_test.cc" ]
939893
}

runtime/configs.gni

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,77 +66,66 @@ _all_configs = [
6666
configs = _jit_config
6767
snapshot = true
6868
compiler = true
69-
is_product = false
7069
},
7170
{
7271
suffix = "_jit_product"
7372
configs = _jit_product_config
7473
snapshot = true
7574
compiler = true
76-
is_product = true
7775
},
7876
{
7977
suffix = "_precompiled_runtime"
8078
configs = _precompiled_runtime_config
8179
snapshot = true
8280
compiler = false
83-
is_product = false
8481
},
8582
{
8683
suffix = "_precompiled_runtime_product"
8784
configs = _precompiled_runtime_product_config
8885
snapshot = true
8986
compiler = false
90-
is_product = true
9187
},
9288
{
9389
suffix = "_precompiler"
9490
configs = _precompiler_config
9591
snapshot = false
9692
compiler = true
97-
is_product = false
9893
},
9994
{
10095
suffix = "_precompiler_product"
10196
configs = _precompiler_product_config
10297
snapshot = false
10398
compiler = true
104-
is_product = true
10599
},
106100
{
107101
suffix = "_precompiler_fuchsia"
108102
configs = _precompiler_fuchsia_config
109103
snapshot = false
110104
compiler = true
111-
is_product = false
112105
},
113106
{
114107
suffix = "_precompiler_product_fuchsia"
115108
configs = _precompiler_product_fuchsia_config
116109
snapshot = false
117110
compiler = true
118-
is_product = true
119111
},
120112
{
121113
suffix = "_precompiler_host_targeting_host"
122114
configs = _precompiler_host_targeting_host_config
123115
snapshot = false
124116
compiler = true
125-
is_product = false
126117
},
127118
{
128119
suffix = "_precompiler_product_host_targeting_host"
129120
configs = _precompiler_product_host_targeting_host_config
130121
snapshot = false
131122
compiler = true
132-
is_product = true
133123
},
134124
{
135125
suffix = "_libfuzzer"
136126
configs = _libfuzzer_config
137127
snapshot = true
138128
compiler = true
139-
is_product = false
140129
},
141130
]
142131

@@ -185,14 +174,6 @@ template("library_for_all_configs") {
185174
if (defined(invoker.extra_deps)) {
186175
extra_deps += invoker.extra_deps
187176
}
188-
extra_product_deps = []
189-
if (defined(invoker.extra_product_deps)) {
190-
extra_product_deps += invoker.extra_product_deps
191-
}
192-
extra_nonproduct_deps = []
193-
if (defined(invoker.extra_nonproduct_deps)) {
194-
extra_nonproduct_deps += invoker.extra_nonproduct_deps
195-
}
196177
foreach(conf, _all_configs) {
197178
target(invoker.target_type, "${target_name}${conf.suffix}") {
198179
forward_variables_from(invoker,
@@ -215,11 +196,6 @@ template("library_for_all_configs") {
215196
}
216197
}
217198
deps = configured_deps + extra_deps
218-
if (conf.is_product) {
219-
deps += extra_product_deps
220-
} else {
221-
deps += extra_nonproduct_deps
222-
}
223199
if (conf.snapshot) {
224200
if (defined(snapshot_sources)) {
225201
sources += snapshot_sources

runtime/third_party/double-conversion/src/BUILD.gn

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
# BSD-style license that can be found in the LICENSE file.
44

55
source_set("libdouble_conversion") {
6-
# We are only interested in exposing the exported symbols (for size reasons).
7-
cflags = []
8-
if (is_posix) {
9-
cflags += [ "-fvisibility=hidden" ]
10-
}
11-
126
configs += [
137
"../../..:dart_arch_config",
148
"../../..:dart_config",

runtime/vm/BUILD.gn

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,7 @@ config("libdart_vm_config") {
6363

6464
library_for_all_configs("libdart_vm") {
6565
target_type = "source_set"
66-
extra_product_deps = [
67-
"//third_party/icu:icui18n_hidden_visibility",
68-
"//third_party/icu:icuuc_hidden_visibility",
69-
]
70-
extra_nonproduct_deps = [
71-
"//third_party/icu:icui18n",
72-
"//third_party/icu:icuuc",
73-
]
66+
extra_deps = [ "//third_party/icu" ]
7467
if (is_fuchsia) {
7568
if (using_fuchsia_sdk) {
7669
extra_deps += [
@@ -154,10 +147,6 @@ library_for_all_configs("libdart_lib") {
154147
template("gen_vm_platform") {
155148
assert(defined(invoker.output_postfix),
156149
"Must define output postfix (e.g., '_strong'")
157-
is_product_flag = dart_runtime_mode == "release"
158-
if (defined(invoker.product_mode)) {
159-
is_product_flag = invoker.product_mode
160-
}
161150
compile_platform(target_name) {
162151
output_postfix = invoker.output_postfix
163152
if (defined(invoker.add_implicit_vm_platform_dependency)) {
@@ -177,6 +166,7 @@ template("gen_vm_platform") {
177166
"$root_out_dir/vm_outline" + output_postfix + ".dill",
178167
]
179168
args = [ "dart:core" ]
169+
is_product_flag = dart_runtime_mode == "release"
180170
allow_causal_async_stacks = !is_product_flag
181171
args += [
182172
"-Ddart.vm.product=$is_product_flag",
@@ -203,16 +193,6 @@ gen_vm_platform("vm_platform") {
203193
output_postfix = "_strong"
204194
}
205195

206-
gen_vm_platform("vm_platform_product") {
207-
add_implicit_vm_platform_dependency = false
208-
exclude_source = false
209-
output_postfix = "_strong_product"
210-
211-
# In Debug mode we use debug binaries for dart2native.
212-
# (see also the "dart_product_config" config)
213-
product_mode = !is_debug
214-
}
215-
216196
gen_vm_platform("vm_platform_stripped") {
217197
add_implicit_vm_platform_dependency = false
218198
exclude_source = true

0 commit comments

Comments
 (0)