Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 07ac124fa239c41aabd04cf726faac77ed7414db..346059763e2ab5072efac0a9156fc4e823dd6dc2 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -299,6 +299,17 @@ config("compiler") { |
] |
} |
+ # We need -fPIC: |
+ # 1. On ARM and MIPS for tcmalloc. |
+ # 2. On Android. |
+ # 3. When using the sanitizers. |
+ # Otherwise there is a performance hit, in particular on ia32. |
+ if (is_android || is_asan || is_lsan || is_msan || is_tsan || |
+ (is_linux && (current_cpu == "arm" || current_cpu == "mipsel"))) { |
+ cflags += [ "-fPIC" ] |
+ ldflags += [ "-fPIC" ] |
+ } |
+ |
# Linux-specific compiler flags setup. |
# ------------------------------------ |
if (is_linux) { |