1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-03 00:08:46 +00:00

[build] Enable building riscv64 with clang.

Change-Id: Ie09d92a4e23484b7c6d2963bb0d327e443a68e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338641
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2023-11-30 18:09:49 +00:00 committed by Commit Queue
parent d229aa0edd
commit bd5df6da60
5 changed files with 31 additions and 9 deletions

10
DEPS
View File

@ -517,6 +517,16 @@ Var("dart_root") + "/third_party/pkg/tar":
"condition": "host_os == linux",
"dep_type": "cipd",
},
Var("dart_root") + "/buildtools/sysroot/focal": {
"packages": [
{
"package": "fuchsia/third_party/sysroot/focal",
"version": "git_revision:fa7a5a9710540f30ff98ae48b62f2cdf72ed2acd",
},
],
"condition": "host_os == linux",
"dep_type": "cipd",
},
# Keep consistent with pkg/test_runner/lib/src/options.dart.
Var("dart_root") + "/buildtools/linux-x64/clang": {

View File

@ -422,8 +422,20 @@ config("compiler") {
toolchain_stamp_file =
"//buildtools/mac-x64/clang/.versions/clang.cipd_version"
}
cipd_version = read_file(toolchain_stamp_file, "json")
defines = [ "TOOLCHAIN_VERSION=${cipd_version.instance_id}" ]
toolchain_cipd_version = read_file(toolchain_stamp_file, "json")
defines = [ "TOOLCHAIN_VERSION=${toolchain_cipd_version.instance_id}" ]
if (is_linux) {
if (current_cpu == "riscv64") {
sysroot_stamp_file =
"//buildtools/sysroot/focal/.versions/sysroot.cipd_version"
} else {
sysroot_stamp_file =
"//buildtools/sysroot/linux/.versions/sysroot.cipd_version"
}
sysroot_cipd_version = read_file(sysroot_stamp_file, "json")
defines += [ "SYSROOT_VERSION=${sysroot_cipd_version.instance_id}" ]
}
}
# Assign any flags set for the C compiler to asmflags so that they are sent

View File

@ -37,7 +37,12 @@ if (is_linux) {
assert(false)
}
} else if (dart_sysroot == "debian") {
target_sysroot = rebase_path("//buildtools/sysroot/linux", root_build_dir)
if (current_cpu == "riscv64") {
target_sysroot = rebase_path("//buildtools/sysroot/focal", root_build_dir)
} else {
# Updating to focal would increase the required libc from 2.17 to 2.28.
target_sysroot = rebase_path("//buildtools/sysroot/linux", root_build_dir)
}
} else if (dart_sysroot != "") {
print("There is no $dart_sysroot sysroot support")
assert(false)

View File

@ -933,16 +933,13 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
var exec = _configuration.genSnapshotPath;
if (exec == null) {
var gcc32 = "<does-not-exist>";
var gcc64 = "<does-not-exist>";
var clang32 = "<does-not-exist>";
var clang64 = "<does-not-exist>";
if (Architecture.host == Architecture.x64) {
gcc32 = "x86";
gcc64 = "x64";
clang32 = "clang_x86";
clang64 = "clang_x64";
} else if (Architecture.host == Architecture.arm64) {
gcc64 = "arm64";
clang64 = "clang_arm64";
}
if (_isAndroid) {
@ -966,7 +963,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
} else if (_isRiscv32 && _configuration.useQemu) {
exec = "$buildDir/$gcc32/gen_snapshot";
} else if (_isRiscv64 && _configuration.useQemu) {
exec = "$buildDir/$gcc64/gen_snapshot";
exec = "$buildDir/$clang64/gen_snapshot";
} else {
exec = "$buildDir/gen_snapshot";
}

View File

@ -877,8 +877,6 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--no-clang",
"--no-goma",
"--use-qemu",
"dart_precompiled_runtime",
"runtime"