2015-11-24 01:28:31 +01:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-07-29 22:44:28 +02:00
|
|
|
package config
|
2015-11-24 01:28:31 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
"android/soong/android"
|
2015-11-24 01:28:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
mips64Cflags = []string{
|
|
|
|
"-Umips",
|
|
|
|
|
|
|
|
// Help catch common 32/64-bit errors.
|
|
|
|
"-Werror=implicit-function-declaration",
|
|
|
|
}
|
|
|
|
|
2017-04-21 20:47:16 +02:00
|
|
|
mips64ClangCflags = append(mips64Cflags, []string{
|
|
|
|
"-fintegrated-as",
|
|
|
|
}...)
|
|
|
|
|
2017-11-06 22:59:48 +01:00
|
|
|
mips64Cppflags = []string{}
|
2015-11-24 01:28:31 +01:00
|
|
|
|
|
|
|
mips64Ldflags = []string{
|
|
|
|
"-Wl,--allow-shlib-undefined",
|
|
|
|
}
|
|
|
|
|
|
|
|
mips64ArchVariantCflags = map[string][]string{
|
|
|
|
"mips64r2": []string{
|
|
|
|
"-mips64r2",
|
|
|
|
"-msynci",
|
|
|
|
},
|
|
|
|
"mips64r6": []string{
|
|
|
|
"-mips64r6",
|
|
|
|
"-msynci",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2015-12-07 21:30:44 +01:00
|
|
|
const (
|
|
|
|
mips64GccVersion = "4.9"
|
|
|
|
)
|
|
|
|
|
2015-11-24 01:28:31 +01:00
|
|
|
func init() {
|
2015-12-07 21:30:44 +01:00
|
|
|
pctx.StaticVariable("mips64GccVersion", mips64GccVersion)
|
2015-11-24 01:28:31 +01:00
|
|
|
|
2016-07-29 22:44:28 +02:00
|
|
|
pctx.SourcePathVariable("Mips64GccRoot",
|
2015-12-07 21:30:44 +01:00
|
|
|
"prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${mips64GccVersion}")
|
2015-11-24 01:28:31 +01:00
|
|
|
|
2017-10-12 18:07:53 +02:00
|
|
|
pctx.StaticVariable("Mips64IncludeFlags", bionicHeaders("mips"))
|
2015-11-24 01:28:31 +01:00
|
|
|
|
|
|
|
// Clang cflags
|
2017-04-21 20:47:16 +02:00
|
|
|
pctx.StaticVariable("Mips64ClangCflags", strings.Join(ClangFilterUnknownCflags(mips64ClangCflags), " "))
|
2016-07-29 22:44:28 +02:00
|
|
|
pctx.StaticVariable("Mips64ClangLdflags", strings.Join(ClangFilterUnknownCflags(mips64Ldflags), " "))
|
|
|
|
pctx.StaticVariable("Mips64ClangCppflags", strings.Join(ClangFilterUnknownCflags(mips64Cppflags), " "))
|
2015-11-24 01:28:31 +01:00
|
|
|
|
|
|
|
// Extended cflags
|
|
|
|
|
|
|
|
// Architecture variant cflags
|
|
|
|
for variant, cflags := range mips64ArchVariantCflags {
|
2016-07-29 22:44:28 +02:00
|
|
|
pctx.StaticVariable("Mips64"+variant+"VariantClangCflags",
|
|
|
|
strings.Join(ClangFilterUnknownCflags(cflags), " "))
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type toolchainMips64 struct {
|
|
|
|
toolchain64Bit
|
2018-10-08 06:06:36 +02:00
|
|
|
clangCflags string
|
|
|
|
toolchainClangCflags string
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) Name() string {
|
|
|
|
return "mips64"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccRoot() string {
|
2016-07-29 22:44:28 +02:00
|
|
|
return "${config.Mips64GccRoot}"
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccTriple() string {
|
2016-07-20 23:44:26 +02:00
|
|
|
return "mips64el-linux-android"
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccVersion() string {
|
2015-12-07 21:30:44 +01:00
|
|
|
return mips64GccVersion
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) IncludeFlags() string {
|
2016-07-29 22:44:28 +02:00
|
|
|
return "${config.Mips64IncludeFlags}"
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangTriple() string {
|
2016-07-20 23:44:26 +02:00
|
|
|
return t.GccTriple()
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ToolchainClangCflags() string {
|
|
|
|
return t.toolchainClangCflags
|
|
|
|
}
|
|
|
|
|
2017-04-21 20:47:16 +02:00
|
|
|
func (t *toolchainMips64) ClangAsflags() string {
|
|
|
|
return "-fno-integrated-as"
|
|
|
|
}
|
|
|
|
|
2015-11-24 01:28:31 +01:00
|
|
|
func (t *toolchainMips64) ClangCflags() string {
|
|
|
|
return t.clangCflags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangCppflags() string {
|
2016-07-29 22:44:28 +02:00
|
|
|
return "${config.Mips64ClangCppflags}"
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangLdflags() string {
|
2016-07-29 22:44:28 +02:00
|
|
|
return "${config.Mips64ClangLdflags}"
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
|
2018-04-03 20:33:34 +02:00
|
|
|
func (t *toolchainMips64) ClangLldflags() string {
|
|
|
|
// TODO: define and use Mips64ClangLldflags
|
|
|
|
return "${config.Mips64ClangLdflags}"
|
|
|
|
}
|
|
|
|
|
2018-08-31 23:27:44 +02:00
|
|
|
func (toolchainMips64) LibclangRuntimeLibraryArch() string {
|
2016-08-15 23:18:24 +02:00
|
|
|
return "mips64"
|
2016-05-20 07:43:46 +02:00
|
|
|
}
|
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
func mips64ToolchainFactory(arch android.Arch) Toolchain {
|
2015-11-24 01:28:31 +01:00
|
|
|
return &toolchainMips64{
|
2016-07-29 22:44:28 +02:00
|
|
|
clangCflags: "${config.Mips64ClangCflags}",
|
|
|
|
toolchainClangCflags: "${config.Mips64" + arch.ArchVariant + "VariantClangCflags}",
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-06-02 02:09:44 +02:00
|
|
|
registerToolchainFactory(android.Android, android.Mips64, mips64ToolchainFactory)
|
2015-11-24 01:28:31 +01:00
|
|
|
}
|