From 4ccb45c172496ade51d96b69cc4b855f01252e13 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Thu, 10 Dec 2020 12:15:17 +0000 Subject: [PATCH] [vm] Fuchsia arm64 build Also runs the build on the existing Fuchsia bot and start building the test .far on the bot. Issue: https://github.com/dart-lang/sdk/issues/38752 Issue: https://github.com/dart-lang/sdk/issues/44434 TEST=tools/build.py --os=fuchsia -a arm64 create_sdk Change-Id: I8ba92defb9318773552af7e178dea12460790004 Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175482 Reviewed-by: Liam Appelbe --- build/toolchain/fuchsia/BUILD.gn | 14 ++++++++++++-- tools/bots/test_matrix.json | 5 +++-- tools/gn.py | 21 ++++++++++----------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/build/toolchain/fuchsia/BUILD.gn b/build/toolchain/fuchsia/BUILD.gn index 2901377fbf5..b067bf47e2a 100644 --- a/build/toolchain/fuchsia/BUILD.gn +++ b/build/toolchain/fuchsia/BUILD.gn @@ -17,9 +17,10 @@ if (use_goma) { } toolchain("fuchsia") { - assert(target_cpu == "x64", "We currently only support 'x64' for fuchsia.") + assert(target_cpu == "x64" || target_cpu == "arm64", + "We currently only support 'x64' and 'arm64' for fuchsia.") toolchain_bin = - rebase_path("//buildtools/$host_os-$target_cpu/clang/bin", root_out_dir) + rebase_path("//buildtools/$host_os-x64/clang/bin", root_out_dir) fuchsia_sdk = rebase_path("//third_party/fuchsia/sdk/$host_os", root_out_dir) # We can't do string interpolation ($ in strings) on things with dots in @@ -34,6 +35,10 @@ toolchain("fuchsia") { strip = "${toolchain_bin}/llvm-strip" target_triple_flags = "--target=x86_64-fuchsia" + if (target_cpu == "arm64") { + target_triple_flags = "--target=aarch64-fuchsia" + } + sysroot_flags = "--sysroot ${fuchsia_sdk}/arch/${target_cpu}/sysroot" lto_flags = "" @@ -129,6 +134,11 @@ toolchain("fuchsia") { exename = "{{target_output_name}}{{output_extension}}" outfile = "{{root_out_dir}}/$exename" rspfile = "$outfile.rsp" + + # Note that the unstripped_outfile is in the exe.stripped folder. + # We should probably clean this up, but changing this and dart.cmx + # to point ./dart instead of ./exe.stripped/dart makes the build + # fail because ./dart does not end up in the manifest file. unstripped_outfile = "{{root_out_dir}}/exe.stripped/$exename" command = "$compiler_prefix $ld $target_triple_flags $sysroot_flags $lto_flags {{ldflags}} -o $unstripped_outfile -Wl,--build-id -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}} && ${strip} -o $outfile $unstripped_outfile" description = "LINK $outfile" diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index ae3f53f3165..be6ffda2550 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -693,7 +693,6 @@ "host-checked": true } }, - "dart2js-hostasserts-strong-mac-x64-(d8|chrome)": { "options": { "builder-tag": "dart2js-strong", @@ -1743,8 +1742,10 @@ "script": "tools/build.py", "arguments": [ "--os=fuchsia", + "--arch=x64,arm64", "runtime", - "create_sdk" + "create_sdk", + "fuchsia_test_package" ] } ] diff --git a/tools/gn.py b/tools/gn.py index 161c35ae115..f315ade786d 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -68,9 +68,7 @@ def ToCommandLine(gn_args): def HostCpuForArch(arch): - if arch in [ - 'ia32', 'arm', 'armv6', 'simarm', 'simarmv6', 'simarm_x64' - ]: + if arch in ['ia32', 'arm', 'armv6', 'simarm', 'simarmv6', 'simarm_x64']: return 'x86' if arch in ['x64', 'arm64', 'simarm64', 'arm_x64']: return 'x64' @@ -119,6 +117,7 @@ def ParseStringMap(key, string_map): return l[1] return None + def UseSysroot(args, gn_args): # Don't try to use a Linux sysroot if we aren't on Linux. if gn_args['target_os'] != 'linux' and HOST_OS != 'linux': @@ -319,22 +318,22 @@ def ProcessOptions(args): return False if os_name == 'android': if not HOST_OS in ['linux', 'macos']: - print("Cross-compilation to %s is not supported on host os %s." - % (os_name, HOST_OS)) + print( + "Cross-compilation to %s is not supported on host os %s." % + (os_name, HOST_OS)) return False - if not arch in [ - 'ia32', 'x64', 'arm', 'arm_x64', 'armv6', 'arm64' - ]: + if not arch in ['ia32', 'x64', 'arm', 'arm_x64', 'armv6', 'arm64']: print( "Cross-compilation to %s is not supported for architecture %s." % (os_name, arch)) return False elif os_name == 'fuchsia': if HOST_OS != 'linux': - print("Cross-compilation to %s is not supported on host os %s." - % (os_name, HOST_OS)) + print( + "Cross-compilation to %s is not supported on host os %s." % + (os_name, HOST_OS)) return False - if arch != 'x64': + if arch != 'x64' and arch != 'arm64': print( "Cross-compilation to %s is not supported for architecture %s." % (os_name, arch))