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 fuchsiaSysRoot string = "prebuilts/fuchsia_sdk/arch/x64/sysroot" 22var fuchsiaPrebuiltLibsRoot string = "fuchsia/prebuilt_libs" 23 24type toolchainFuchsia struct { 25 cFlags, ldFlags string 26} 27 28type toolchainFuchsiaX8664 struct { 29 toolchain64Bit 30 toolchainFuchsia 31} 32 33func (t *toolchainFuchsiaX8664) Name() string { 34 return "x86_64" 35} 36 37func (t *toolchainFuchsiaX8664) GccRoot() string { 38 return "${config.X86_64GccRoot}" 39} 40 41func (t *toolchainFuchsiaX8664) GccTriple() string { 42 return "x86_64-linux-android" 43} 44 45func (t *toolchainFuchsiaX8664) GccVersion() string { 46 return x86_64GccVersion 47} 48 49func (t *toolchainFuchsiaX8664) Cflags() string { 50 return "" 51} 52 53func (t *toolchainFuchsiaX8664) Cppflags() string { 54 return "" 55} 56 57func (t *toolchainFuchsiaX8664) Ldflags() string { 58 return "" 59} 60 61func (t *toolchainFuchsiaX8664) IncludeFlags() string { 62 return "" 63} 64 65func (t *toolchainFuchsiaX8664) ClangTriple() string { 66 return "x86_64-fuchsia-android" 67} 68 69func (t *toolchainFuchsiaX8664) ClangCppflags() string { 70 return "-Wno-error=deprecated-declarations" 71} 72 73func (t *toolchainFuchsiaX8664) ClangLdflags() string { 74 return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/" 75 76} 77 78func (t *toolchainFuchsiaX8664) ClangLldflags() string { 79 return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/" 80} 81 82func (t *toolchainFuchsiaX8664) ClangCflags() string { 83 return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -I" + fuchsiaSysRoot + "/include" 84} 85 86func (t *toolchainFuchsiaX8664) Bionic() bool { 87 return false 88} 89 90func (t *toolchainFuchsiaX8664) YasmFlags() string { 91 return "-f elf64 -m amd64" 92} 93 94func (t *toolchainFuchsiaX8664) ToolchainClangCflags() string { 95 return "-mssse3" 96} 97 98var toolchainFuchsiaSingleton Toolchain = &toolchainFuchsiaX8664{} 99 100func fuchsiaToolchainFactory(arch android.Arch) Toolchain { 101 return toolchainFuchsiaSingleton 102} 103 104func init() { 105 registerToolchainFactory(android.Fuchsia, android.X86_64, fuchsiaToolchainFactory) 106} 107