1# Copyright 2018 The Hafnium Authors.
2#
3# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file or at
5# https://opensource.org/licenses/BSD-3-Clause.
6
7import("//build/toolchain/embedded.gni")
8import("//build/toolchain/host.gni")
9
10host_toolchain("host") {
11  use_platform = false
12}
13
14# Toolchain for building tests which run under Linux under Hafnium.
15embedded_clang_toolchain("aarch64_linux_clang") {
16  target = "aarch64-linux-musleabi"
17
18  # TODO: Remove //inc/system if we can stop using the version of stdatomic.h
19  # from the Android prebuilt Clang.
20  extra_cflags = "-nostdinc -isystem" +
21                 rebase_path("//prebuilts/linux-aarch64/musl/include") +
22                 " -isystem " + rebase_path("//inc/system")
23  extra_defines = "-D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1"
24  extra_ldflags = "-no-pie -lc --library-path=" +
25                  rebase_path("//prebuilts/linux-aarch64/musl/lib/") + " " +
26                  rebase_path("//prebuilts/linux-aarch64/musl/lib/crt1.o")
27
28  toolchain_args = {
29    use_platform = true
30    plat_arch = "fake"
31    plat_boot_flow = "//src/arch/fake:boot_flow"
32    plat_console = "//src/arch/fake:console"
33    plat_iommu = "//src/iommu:absent"
34  }
35}
36