| 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/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 | 6 |
| 7 # This config causes functions not to be automatically exported from shared | 7 # This config causes functions not to be automatically exported from shared |
| 8 # libraries. By default, all symbols are exported but this means there are | 8 # libraries. By default, all symbols are exported but this means there are |
| 9 # lots of exports that slow everything down. In general we explicitly mark | 9 # lots of exports that slow everything down. In general we explicitly mark |
| 10 # which functiosn we want to export from components. | 10 # which functiosn we want to export from components. |
| 11 # | 11 # |
| 12 # Some third_party code assumes all functions are exported so this is separated | 12 # Some third_party code assumes all functions are exported so this is separated |
| 13 # into its own config so such libraries can remove this config to make symbols | 13 # into its own config so such libraries can remove this config to make symbols |
| 14 # public again. | 14 # public again. |
| 15 # | 15 # |
| 16 # See http://gcc.gnu.org/wiki/Visibility | 16 # See http://gcc.gnu.org/wiki/Visibility |
| 17 config("symbol_visibility_hidden") { | 17 config("symbol_visibility_hidden") { |
| 18 # Note that -fvisibility-inlines-hidden is set globally in the compiler | 18 # Note that -fvisibility-inlines-hidden is set globally in the compiler |
| 19 # config since that can almost always be applied. | 19 # config since that can almost always be applied. |
| 20 cflags = [ "-fvisibility=hidden" ] | 20 cflags = [ "-fvisibility=hidden" ] |
| 21 } | 21 } |
| 22 | 22 |
| 23 # Settings for executables and shared libraries. | 23 config("rpath_link") { |
| 24 config("executable_ldconfig") { | 24 if (!is_android) { |
| 25 if (is_android) { | |
| 26 ldflags = [ | |
| 27 "-Bdynamic", | |
| 28 "-Wl,-z,nocopyreloc", | |
| 29 ] | |
| 30 } else { | |
| 31 # Note: Android doesn't support rpath. | 25 # Note: Android doesn't support rpath. |
| 32 rpath_link = "" | 26 rpath_link = "" |
| 33 if (shlib_subdir != ".") { | 27 if (shlib_subdir != ".") { |
| 34 rpath_link = "${shlib_subdir}/" | 28 rpath_link = "${shlib_subdir}/" |
| 35 } | 29 } |
| 36 ldflags = [ | 30 ldflags = [ |
| 37 # Want to pass "\$". GN will re-escape as required for ninja. | 31 # Want to pass "\$". GN will re-escape as required for ninja. |
| 38 "-Wl,-rpath=\$ORIGIN/${rpath_link}", | 32 "-Wl,-rpath=\$ORIGIN/${rpath_link}", |
| 39 "-Wl,-rpath-link=${rpath_link}", | 33 "-Wl,-rpath-link=${rpath_link}", |
| 34 ] |
| 35 } |
| 36 } |
| 40 | 37 |
| 38 # Settings for executables and shared libraries. |
| 39 config("executable_ldconfig") { |
| 40 if (is_android) { |
| 41 ldflags = [ |
| 42 "-Bdynamic", |
| 43 "-Wl,-z,nocopyreloc", |
| 44 ] |
| 45 } else { |
| 46 if (is_component_build) { |
| 47 configs += [ ":rpath_link" ] |
| 48 } |
| 49 |
| 50 ldflags = [ |
| 51 # TODO(GYP): Do we need a check on the binutils version here? |
| 52 # |
| 41 # Newer binutils don't set DT_RPATH unless you disable "new" dtags | 53 # Newer binutils don't set DT_RPATH unless you disable "new" dtags |
| 42 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. | 54 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. |
| 43 "-Wl,--disable-new-dtags", | 55 "-Wl,--disable-new-dtags", |
| 44 ] | 56 ] |
| 45 } | 57 } |
| 46 } | 58 } |
| 47 | 59 |
| 48 config("no_exceptions") { | 60 config("no_exceptions") { |
| 49 cflags_cc = [ "-fno-exceptions" ] | 61 cflags_cc = [ "-fno-exceptions" ] |
| 50 cflags_objcc = cflags_cc | 62 cflags_objcc = cflags_cc |
| 51 } | 63 } |
| OLD | NEW |