[build] Enable PIE on non-IA32 Linux.

(Gets ASLR working to hopefully make non-determinism surface more often.)
(Thought I enabled this back in 2015...)

Bug: b/22479195
Bug: https://github.com/dart-lang/sdk/issues/31427
Change-Id: I02381e364ccb8bccbf5aa561959bceb7be067128
Reviewed-on: https://dart-review.googlesource.com/59281
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2018-06-11 23:27:45 +00:00 committed by commit-bot@chromium.org
parent ebc30fd0da
commit 8d82cdd6d8
3 changed files with 18 additions and 6 deletions

View file

@ -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

View file

@ -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" ]
}

View file

@ -28,3 +28,10 @@ config("sdk") {
}
}
}
config("executable_config") {
if (current_cpu != "x86") {
cflags = [ "-fPIE" ]
ldflags = [ "-pie" ]
}
}