[build] Fix building on an ARM64 Linux host.

Change-Id: I42a8265722083fb02f815c635c44f63f809a9082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237923
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2022-03-22 00:50:18 +00:00 committed by Commit Bot
parent b14c3c3607
commit 50c5b075ec
2 changed files with 18 additions and 7 deletions

View file

@ -359,7 +359,10 @@ config("compiler") {
# not be compatible with newer ones. To achieve this, we insert a synthetic # not be compatible with newer ones. To achieve this, we insert a synthetic
# define into the compile line. # define into the compile line.
if (is_clang && (is_linux || is_mac)) { if (is_clang && (is_linux || is_mac)) {
if (is_linux) { if (is_linux && host_cpu == "arm64") {
toolchain_stamp_file =
"//buildtools/linux-arm64/clang/.versions/clang.cipd_version"
} else if (is_linux) {
toolchain_stamp_file = toolchain_stamp_file =
"//buildtools/linux-x64/clang/.versions/clang.cipd_version" "//buildtools/linux-x64/clang/.versions/clang.cipd_version"
} else { } else {

View file

@ -21,6 +21,14 @@ if (use_goma) {
compiler_prefix = "" compiler_prefix = ""
} }
if (host_cpu == "arm64") {
rebased_clang_dir =
rebase_path("//buildtools/linux-arm64/clang/bin", root_build_dir)
} else {
rebased_clang_dir =
rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir)
}
gcc_toolchain("arm") { gcc_toolchain("arm") {
prefix = "arm-linux-gnueabihf-" prefix = "arm-linux-gnueabihf-"
if (toolchain_prefix != "") { if (toolchain_prefix != "") {
@ -42,7 +50,7 @@ gcc_toolchain("arm") {
} }
gcc_toolchain("clang_arm") { gcc_toolchain("clang_arm") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"
@ -78,7 +86,7 @@ gcc_toolchain("arm64") {
} }
gcc_toolchain("clang_arm64") { gcc_toolchain("clang_arm64") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"
@ -94,7 +102,7 @@ gcc_toolchain("clang_arm64") {
} }
gcc_toolchain("clang_x86") { gcc_toolchain("clang_x86") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"
@ -126,7 +134,7 @@ gcc_toolchain("x86") {
} }
gcc_toolchain("clang_x64") { gcc_toolchain("clang_x64") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"
@ -178,7 +186,7 @@ gcc_toolchain("riscv32") {
} }
gcc_toolchain("clang_riscv32") { gcc_toolchain("clang_riscv32") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"
@ -214,7 +222,7 @@ gcc_toolchain("riscv64") {
} }
gcc_toolchain("clang_riscv64") { gcc_toolchain("clang_riscv64") {
prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang" cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++" cxx = "${compiler_prefix}${prefix}/clang++"