| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/compiler/compiler.gni") |
| 5 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
| 7 import("//build/config/sysroot.gni") |
| 6 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
| 7 | 9 |
| 8 # This config causes functions not to be automatically exported from shared | 10 # This config causes functions not to be automatically exported from shared |
| 9 # libraries. By default, all symbols are exported but this means there are | 11 # libraries. By default, all symbols are exported but this means there are |
| 10 # lots of exports that slow everything down. In general we explicitly mark | 12 # lots of exports that slow everything down. In general we explicitly mark |
| 11 # which functiosn we want to export from components. | 13 # which functiosn we want to export from components. |
| 12 # | 14 # |
| 13 # Some third_party code assumes all functions are exported so this is separated | 15 # Some third_party code assumes all functions are exported so this is separated |
| 14 # into its own config so such libraries can remove this config to make symbols | 16 # into its own config so such libraries can remove this config to make symbols |
| 15 # public again. | 17 # public again. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ldflags = [ | 64 ldflags = [ |
| 63 # Want to pass "\$". GN will re-escape as required for ninja. | 65 # Want to pass "\$". GN will re-escape as required for ninja. |
| 64 "-Wl,-rpath=\$ORIGIN/${rpath_link}", | 66 "-Wl,-rpath=\$ORIGIN/${rpath_link}", |
| 65 "-Wl,-rpath-link=${rpath_link}", | 67 "-Wl,-rpath-link=${rpath_link}", |
| 66 ] | 68 ] |
| 67 } | 69 } |
| 68 } | 70 } |
| 69 | 71 |
| 70 # Settings for executables. | 72 # Settings for executables. |
| 71 config("executable_ldconfig") { | 73 config("executable_ldconfig") { |
| 74 ldflags = [] |
| 72 if (is_android) { | 75 if (is_android) { |
| 73 ldflags = [ | 76 ldflags += [ |
| 74 "-Bdynamic", | 77 "-Bdynamic", |
| 75 "-Wl,-z,nocopyreloc", | 78 "-Wl,-z,nocopyreloc", |
| 76 ] | 79 ] |
| 77 } else { | 80 } else { |
| 78 # See the rpath_for... config above for why this is necessary for component | 81 # See the rpath_for... config above for why this is necessary for component |
| 79 # builds. Sanitizers use a custom libc++ where this is also necessary. | 82 # builds. Sanitizers use a custom libc++ where this is also necessary. |
| 80 if (is_component_build || using_sanitizer) { | 83 if (is_component_build || using_sanitizer) { |
| 81 configs = [ ":rpath_for_built_shared_libraries" ] | 84 configs = [ ":rpath_for_built_shared_libraries" ] |
| 82 } | 85 } |
| 86 if (current_cpu == "mipsel") { |
| 87 ldflags += [ "-pie" ] |
| 88 } |
| 89 } |
| 83 | 90 |
| 91 if (!is_android || !use_gold) { |
| 84 # Find the path containing shared libraries for this toolchain | 92 # Find the path containing shared libraries for this toolchain |
| 85 # relative to the build directory. ${root_out_dir} will be a | 93 # relative to the build directory. ${root_out_dir} will be a |
| 86 # subdirectory of ${root_build_dir} when cross compiling. | 94 # subdirectory of ${root_build_dir} when cross compiling. |
| 87 rebased_out_dir = rebase_path(root_out_dir, root_build_dir) | 95 _rpath_link = rebase_path(root_out_dir, root_build_dir) |
| 88 if (shlib_subdir != ".") { | 96 if (shlib_subdir != ".") { |
| 89 rpath_link = "${rebased_out_dir}/${shlib_subdir}" | 97 _rpath_link += "/$shlib_subdir" |
| 90 } else { | 98 } |
| 91 rpath_link = rebased_out_dir | 99 if (is_android) { |
| 100 _rebased_sysroot = rebase_path(sysroot, root_build_dir) |
| 101 _rpath_link += ":$_rebased_sysroot/usr/lib" |
| 92 } | 102 } |
| 93 | 103 |
| 94 ldflags = [ | 104 ldflags += [ |
| 95 "-Wl,-rpath-link=${rpath_link}", | 105 "-Wl,-rpath-link=$_rpath_link", |
| 96 | 106 |
| 97 # TODO(GYP): Do we need a check on the binutils version here? | 107 # TODO(GYP): Do we need a check on the binutils version here? |
| 98 # | 108 # |
| 99 # Newer binutils don't set DT_RPATH unless you disable "new" dtags | 109 # Newer binutils don't set DT_RPATH unless you disable "new" dtags |
| 100 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. | 110 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. |
| 101 "-Wl,--disable-new-dtags", | 111 "-Wl,--disable-new-dtags", |
| 102 ] | 112 ] |
| 103 if (current_cpu == "mipsel") { | |
| 104 ldflags += [ "-pie" ] | |
| 105 } | |
| 106 } | 113 } |
| 107 } | 114 } |
| 108 | 115 |
| 109 config("no_exceptions") { | 116 config("no_exceptions") { |
| 110 cflags_cc = [ "-fno-exceptions" ] | 117 cflags_cc = [ "-fno-exceptions" ] |
| 111 cflags_objcc = cflags_cc | 118 cflags_objcc = cflags_cc |
| 112 } | 119 } |
| OLD | NEW |