2015-11-24 08:28:31 +08: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-30 04:44:28 +08:00
|
|
|
package config
|
2015-11-24 08:28:31 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2016-05-19 06:37:25 +08:00
|
|
|
"android/soong/android"
|
2015-11-24 08:28:31 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
mips64Cflags = []string{
|
|
|
|
"-Umips",
|
|
|
|
|
|
|
|
// Help catch common 32/64-bit errors.
|
|
|
|
"-Werror=implicit-function-declaration",
|
|
|
|
}
|
|
|
|
|
2017-04-22 02:47:16 +08:00
|
|
|
mips64ClangCflags = append(mips64Cflags, []string{
|
|
|
|
"-fintegrated-as",
|
|
|
|
}...)
|
|
|
|
|
2017-11-07 05:59:48 +08:00
|
|
|
mips64Cppflags = []string{}
|
2015-11-24 08:28:31 +08:00
|
|
|
|
|
|
|
mips64Ldflags = []string{
|
|
|
|
"-Wl,--allow-shlib-undefined",
|
|
|
|
}
|
|
|
|
|
|
|
|
mips64ArchVariantCflags = map[string][]string{
|
|
|
|
"mips64r2": []string{
|
|
|
|
"-mips64r2",
|
|
|
|
"-msynci",
|
|
|
|
},
|
|
|
|
"mips64r6": []string{
|
|
|
|
"-mips64r6",
|
|
|
|
"-msynci",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2015-12-08 04:30:44 +08:00
|
|
|
const (
|
|
|
|
mips64GccVersion = "4.9"
|
|
|
|
)
|
|
|
|
|
2015-11-24 08:28:31 +08:00
|
|
|
func init() {
|
2016-06-24 14:44:54 +08:00
|
|
|
android.RegisterArchVariants(android.Mips64,
|
|
|
|
"mips64r2",
|
|
|
|
"mips64r6")
|
2017-05-02 07:43:41 +08:00
|
|
|
android.RegisterArchFeatures(android.Mips64,
|
|
|
|
"rev6",
|
|
|
|
"msa")
|
2016-06-24 14:44:54 +08:00
|
|
|
android.RegisterArchVariantFeatures(android.Mips64, "mips64r6",
|
2015-11-24 08:28:31 +08:00
|
|
|
"rev6")
|
|
|
|
|
2015-12-08 04:30:44 +08:00
|
|
|
pctx.StaticVariable("mips64GccVersion", mips64GccVersion)
|
2015-11-24 08:28:31 +08:00
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.SourcePathVariable("Mips64GccRoot",
|
2015-12-08 04:30:44 +08:00
|
|
|
"prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${mips64GccVersion}")
|
2015-11-24 08:28:31 +08:00
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("Mips64Cflags", strings.Join(mips64Cflags, " "))
|
|
|
|
pctx.StaticVariable("Mips64Ldflags", strings.Join(mips64Ldflags, " "))
|
|
|
|
pctx.StaticVariable("Mips64Cppflags", strings.Join(mips64Cppflags, " "))
|
2017-10-13 00:07:53 +08:00
|
|
|
pctx.StaticVariable("Mips64IncludeFlags", bionicHeaders("mips"))
|
2015-11-24 08:28:31 +08:00
|
|
|
|
|
|
|
// Clang cflags
|
2017-04-22 02:47:16 +08:00
|
|
|
pctx.StaticVariable("Mips64ClangCflags", strings.Join(ClangFilterUnknownCflags(mips64ClangCflags), " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("Mips64ClangLdflags", strings.Join(ClangFilterUnknownCflags(mips64Ldflags), " "))
|
|
|
|
pctx.StaticVariable("Mips64ClangCppflags", strings.Join(ClangFilterUnknownCflags(mips64Cppflags), " "))
|
2015-11-24 08:28:31 +08:00
|
|
|
|
|
|
|
// Extended cflags
|
|
|
|
|
|
|
|
// Architecture variant cflags
|
|
|
|
for variant, cflags := range mips64ArchVariantCflags {
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("Mips64"+variant+"VariantCflags", strings.Join(cflags, " "))
|
|
|
|
pctx.StaticVariable("Mips64"+variant+"VariantClangCflags",
|
|
|
|
strings.Join(ClangFilterUnknownCflags(cflags), " "))
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type toolchainMips64 struct {
|
|
|
|
toolchain64Bit
|
|
|
|
cflags, clangCflags string
|
|
|
|
toolchainCflags, toolchainClangCflags string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) Name() string {
|
|
|
|
return "mips64"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccRoot() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64GccRoot}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccTriple() string {
|
2016-07-21 05:44:26 +08:00
|
|
|
return "mips64el-linux-android"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) GccVersion() string {
|
2015-12-08 04:30:44 +08:00
|
|
|
return mips64GccVersion
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ToolchainCflags() string {
|
|
|
|
return t.toolchainCflags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) Cflags() string {
|
|
|
|
return t.cflags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) Cppflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64Cppflags}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) Ldflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64Ldflags}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) IncludeFlags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64IncludeFlags}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangTriple() string {
|
2016-07-21 05:44:26 +08:00
|
|
|
return t.GccTriple()
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ToolchainClangCflags() string {
|
|
|
|
return t.toolchainClangCflags
|
|
|
|
}
|
|
|
|
|
2017-04-22 02:47:16 +08:00
|
|
|
func (t *toolchainMips64) ClangAsflags() string {
|
|
|
|
return "-fno-integrated-as"
|
|
|
|
}
|
|
|
|
|
2015-11-24 08:28:31 +08:00
|
|
|
func (t *toolchainMips64) ClangCflags() string {
|
|
|
|
return t.clangCflags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangCppflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64ClangCppflags}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainMips64) ClangLdflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.Mips64ClangLdflags}"
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
|
2016-08-16 05:18:24 +08:00
|
|
|
func (toolchainMips64) SanitizerRuntimeLibraryArch() string {
|
|
|
|
return "mips64"
|
2016-05-20 13:43:46 +08:00
|
|
|
}
|
|
|
|
|
2016-05-19 06:37:25 +08:00
|
|
|
func mips64ToolchainFactory(arch android.Arch) Toolchain {
|
2015-11-24 08:28:31 +08:00
|
|
|
return &toolchainMips64{
|
2016-07-30 04:44:28 +08:00
|
|
|
cflags: "${config.Mips64Cflags}",
|
|
|
|
clangCflags: "${config.Mips64ClangCflags}",
|
|
|
|
toolchainCflags: "${config.Mips64" + arch.ArchVariant + "VariantCflags}",
|
|
|
|
toolchainClangCflags: "${config.Mips64" + arch.ArchVariant + "VariantClangCflags}",
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-06-02 08:09:44 +08:00
|
|
|
registerToolchainFactory(android.Android, android.Mips64, mips64ToolchainFactory)
|
2015-11-24 08:28:31 +08:00
|
|
|
}
|