Build executables with -pie on Linux and Fuchsia
BUG=900182 R=thakis TBR=dschuff Change-Id: I73402d71c1deb98564ec19d07d0e19e340bb6473 Reviewed-on: https://chromium-review.googlesource.com/c/1308097 Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#604462} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 849beaf2d3c89fc319c85a6add7d8a64cae14aae
This commit is contained in:
Родитель
82d929a1b9
Коммит
3e568c8b55
|
@ -349,11 +349,11 @@ config("executable_config") {
|
|||
"//build/config/ios:ios_executable_flags",
|
||||
]
|
||||
} else if (is_linux || is_android || current_os == "aix") {
|
||||
configs += [ "//build/config/gcc:executable_ldconfig" ]
|
||||
if (is_android) {
|
||||
configs += [ "//build/config/android:executable_config" ]
|
||||
} else if (is_chromecast) {
|
||||
configs += [ "//build/config/gcc:executable_config" ]
|
||||
if (is_chromecast) {
|
||||
configs += [ "//build/config/chromecast:executable_config" ]
|
||||
} else if (is_fuchsia) {
|
||||
configs += [ "//build/config/fuchsia:executable_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,12 +181,6 @@ config("runtime_library") {
|
|||
}
|
||||
}
|
||||
|
||||
config("executable_config") {
|
||||
cflags = [ "-fPIE" ]
|
||||
asmflags = [ "-fPIE" ]
|
||||
ldflags = [ "-pie" ]
|
||||
}
|
||||
|
||||
config("hide_all_but_jni_onload") {
|
||||
ldflags = [ "-Wl,--version-script=" + rebase_path(
|
||||
"//build/android/android_only_explicit_jni_exports.lst",
|
||||
|
|
|
@ -375,10 +375,9 @@ config("compiler") {
|
|||
# Linux/Android/Fuchsia common flags setup.
|
||||
# ---------------------------------
|
||||
if (is_linux || is_android || is_fuchsia) {
|
||||
if (use_pic) {
|
||||
cflags += [ "-fPIC" ]
|
||||
ldflags += [ "-fPIC" ]
|
||||
}
|
||||
asmflags += [ "-fPIC" ]
|
||||
cflags += [ "-fPIC" ]
|
||||
ldflags += [ "-fPIC" ]
|
||||
|
||||
if (!is_clang) {
|
||||
# Use pipes for communicating between sub-processes. Faster.
|
||||
|
|
|
@ -63,9 +63,6 @@ declare_args() {
|
|||
# Windows build.
|
||||
use_incremental_wpo = false
|
||||
|
||||
# Whether or not we should use position independent code.
|
||||
use_pic = true
|
||||
|
||||
# Whether we're using a sample profile collected on an architecture different
|
||||
# than the one we're compiling for.
|
||||
#
|
||||
|
|
|
@ -121,3 +121,8 @@ action("blobstore_extended_qcow2") {
|
|||
rebase_path(blobstore_qcow_path),
|
||||
]
|
||||
}
|
||||
|
||||
# Settings for executables.
|
||||
config("executable_config") {
|
||||
ldflags = [ "-pie" ]
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ declare_args() {
|
|||
# This config causes functions not to be automatically exported from shared
|
||||
# libraries. By default, all symbols are exported but this means there are
|
||||
# lots of exports that slow everything down. In general we explicitly mark
|
||||
# which functiosn we want to export from components.
|
||||
# which functions we want to export from components.
|
||||
#
|
||||
# Some third_party code assumes all functions are exported so this is separated
|
||||
# into its own config so such libraries can remove this config to make symbols
|
||||
|
@ -53,7 +53,7 @@ config("symbol_visibility_default") {
|
|||
#
|
||||
# This is required for component builds since the build generates many shared
|
||||
# libraries in the build directory that we expect to be automatically loaded.
|
||||
# It will be automatically applied in this case by :executable_ldconfig.
|
||||
# It will be automatically applied in this case by :executable_config.
|
||||
#
|
||||
# In non-component builds, certain test binaries may expect to load dynamic
|
||||
# libraries from the current directory. As long as these aren't distributed,
|
||||
|
@ -85,8 +85,8 @@ config("rpath_for_built_shared_libraries") {
|
|||
}
|
||||
|
||||
# Settings for executables.
|
||||
config("executable_ldconfig") {
|
||||
ldflags = []
|
||||
config("executable_config") {
|
||||
ldflags = [ "-pie" ]
|
||||
if (is_android) {
|
||||
ldflags += [
|
||||
"-Bdynamic",
|
||||
|
@ -98,9 +98,6 @@ config("executable_ldconfig") {
|
|||
if (is_component_build) {
|
||||
configs = [ ":rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
if (current_cpu == "mipsel" || current_cpu == "mips64el") {
|
||||
ldflags += [ "-pie" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_android && current_os != "aix") {
|
||||
|
|
Загрузка…
Ссылка в новой задаче