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