From 317dff3f396f5e0fc7010a76d7ccbcb708e515a3 Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Sat, 30 Sep 2017 09:30:05 +0800
Subject: [PATCH] Fix mips cross-toolchain build src/crypto/ec/p256-64.c with
 -O2.

---
 third_party/boringssl/BUILD.gn | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index abe39b2..a7bd880 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -32,6 +32,12 @@ config("internal_config") {
   ]
   if (is_posix) {
     cflags_c = [ "-std=c99" ]
+    # TODO(wangqing): Fix mips cross-toolchain build src/crypto/ec/p256-64.c
+    # with -O2.
+    if (current_cpu == "mips64el" && current_cpu != host_cpu) {
+      cflags_c += [ "-O1" ]
+    }
+
     defines += [ "_XOPEN_SOURCE=700" ]
   }
 }
