From e3661b7d2f9d94899bd057ece13a439583418230 Mon Sep 17 00:00:00 2001 From: Jackson Gardner Date: Fri, 17 Feb 2023 09:04:50 +0000 Subject: [PATCH] Revert "Reland "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk.""" This reverts commit faecf41be154eef7a59453c202052eaa3479ff7c. Reason for revert: Flutter HHH bots are broken: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8788949281966049297/+/u/build_host_debug/stdout Original change's description: > Reland "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."" > > This is a reland of commit b19091385aea21b19ee0a069b0e1bad8fe008f48 > > Fixed the calculation of the paths of binaryen source files so that they > work properly when building as a dependency (inside the flutter engine > repo). > > Original change's description: > > Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk." > > > > This is a reland of commit 6271d26baf498ab2b053c52527bc65f7f43e802b > > > > The change broke the gcc riscv64 builders, due to a `unused-variable` > > warning coming from binaryen sources. That warning has now been > > disabled for binaryen targets. > > > > Original change's description: > > > [dart2wasm] Include wasm-opt in the shipped dart-sdk. > > > > > > Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef > > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840 > > > Reviewed-by: Martin Kustermann > > > Commit-Queue: Jackson Gardner > > > Reviewed-by: Aske Simon Christensen > > > > Change-Id: I76bf4ad5d1f6a8116631df4b91cbc5a52cac4f31 > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283240 > > Reviewed-by: Martin Kustermann > > Commit-Queue: Jackson Gardner > > Change-Id: I5cc269daebc5e2068c084bb72b2bd7cb58ba6fbe > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283721 > Reviewed-by: Martin Kustermann > Commit-Queue: Jackson Gardner TBR=kustermann@google.com,askesc@google.com,joshualitt@google.com,jacksongardner@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com Change-Id: If4e864b3dfb5d9ff840846bff0690247256b2762 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283745 Reviewed-by: Jackson Gardner Reviewed-by: Martin Kustermann Commit-Queue: Martin Kustermann --- build/config/compiler/BUILD.gn | 15 ++------- build/toolchain/win/tool_wrapper.py | 24 +------------- sdk/BUILD.gn | 12 ------- third_party/binaryen/BUILD.gn | 47 +++++++--------------------- third_party/binaryen/list_sources.py | 7 +++-- tools/gn.py | 1 - 6 files changed, 19 insertions(+), 87 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index d7f9f6b2bdd..feb13b1af62 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -610,12 +610,12 @@ if (is_win) { default_warning_flags += [ "-Wno-tautological-constant-compare", "-Wno-unused-but-set-variable", # icu + "-Wno-unused-but-set-parameter", # binaryen "-Wno-deprecated-non-prototype", # zlib ] } else { - default_warning_flags += [ - "-Wno-ignored-qualifiers", # Warnings in BoringSSL headers - ] + default_warning_flags += + [ "-Wno-ignored-qualifiers" ] # Warnings in BoringSSL headers } if (is_mac) { @@ -729,15 +729,6 @@ config("no_rtti") { } } -config("enable_exceptions") { - if (is_win) { - cflags_cc = [ "/EHsc" ] - defines = [ "_HAS_EXCEPTIONS=1" ] - } else if (is_clang) { - cflags_cc = [ "-fexceptions" ] - } -} - # Optimization ----------------------------------------------------------------- # # Note that BUILDCONFIG.gn sets up a variable "default_optimization_config" diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py index 3f52ee0c87d..652a879466e 100644 --- a/build/toolchain/win/tool_wrapper.py +++ b/build/toolchain/win/tool_wrapper.py @@ -8,7 +8,6 @@ is used to set up calls to tools used by the build that need wrappers. """ import os -import pathlib import re import shutil import subprocess @@ -150,28 +149,7 @@ class WinTool(object): not line.startswith('Generating code') and not line.startswith('Finished generating code')): print(line) - link_result = link.wait() - - if link_result != 0: - return link_result - - # The toolchain configuration in gn always expects a .lib file to be - # included in the output of the link step. However, this only happens - # when the output has exports, and that is not always the case. In - # order to satisfy the expected outputs, we create a dummy .lib file - # in cases where the link step didn't actually create one. - for arg in args: - m = _LINK_EXE_OUT_ARG.match(arg) - if m: - output_filename = m.group('out') - (basename, extension) = os.path.splitext(output_filename) - if extension == '.exe': - lib_path = pathlib.Path(basename + ".lib") - if not os.path.exists(lib_path): - lib_path.touch() - break - - return link_result + return link.wait() def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 17562352858..61874d8750c 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -27,7 +27,6 @@ declare_args() { dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime_product" gen_snapshot_stripped_binary = "gen_snapshot_product" analyze_snapshot_binary = "analyze_snapshot" - wasm_opt_stripped_binary = "wasm-opt" } # The directory layout of the SDK is as follows: @@ -519,16 +518,6 @@ copy("copy_dart2wasm_snapshot") { [ "$root_out_dir/$dart_sdk_output/bin/snapshots/{{source_file_part}}" ] } -copy("copy_wasm_opt") { - visibility = [ ":create_full_sdk" ] - deps = [ - ":copy_libraries", - "../third_party/binaryen:wasm-opt", - ] - sources = [ "$root_out_dir/${wasm_opt_stripped_binary}${executable_suffix}" ] - outputs = [ "$root_out_dir/$dart_sdk_output/bin/utils/{{source_file_part}}" ] -} - # Copies DDC's SDK full and outline .dill files to lib/_internal. copy("copy_dev_compiler_dills") { visibility = [ ":copy_dev_compiler_sdk" ] @@ -766,7 +755,6 @@ group("create_full_sdk") { public_deps += [ ":copy_dart2wasm_platform", ":copy_dart2wasm_snapshot", - ":copy_wasm_opt", ] } } diff --git a/third_party/binaryen/BUILD.gn b/third_party/binaryen/BUILD.gn index d474908af5b..139d9f8e1b8 100644 --- a/third_party/binaryen/BUILD.gn +++ b/third_party/binaryen/BUILD.gn @@ -4,14 +4,6 @@ import("../../sdk_args.gni") -config("binaryen_warnings") { - if (is_clang) { - cflags = [ "-Wno-unused-but-set-parameter" ] - } else if (!is_win) { - cflags = [ "-Wno-unused-variable" ] - } -} - action("generate_needed_files") { script = "generate_needed_files.py" @@ -39,31 +31,24 @@ action("generate_needed_files") { source_set("binaryen_sources") { src_dirs = [ - "src/src/ir", - "src/src/asmjs", - "src/src/cfg", - "src/src/passes", - "src/src/support", - "src/src/wasm", - "src/src/tools/fuzzing", - "src/src/emscripten-optimizer", + rebase_path("src/src/ir", root_build_dir), + rebase_path("src/src/asmjs", root_build_dir), + rebase_path("src/src/cfg", root_build_dir), + rebase_path("src/src/passes", root_build_dir), + rebase_path("src/src/support", root_build_dir), + rebase_path("src/src/wasm", root_build_dir), + rebase_path("src/src/tools/fuzzing", root_build_dir), + rebase_path("src/src/emscripten-optimizer", root_build_dir), ] # We avoid listing all sources manually, this means when updating # binaryen in DEPS (or manually editing) one has to ensure to # re-run GN in DEPS to ensure new dependencies are picked up. # (this lowers the maintenance burden of GN build support for binaryen) - sources = [] - foreach(src_dir, src_dirs) { - foreach(src_file, - exec_script("list_sources.py", - [ rebase_path(src_dir, root_build_dir) ], + sources = exec_script("list_sources.py", + src_dirs, "list lines", - [ "$default_git_folder/logs/HEAD" ])) { - sources += [ "$src_dir/$src_file" ] - } - } - + [ "$default_git_folder/logs/HEAD" ]) include_dirs = [ "src/src" ] # Ensure WasmIntrinsics.cpp/config.h files are generated. @@ -74,11 +59,6 @@ source_set("binaryen_sources") { # Ensure generated config.h file is include path. include_dirs += [ "$target_gen_dir" ] - - configs += [ - "//build/config/compiler:enable_exceptions", - ":binaryen_warnings", - ] } template("wasm_tool") { @@ -92,11 +72,6 @@ template("wasm_tool") { include_dirs = [ "src/src" ] deps = [ ":binaryen_sources" ] forward_variables_from(invoker, "*") - - configs += [ - "//build/config/compiler:enable_exceptions", - ":binaryen_warnings", - ] } } diff --git a/third_party/binaryen/list_sources.py b/third_party/binaryen/list_sources.py index 903ebf6455e..2d894adcbfb 100644 --- a/third_party/binaryen/list_sources.py +++ b/third_party/binaryen/list_sources.py @@ -8,9 +8,10 @@ import sys def main(args): - for file in os.listdir(args[0]): - if file.endswith('.cpp') or file.endswith('.h'): - print(file) + for dirname in args: + for file in os.listdir(dirname): + if file.endswith('.cpp') or file.endswith('.h'): + print(os.path.join(dirname, file)) if __name__ == '__main__': diff --git a/tools/gn.py b/tools/gn.py index c8bac2f8229..be46581cf2d 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -300,7 +300,6 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash): gn_args['gen_snapshot_stripped_binary'] = ( 'exe.stripped/gen_snapshot_product') gn_args['analyze_snapshot_binary'] = ('exe.stripped/analyze_snapshot') - gn_args['wasm_opt_stripped_binary'] = 'exe.stripped/wasm-opt' # Setup the user-defined sysroot. if UseSysroot(args, gn_args):