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/compiler/compiler.gni") |
6 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
7 import("//build/config/sysroot.gni") | 7 import("//build/config/sysroot.gni") |
8 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 | 9 |
| 10 declare_args() { |
| 11 # When non empty, overrides the target rpath value. This allows a user to |
| 12 # make a Chromium build where binaries and shared libraries are meant to be |
| 13 # installed into separate directories, like /usr/bin/chromium and |
| 14 # /usr/lib/chromium for instance. It is useful when a build system that |
| 15 # generates a whole target root filesystem (like Yocto) is used on top of gn, |
| 16 # especially when cross-compiling. |
| 17 # Note: this gn arg is similar to gyp target_rpath generator flag. |
| 18 gcc_target_rpath = "" |
| 19 } |
| 20 |
10 # This config causes functions not to be automatically exported from shared | 21 # This config causes functions not to be automatically exported from shared |
11 # libraries. By default, all symbols are exported but this means there are | 22 # 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 | 23 # lots of exports that slow everything down. In general we explicitly mark |
13 # which functiosn we want to export from components. | 24 # which functiosn we want to export from components. |
14 # | 25 # |
15 # Some third_party code assumes all functions are exported so this is separated | 26 # 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 | 27 # into its own config so such libraries can remove this config to make symbols |
17 # public again. | 28 # public again. |
18 # | 29 # |
19 # See http://gcc.gnu.org/wiki/Visibility | 30 # See http://gcc.gnu.org/wiki/Visibility |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 # configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] | 65 # configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] |
55 # } | 66 # } |
56 config("rpath_for_built_shared_libraries") { | 67 config("rpath_for_built_shared_libraries") { |
57 if (!is_android) { | 68 if (!is_android) { |
58 # Note: Android doesn't support rpath. | 69 # Note: Android doesn't support rpath. |
59 if (shlib_subdir != ".") { | 70 if (shlib_subdir != ".") { |
60 rpath_link = "${shlib_subdir}/" | 71 rpath_link = "${shlib_subdir}/" |
61 } else { | 72 } else { |
62 rpath_link = "." | 73 rpath_link = "." |
63 } | 74 } |
64 ldflags = [ | 75 if (current_toolchain != default_toolchain || gcc_target_rpath == "") { |
65 # Want to pass "\$". GN will re-escape as required for ninja. | 76 ldflags = [ |
66 "-Wl,-rpath=\$ORIGIN/${rpath_link}", | 77 # Want to pass "\$". GN will re-escape as required for ninja. |
67 "-Wl,-rpath-link=${rpath_link}", | 78 "-Wl,-rpath=\$ORIGIN/${rpath_link}", |
68 ] | 79 "-Wl,-rpath-link=${rpath_link}", |
| 80 ] |
| 81 } else { |
| 82 ldflags = [ |
| 83 "-Wl,-rpath=${gcc_target_rpath}", |
| 84 "-Wl,-rpath-link=${rpath_link}", |
| 85 ] |
| 86 } |
69 } | 87 } |
70 } | 88 } |
71 | 89 |
72 # Settings for executables. | 90 # Settings for executables. |
73 config("executable_ldconfig") { | 91 config("executable_ldconfig") { |
74 # WARNING! //sandbox/linux:chrome_sandbox will not pick up this | 92 # WARNING! //sandbox/linux:chrome_sandbox will not pick up this |
75 # config, because it is a setuid binary that needs special flags. | 93 # config, because it is a setuid binary that needs special flags. |
76 # If you add things to this config, make sure you check to see | 94 # If you add things to this config, make sure you check to see |
77 # if they should be added to that target as well. | 95 # if they should be added to that target as well. |
78 ldflags = [] | 96 ldflags = [] |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. | 132 # and the new DT_RUNPATH doesn't work without --no-as-needed flag. |
115 "-Wl,--disable-new-dtags", | 133 "-Wl,--disable-new-dtags", |
116 ] | 134 ] |
117 } | 135 } |
118 } | 136 } |
119 | 137 |
120 config("no_exceptions") { | 138 config("no_exceptions") { |
121 cflags_cc = [ "-fno-exceptions" ] | 139 cflags_cc = [ "-fno-exceptions" ] |
122 cflags_objcc = cflags_cc | 140 cflags_objcc = cflags_cc |
123 } | 141 } |
OLD | NEW |