Index: build/config/gcc/BUILD.gn |
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn |
index 17414467e76ee9a906d7e9bf4d1789933c9128c7..62eec11904ac93b8cf26f75e76796c0881559dcd 100644 |
--- a/build/config/gcc/BUILD.gn |
+++ b/build/config/gcc/BUILD.gn |
@@ -2,7 +2,9 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import("//build/config/compiler/compiler.gni") |
import("//build/config/sanitizers/sanitizers.gni") |
+import("//build/config/sysroot.gni") |
import("//build/toolchain/toolchain.gni") |
# This config causes functions not to be automatically exported from shared |
@@ -69,8 +71,9 @@ config("rpath_for_built_shared_libraries") { |
# Settings for executables. |
config("executable_ldconfig") { |
+ ldflags = [] |
if (is_android) { |
- ldflags = [ |
+ ldflags += [ |
"-Bdynamic", |
"-Wl,-z,nocopyreloc", |
] |
@@ -80,19 +83,26 @@ config("executable_ldconfig") { |
if (is_component_build || using_sanitizer) { |
configs = [ ":rpath_for_built_shared_libraries" ] |
} |
+ if (current_cpu == "mipsel") { |
+ ldflags += [ "-pie" ] |
+ } |
+ } |
+ if (!is_android || !use_gold) { |
# Find the path containing shared libraries for this toolchain |
# relative to the build directory. ${root_out_dir} will be a |
# subdirectory of ${root_build_dir} when cross compiling. |
- rebased_out_dir = rebase_path(root_out_dir, root_build_dir) |
+ _rpath_link = rebase_path(root_out_dir, root_build_dir) |
if (shlib_subdir != ".") { |
- rpath_link = "${rebased_out_dir}/${shlib_subdir}" |
- } else { |
- rpath_link = rebased_out_dir |
+ _rpath_link += "/$shlib_subdir" |
+ } |
+ if (is_android) { |
+ _rebased_sysroot = rebase_path(sysroot, root_build_dir) |
+ _rpath_link += ":$_rebased_sysroot/usr/lib" |
} |
- ldflags = [ |
- "-Wl,-rpath-link=${rpath_link}", |
+ ldflags += [ |
+ "-Wl,-rpath-link=$_rpath_link", |
# TODO(GYP): Do we need a check on the binutils version here? |
# |
@@ -100,9 +110,6 @@ config("executable_ldconfig") { |
# and the new DT_RUNPATH doesn't work without --no-as-needed flag. |
"-Wl,--disable-new-dtags", |
] |
- if (current_cpu == "mipsel") { |
- ldflags += [ "-pie" ] |
- } |
} |
} |