From 0c64df90e4ca25644ac5aa3f35ab4884f697165e Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Mon, 9 Oct 2017 16:53:22 +0800
Subject: [PATCH] Fix error about "relocation truncated to fit: R_MIPS_CALL16"
 when cross-compiling shared_library with is_debug on x64.

---
 content/common/BUILD.gn | 5 +++++
 ppapi/proxy/BUILD.gn    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index fd5c0dc..e91e8348 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -15,6 +15,11 @@ if (is_mac) {
   import("//build/config/mac/mac_sdk.gni")
 }
 
+if (is_debug && current_cpu == "mips64el") {
+  cflags_cc = [ "-mxgot" ]
+  cflags_cc += [ "-mlong-calls" ]
+}
+
 # For feature flags internal to content. See content/public/common:features
 # for feature flags that clients of contents need to know about.
 buildflag_header("features") {
diff --git a/ppapi/proxy/BUILD.gn b/ppapi/proxy/BUILD.gn
index b572778..a2630f20 100644
--- a/ppapi/proxy/BUILD.gn
+++ b/ppapi/proxy/BUILD.gn
@@ -8,6 +8,11 @@ config("proxy_implementation") {
   defines = [ "PPAPI_PROXY_IMPLEMENTATION" ]
 }
 
+if (is_debug && current_cpu == "mips64el") {
+  cflags_cc = [ "-mxgot" ]
+  cflags_cc += [ "-mlong-calls" ]
+}
+
 component("proxy") {
   output_name = "ppapi_proxy"
 
