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/android/config.gni") | 5 import("//build/config/android/config.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 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
11 config("sdk") { | |
brettw
2015/09/27 23:42:24
This just moved to the bottom so the "compiler" on
| |
12 if (sysroot != "") { | |
13 cflags = [ "--sysroot=" + sysroot ] | |
14 ldflags = [ "--sysroot=" + sysroot ] | |
15 | |
16 # Need to get some linker flags out of the sysroot. | |
17 sysroot_ld_path = rebase_path("//build/config/linux/sysroot_ld_path.py") | |
18 ldflags += [ exec_script(sysroot_ld_path, | |
19 [ | |
20 rebase_path("//build/linux/sysroot_ld_path.sh"), | |
21 sysroot, | |
22 ], | |
23 "value") ] | |
24 } | |
25 } | |
26 | |
27 config("executable_config") { | |
28 cflags = [ "-fPIE" ] | |
29 ldflags = [ "-pie" ] | |
30 } | |
31 | |
32 config("hide_native_jni_exports") { | |
33 ldflags = [ "-Wl,--version-script=" + | |
34 rebase_path("//build/android/android_no_jni_exports.lst") ] | |
35 } | |
36 | |
37 # This is included by reference in the //build/config/compiler config that | 11 # This is included by reference in the //build/config/compiler config that |
38 # is applied to all targets. It is here to separate out the logic that is | 12 # is applied to all targets. It is here to separate out the logic that is |
39 # Android-only. | 13 # Android-only. |
40 config("compiler") { | 14 config("compiler") { |
41 cflags = [ | 15 cflags = [ |
42 "-ffunction-sections", | 16 "-ffunction-sections", |
43 "-funwind-tables", | 17 "-funwind-tables", |
44 "-fno-short-enums", | 18 "-fno-short-enums", |
45 ] | 19 ] |
46 defines = [ | 20 defines = [ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 cflags += [ | 109 cflags += [ |
136 "-target", | 110 "-target", |
137 abi_target, | 111 abi_target, |
138 ] | 112 ] |
139 ldflags += [ | 113 ldflags += [ |
140 "-target", | 114 "-target", |
141 abi_target, | 115 abi_target, |
142 ] | 116 ] |
143 } | 117 } |
144 } | 118 } |
119 | |
120 # This is included by reference in the //build/config/compiler:runtime_library | |
121 # config that is applied to all targets. It is here to separate out the logic | |
122 # that is Android-only. Please see that target for advice on what should go in | |
123 # :runtime_library vs. :compiler. | |
124 config("runtime_library") { | |
125 # NOTE: The libc++ header include paths below are specified in cflags | |
126 # rather than include_dirs because they need to come after include_dirs. | |
127 # Think of them like system headers, but don't use '-isystem' because the | |
128 # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit | |
129 # strange errors. The include ordering here is important; change with | |
130 # caution. | |
131 cflags = [ | |
132 "-isystem" + | |
133 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), | |
134 "-isystem" + rebase_path( | |
135 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" , | |
136 root_build_dir), | |
137 "-isystem" + | |
138 rebase_path("$android_ndk_root/sources/android/support/include", | |
139 root_build_dir), | |
140 ] | |
141 | |
142 defines = [ "__GNU_SOURCE=1" ] # Necessary for clone(). | |
143 ldflags += [ "-nostdlib" ] | |
144 lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ] | |
145 libs = [ | |
146 "c", | |
147 "dl", | |
148 "m", | |
149 ] | |
150 | |
151 # The libc++ runtime library. | |
152 if (is_component_build) { | |
153 libs += [ "c++_shared" ] | |
154 } else { | |
155 libs += [ "c++_static" ] | |
156 } | |
157 | |
158 if (is_clang) { | |
159 # Work around incompatibilities between bionic and clang headers. | |
160 defines += [ | |
161 "__compiler_offsetof=__builtin_offsetof", | |
162 "nan=__builtin_nan", | |
163 ] | |
164 } | |
165 | |
166 # TODO(jdduke) Re-enable on mips after resolving linking | |
167 # issues with libc++ (crbug.com/456380). | |
168 if (current_cpu != "mipsel" && current_cpu != "mips64el") { | |
169 ldflags += [ "-Wl,--warn-shared-textrel" ] | |
170 } | |
171 | |
172 if (current_cpu == "mipsel") { | |
173 libs += [ | |
174 # ld linker is used for mips Android, and ld does not accept library | |
175 # absolute path prefixed by "-l"; Since libgcc does not exist in mips | |
176 # sysroot the proper library will be linked. | |
177 # TODO(gordanac): Remove once gold linker is used for mips Android. | |
178 "gcc", | |
179 ] | |
180 } else { | |
181 libs += [ | |
182 # Manually link the libgcc.a that the cross compiler uses. This is | |
183 # absolute because the linker will look inside the sysroot if it's not. | |
184 rebase_path(android_libgcc_file), | |
185 ] | |
186 } | |
187 | |
188 # Clang with libc++ does not require an explicit atomic library reference. | |
189 if (!is_clang) { | |
190 libs += [ "atomic" ] | |
191 } | |
192 } | |
193 | |
194 config("sdk") { | |
195 if (sysroot != "") { | |
196 cflags = [ "--sysroot=" + sysroot ] | |
197 ldflags = [ "--sysroot=" + sysroot ] | |
198 | |
199 # Need to get some linker flags out of the sysroot. | |
200 sysroot_ld_path = rebase_path("//build/config/linux/sysroot_ld_path.py") | |
201 ldflags += [ exec_script(sysroot_ld_path, | |
202 [ | |
203 rebase_path("//build/linux/sysroot_ld_path.sh"), | |
204 sysroot, | |
205 ], | |
206 "value") ] | |
207 } | |
208 } | |
209 | |
210 config("executable_config") { | |
211 cflags = [ "-fPIE" ] | |
212 ldflags = [ "-pie" ] | |
213 } | |
214 | |
215 config("hide_native_jni_exports") { | |
216 ldflags = [ "-Wl,--version-script=" + | |
217 rebase_path("//build/android/android_no_jni_exports.lst") ] | |
218 } | |
OLD | NEW |