1// Copyright 2018 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package config
16
17import (
18	"android/soong/android"
19)
20
21var fuchsiaArm64SysRoot string = "prebuilts/fuchsia_sdk/arch/arm64/sysroot"
22var fuchsiaArm64PrebuiltLibsRoot string = "fuchsia/prebuilt_libs/"
23
24type toolchainFuchsiaArm64 struct {
25	toolchain64Bit
26	toolchainFuchsia
27}
28
29func (t *toolchainFuchsiaArm64) Name() string {
30	return "arm64"
31}
32
33func (t *toolchainFuchsiaArm64) GccRoot() string {
34	return "${config.Arm64GccRoot}"
35}
36
37func (t *toolchainFuchsiaArm64) GccTriple() string {
38	return "aarch64-linux-android"
39}
40
41func (t *toolchainFuchsiaArm64) GccVersion() string {
42	return arm64GccVersion
43}
44
45func (t *toolchainFuchsiaArm64) Cflags() string {
46	return ""
47}
48
49func (t *toolchainFuchsiaArm64) Cppflags() string {
50	return ""
51}
52
53func (t *toolchainFuchsiaArm64) Ldflags() string {
54	return "-Wl,--fix-cortex-a53-843419"
55}
56
57func (t *toolchainFuchsiaArm64) IncludeFlags() string {
58	return ""
59}
60
61func (t *toolchainFuchsiaArm64) ToolchainCflags() string {
62	return "-mcpu=cortex-a53"
63}
64
65func (t *toolchainFuchsiaArm64) ClangTriple() string {
66	return "arm64-fuchsia-android"
67}
68
69func (t *toolchainFuchsiaArm64) ClangCppflags() string {
70	return "-Wno-error=deprecated-declarations"
71}
72
73func (t *toolchainFuchsiaArm64) ClangLdflags() string {
74	return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
75}
76
77func (t *toolchainFuchsiaArm64) ClangLldflags() string {
78	return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
79}
80
81func (t *toolchainFuchsiaArm64) ClangCflags() string {
82	return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -I" + fuchsiaArm64SysRoot + "/include"
83}
84
85func (t *toolchainFuchsiaArm64) Bionic() bool {
86	return false
87}
88
89func (t *toolchainFuchsiaArm64) ToolchainClangCflags() string {
90	return "-march=armv8-a"
91}
92
93var toolchainArm64FuchsiaSingleton Toolchain = &toolchainFuchsiaArm64{}
94
95func arm64FuchsiaToolchainFactory(arch android.Arch) Toolchain {
96	return toolchainArm64FuchsiaSingleton
97}
98
99func init() {
100	registerToolchainFactory(android.Fuchsia, android.Arm64, arm64FuchsiaToolchainFactory)
101}
102