Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index dcd5d6596d619d40e2389f20f7fee94cdd351694..c0a835fe805882032064df9a7a432a5df505f892 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -12,6 +12,19 @@ if (is_posix) { |
import("//build/toolchain/ccache.gni") |
+# Default arch variants for MIPS platforms. |
+if (cpu_arch == "mipsel") { |
+ mips_arch_variant_default = "r1" |
+} else if (cpu_arch == "mips64el") { |
+ if (is_android) { |
+ mips_arch_variant_default = "r6" |
+ } else { |
+ mips_arch_variant_default = "r2" |
+ } |
+} else { |
+ mips_arch_variant_default = "" |
+} |
+ |
declare_args() { |
# Normally, Android builds are lightly optimized, even for debug builds, to |
# keep binary size down. Setting this flag to true disables such optimization |
@@ -23,6 +36,9 @@ declare_args() { |
# you are using a custom toolchain and need to control -B in cflags. |
linux_use_bundled_binutils = is_linux && cpu_arch == "x64" |
+ # MIPS arch variant. |
+ mips_arch_variant = mips_arch_variant_default |
wtc
2015/01/07 23:00:22
Is there a better way to provide a platform-depend
|
+ |
# Compile in such a way as to enable profiling of the generated code. For |
# example, don't omit the frame pointer and leave in symbols. |
enable_profiling = false |
@@ -271,6 +287,51 @@ config("compiler") { |
] |
} |
} |
+ } else if (cpu_arch == "mipsel") { |
+ # Don't set the compiler flags for the WebView build. These will come |
+ # from the Android build system. |
+ if (!is_android_webview_build) { |
+ if (mips_arch_variant == "r6") { |
+ cflags += [ |
+ "-mips32r6", |
+ "-Wa,-mips32r6", |
+ ] |
+ if (is_android) { |
+ ldflags += [ |
+ "-mips32r6", |
+ "-Wl,-melf32ltsmip", |
wtc
2015/01/07 23:00:22
I don't know what this flag is for. I copied it fr
|
+ ] |
+ } |
+ } else if (mips_arch_variant == "r2") { |
+ cflags += [ |
+ "-mips32r2", |
+ "-Wa,-mips32r2", |
+ ] |
+ } else if (mips_arch_variant == "r1") { |
+ cflags += [ |
+ "-mips32", |
+ "-Wa,-mips32", |
+ ] |
+ } |
+ } |
+ } else if (cpu_arch == "mips64el") { |
+ # Don't set the compiler flags for the WebView build. These will come |
+ # from the Android build system. |
+ if (!is_android_webview_build) { |
+ if (mips_arch_variant == "r6") { |
+ cflags += [ |
+ "-mips64r6", |
+ "-Wa,-mips64r6", |
+ ] |
+ ldflags += [ "-mips64r6" ] |
+ } else if (mips_arch_variant == "r2") { |
+ cflags += [ |
+ "-mips64r2", |
+ "-Wa,-mips64r2", |
+ ] |
+ ldflags += [ "-mips64r2" ] |
+ } |
+ } |
} |
defines += [ "_FILE_OFFSET_BITS=64" ] |