diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index e9129e3990d..3ad0c961c26 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -292,11 +292,16 @@ if (is_win) { "//build/config/mac:mac_dynamic_flags", "//build/config/mac:mac_executable_flags", ] -} else if (is_linux || is_android) { - _executable_configs += [ "//build/config/gcc:executable_ldconfig" ] - if (is_android) { - _executable_configs += [ "//build/config/android:executable_config" ] - } +} else if (is_linux) { + _executable_configs += [ + "//build/config/gcc:executable_ldconfig", + "//build/config/linux:executable_config", + ] +} else if (is_android) { + _executable_configs += [ + "//build/config/gcc:executable_ldconfig", + "//build/config/android:executable_config", + ] } set_defaults("executable") { configs = _executable_configs diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index eeece1cb86c..8154e4e9a2c 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -234,7 +234,7 @@ config("compiler") { # 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")) { + (is_linux && current_cpu != "x86")) { cflags += [ "-fPIC" ] ldflags += [ "-fPIC" ] } diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn index 051809acd14..215025bc8ff 100644 --- a/build/config/linux/BUILD.gn +++ b/build/config/linux/BUILD.gn @@ -28,3 +28,10 @@ config("sdk") { } } } + +config("executable_config") { + if (current_cpu != "x86") { + cflags = [ "-fPIE" ] + ldflags = [ "-pie" ] + } +}