From 5580693fa8ec3b1780af35aed378f0968371945c Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Fri, 20 Jan 2017 14:37:50 -0800 Subject: [PATCH] GN: Add back -fPIC for a few things Review-Url: https://codereview.chromium.org/2640923005 . --- build/config/compiler/BUILD.gn | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 07ac124fa23..346059763e2 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) {