[fuchsia] Add support for arm64 architectures (#282)

This commit is contained in:
Kaushik Iska 2019-07-29 15:52:31 -07:00 committed by GitHub
parent 84f2622f6e
commit b5f4eabbaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -18,20 +18,22 @@ _fuchsia_sdk_path = "//fuchsia/sdk/$host_os"
template("_fuchsia_sysroot") {
assert(defined(invoker.meta), "The meta.json file path must be specified.")
assert(target_cpu == "x64" || target_cpu == "arm64",
"We currently only support 'x64' and 'arm64' targets for fuchsia.")
meta_json = read_file(invoker.meta, "json")
assert(meta_json.type == "sysroot")
meta_json_versions = meta_json.versions
defs = meta_json_versions.x64
defs = meta_json_versions[target_cpu]
_libs = []
_lib_dirs = []
_include_dirs = []
foreach(link_lib, defs.link_libs) {
if (link_lib != "arch/x64/sysroot/lib/Scrt1.o") {
if (link_lib != "arch/${target_cpu}/sysroot/lib/Scrt1.o") {
_libs += [ "$_fuchsia_sdk_path/$link_lib" ]
}
}
@ -53,6 +55,8 @@ template("_fuchsia_sysroot") {
template("_fuchsia_fidl_library") {
assert(defined(invoker.meta), "The meta.json file path must be specified.")
assert(target_cpu == "x64" || target_cpu == "arm64",
"We currently only support 'x64' and 'arm64' targets for fuchsia.")
meta_json = read_file(invoker.meta, "json")
@ -194,8 +198,8 @@ template("_fuchsia_cc_prebuilt_library") {
}
meta_json_binaries = meta_json.binaries
meta_json_binaries_x64 = meta_json_binaries.x64
prebuilt_lib = meta_json_binaries_x64.link
meta_json_binaries_arch = meta_json_binaries[target_cpu]
prebuilt_lib = meta_json_binaries_arch.link
_libs = [ "$_fuchsia_sdk_path/$prebuilt_lib" ]
config_name = "config_$target_name"

View File

@ -11,6 +11,8 @@ if (use_goma) {
}
toolchain("fuchsia") {
assert(target_cpu == "x64" || target_cpu == "arm64",
"We currently only support 'x64' and 'arm64' targets for fuchsia.")
toolchain_bin = rebase_path("//fuchsia/toolchain/$host_os/bin/", root_out_dir)
fuchsia_sdk = rebase_path("//fuchsia/sdk/$host_os", root_out_dir)
@ -25,7 +27,12 @@ toolchain("fuchsia") {
nm = "${toolchain_bin}/llvm-nm"
strip = "${toolchain_bin}/llvm-strip"
target_triple_flags = "--target=x86_64-fuchsia"
if (target_cpu == "arm64") {
target_triple_flags = "--target=arm64-fuchsia"
} else {
target_triple_flags = "--target=x86_64-fuchsia"
}
sysroot_flags = "--sysroot ${fuchsia_sdk}/arch/x64/sysroot"
# These library switches can apply to all tools below.