mips64_device.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Copyright 2015 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. package config
  15. import (
  16. "strings"
  17. "android/soong/android"
  18. )
  19. var (
  20. mips64Cflags = []string{
  21. "-Umips",
  22. // Help catch common 32/64-bit errors.
  23. "-Werror=implicit-function-declaration",
  24. }
  25. mips64ClangCflags = append(mips64Cflags, []string{
  26. "-fintegrated-as",
  27. }...)
  28. mips64Cppflags = []string{}
  29. mips64Ldflags = []string{
  30. "-Wl,--allow-shlib-undefined",
  31. }
  32. mips64ArchVariantCflags = map[string][]string{
  33. "mips64r2": []string{
  34. "-mips64r2",
  35. "-msynci",
  36. },
  37. "mips64r6": []string{
  38. "-mips64r6",
  39. "-msynci",
  40. },
  41. }
  42. )
  43. const (
  44. mips64GccVersion = "4.9"
  45. )
  46. func init() {
  47. pctx.StaticVariable("mips64GccVersion", mips64GccVersion)
  48. pctx.SourcePathVariable("Mips64GccRoot",
  49. "prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${mips64GccVersion}")
  50. pctx.StaticVariable("Mips64IncludeFlags", bionicHeaders("mips"))
  51. // Clang cflags
  52. pctx.StaticVariable("Mips64ClangCflags", strings.Join(ClangFilterUnknownCflags(mips64ClangCflags), " "))
  53. pctx.StaticVariable("Mips64ClangLdflags", strings.Join(ClangFilterUnknownCflags(mips64Ldflags), " "))
  54. pctx.StaticVariable("Mips64ClangCppflags", strings.Join(ClangFilterUnknownCflags(mips64Cppflags), " "))
  55. // Extended cflags
  56. // Architecture variant cflags
  57. for variant, cflags := range mips64ArchVariantCflags {
  58. pctx.StaticVariable("Mips64"+variant+"VariantClangCflags",
  59. strings.Join(ClangFilterUnknownCflags(cflags), " "))
  60. }
  61. }
  62. type toolchainMips64 struct {
  63. toolchain64Bit
  64. clangCflags string
  65. toolchainClangCflags string
  66. }
  67. func (t *toolchainMips64) Name() string {
  68. return "mips64"
  69. }
  70. func (t *toolchainMips64) GccRoot() string {
  71. return "${config.Mips64GccRoot}"
  72. }
  73. func (t *toolchainMips64) GccTriple() string {
  74. return "mips64el-linux-android"
  75. }
  76. func (t *toolchainMips64) GccVersion() string {
  77. return mips64GccVersion
  78. }
  79. func (t *toolchainMips64) IncludeFlags() string {
  80. return "${config.Mips64IncludeFlags}"
  81. }
  82. func (t *toolchainMips64) ClangTriple() string {
  83. return t.GccTriple()
  84. }
  85. func (t *toolchainMips64) ToolchainClangCflags() string {
  86. return t.toolchainClangCflags
  87. }
  88. func (t *toolchainMips64) ClangAsflags() string {
  89. return "-fno-integrated-as"
  90. }
  91. func (t *toolchainMips64) ClangCflags() string {
  92. return t.clangCflags
  93. }
  94. func (t *toolchainMips64) ClangCppflags() string {
  95. return "${config.Mips64ClangCppflags}"
  96. }
  97. func (t *toolchainMips64) ClangLdflags() string {
  98. return "${config.Mips64ClangLdflags}"
  99. }
  100. func (t *toolchainMips64) ClangLldflags() string {
  101. // TODO: define and use Mips64ClangLldflags
  102. return "${config.Mips64ClangLdflags}"
  103. }
  104. func (toolchainMips64) LibclangRuntimeLibraryArch() string {
  105. return "mips64"
  106. }
  107. func mips64ToolchainFactory(arch android.Arch) Toolchain {
  108. return &toolchainMips64{
  109. clangCflags: "${config.Mips64ClangCflags}",
  110. toolchainClangCflags: "${config.Mips64" + arch.ArchVariant + "VariantClangCflags}",
  111. }
  112. }
  113. func init() {
  114. registerToolchainFactory(android.Android, android.Mips64, mips64ToolchainFactory)
  115. }