Doug Horn | c32c6b0 | 2019-01-17 14:44:05 -0800 | [diff] [blame] | 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 | |
| 15 | package config |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | ) |
| 20 | |
| 21 | var fuchsiaSysRoot string = "prebuilts/fuchsia_sdk/arch/x64/sysroot" |
| 22 | var fuchsiaPrebuiltLibsRoot string = "fuchsia/prebuilt_libs" |
| 23 | |
| 24 | type toolchainFuchsia struct { |
| 25 | cFlags, ldFlags string |
| 26 | } |
| 27 | |
| 28 | type toolchainFuchsiaX8664 struct { |
| 29 | toolchain64Bit |
| 30 | toolchainFuchsia |
| 31 | } |
| 32 | |
| 33 | func (t *toolchainFuchsiaX8664) Name() string { |
| 34 | return "x86_64" |
| 35 | } |
| 36 | |
| 37 | func (t *toolchainFuchsiaX8664) GccRoot() string { |
| 38 | return "${config.X86_64GccRoot}" |
| 39 | } |
| 40 | |
| 41 | func (t *toolchainFuchsiaX8664) GccTriple() string { |
| 42 | return "x86_64-linux-android" |
| 43 | } |
| 44 | |
| 45 | func (t *toolchainFuchsiaX8664) GccVersion() string { |
| 46 | return x86_64GccVersion |
| 47 | } |
| 48 | |
| 49 | func (t *toolchainFuchsiaX8664) Cflags() string { |
| 50 | return "" |
| 51 | } |
| 52 | |
| 53 | func (t *toolchainFuchsiaX8664) Cppflags() string { |
| 54 | return "" |
| 55 | } |
| 56 | |
| 57 | func (t *toolchainFuchsiaX8664) Ldflags() string { |
| 58 | return "" |
| 59 | } |
| 60 | |
| 61 | func (t *toolchainFuchsiaX8664) IncludeFlags() string { |
| 62 | return "" |
| 63 | } |
| 64 | |
| 65 | func (t *toolchainFuchsiaX8664) ClangTriple() string { |
| 66 | return "x86_64-fuchsia-android" |
| 67 | } |
| 68 | |
| 69 | func (t *toolchainFuchsiaX8664) ClangCppflags() string { |
| 70 | return "-Wno-error=deprecated-declarations" |
| 71 | } |
| 72 | |
| 73 | func (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 | |
| 78 | func (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 | |
| 82 | func (t *toolchainFuchsiaX8664) ClangCflags() string { |
| 83 | return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -I" + fuchsiaSysRoot + "/include" |
| 84 | } |
| 85 | |
| 86 | func (t *toolchainFuchsiaX8664) Bionic() bool { |
| 87 | return false |
| 88 | } |
| 89 | |
| 90 | func (t *toolchainFuchsiaX8664) YasmFlags() string { |
| 91 | return "-f elf64 -m amd64" |
| 92 | } |
| 93 | |
| 94 | func (t *toolchainFuchsiaX8664) ToolchainClangCflags() string { |
Elliott Hughes | b22dcfe | 2019-07-12 22:40:45 -0700 | [diff] [blame] | 95 | return "-mssse3" |
Doug Horn | c32c6b0 | 2019-01-17 14:44:05 -0800 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | var toolchainFuchsiaSingleton Toolchain = &toolchainFuchsiaX8664{} |
| 99 | |
| 100 | func fuchsiaToolchainFactory(arch android.Arch) Toolchain { |
| 101 | return toolchainFuchsiaSingleton |
| 102 | } |
| 103 | |
| 104 | func init() { |
| 105 | registerToolchainFactory(android.Fuchsia, android.X86_64, fuchsiaToolchainFactory) |
| 106 | } |