Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: build/config/android/BUILD.gn

Issue 1996433002: 👻 Reland of Merge android's use_gold settings with the main use_gold GN arg logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete --icf=safe Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/config/compiler/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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")
8 7
9 assert(is_android) 8 assert(is_android)
10 9
11 use_gold = current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm"
12
13 # This is included by reference in the //build/config/compiler config that 10 # This is included by reference in the //build/config/compiler config that
14 # is applied to all targets. It is here to separate out the logic that is 11 # is applied to all targets. It is here to separate out the logic that is
15 # Android-only. 12 # Android-only.
16 config("compiler") { 13 config("compiler") {
17 cflags = [ 14 cflags = [
18 "-ffunction-sections", 15 "-ffunction-sections",
19 "-fno-short-enums", 16 "-fno-short-enums",
20 ] 17 ]
21 defines = [ 18 defines = [
22 "ANDROID", 19 "ANDROID",
23 20
24 # The NDK has these things, but doesn't define the constants to say that it 21 # The NDK has these things, but doesn't define the constants to say that it
25 # does. Define them here instead. 22 # does. Define them here instead.
26 "HAVE_SYS_UIO_H", 23 "HAVE_SYS_UIO_H",
27 ] 24 ]
28 ldflags = []
29 25
30 if (!is_clang) {
31 # Clang doesn't support these flags.
32 cflags += [ "-finline-limit=64" ]
33 }
34 if (is_clang) { 26 if (is_clang) {
35 rebased_android_toolchain_root = 27 rebased_android_toolchain_root =
36 rebase_path(android_toolchain_root, root_build_dir) 28 rebase_path(android_toolchain_root, root_build_dir)
37 assert(rebased_android_toolchain_root != "") # Mark as used. 29 assert(rebased_android_toolchain_root != "") # Mark as used.
38 if (current_cpu == "mipsel") { 30 if (current_cpu == "mipsel") {
39 cflags += [ 31 cflags += [
40 # TODO(gordanac) Enable integrated-as. 32 # TODO(gordanac) Enable integrated-as.
41 "-no-integrated-as", 33 "-no-integrated-as",
42 "-B${rebased_android_toolchain_root}/bin", # Else /usr/bin/as gets pick ed up. 34 "-B${rebased_android_toolchain_root}/bin", # Else /usr/bin/as gets pick ed up.
43 ] 35 ]
44 } 36 }
37 } else {
38 # Clang doesn't support these flags.
39 cflags += [ "-finline-limit=64" ]
45 } 40 }
46 41
47 # Use gold for Android for most CPU architectures. 42 ldflags = [
48 if (use_gold) {
49 ldflags += [ "-fuse-ld=gold" ]
50 if (is_clang) {
51 # Let clang find the ld.gold in the NDK.
52 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
53 }
54
55 # Use -mstackrealign due to a bug on ia32 Jelly Bean.
56 # See crbug.com/521527
57 if (current_cpu == "x86") {
58 cflags += [ "-mstackrealign" ]
59 }
60 }
61
62 if (current_cpu == "mipsel" && is_clang) {
63 # Let clang find the ld.bfd in the NDK.
64 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
65 }
66
67 ldflags += [
68 "-Wl,--build-id=sha1", 43 "-Wl,--build-id=sha1",
69 "-Wl,--no-undefined", 44 "-Wl,--no-undefined",
70 45
71 # Don't allow visible symbols from libgcc or libc++ to be 46 # Don't allow visible symbols from libgcc or libc++ to be
72 # re-exported. 47 # re-exported.
73 "-Wl,--exclude-libs=libgcc.a", 48 "-Wl,--exclude-libs=libgcc.a",
74 "-Wl,--exclude-libs=libc++_static.a", 49 "-Wl,--exclude-libs=libc++_static.a",
75 50
76 # Don't allow visible symbols from libraries that contain 51 # Don't allow visible symbols from libraries that contain
77 # assembly code with symbols that aren't hidden properly. 52 # assembly code with symbols that aren't hidden properly.
78 # http://crbug.com/448386 53 # http://crbug.com/448386
79 "-Wl,--exclude-libs=libvpx_assembly_arm.a", 54 "-Wl,--exclude-libs=libvpx_assembly_arm.a",
80 ] 55 ]
81 if (current_cpu == "arm" && !use_order_profiling) {
82 ldflags += [
83 # Enable identical code folding to reduce size.
84 "-Wl,--icf=all",
85 ]
86 }
87 56
88 if (is_clang) { 57 if (is_clang) {
89 if (current_cpu == "arm") { 58 if (current_cpu == "arm") {
90 abi_target = "arm-linux-androideabi" 59 abi_target = "arm-linux-androideabi"
91 } else if (current_cpu == "x86") { 60 } else if (current_cpu == "x86") {
92 abi_target = "i686-linux-androideabi" 61 abi_target = "i686-linux-androideabi"
93 } else if (current_cpu == "arm64") { 62 } else if (current_cpu == "arm64") {
94 # Place holder for arm64 support, not tested. 63 # Place holder for arm64 support, not tested.
95 # TODO: Enable clang support for Android Arm64. http://crbug.com/539781 64 # TODO: Enable clang support for Android Arm64. http://crbug.com/539781
96 abi_target = "aarch64-linux-android" 65 abi_target = "aarch64-linux-android"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 # issues with libc++ (crbug.com/456380). 143 # issues with libc++ (crbug.com/456380).
175 if (current_cpu != "mipsel" && current_cpu != "mips64el") { 144 if (current_cpu != "mipsel" && current_cpu != "mips64el") {
176 ldflags += [ "-Wl,--warn-shared-textrel" ] 145 ldflags += [ "-Wl,--warn-shared-textrel" ]
177 } 146 }
178 } 147 }
179 148
180 config("executable_config") { 149 config("executable_config") {
181 cflags = [ "-fPIE" ] 150 cflags = [ "-fPIE" ]
182 asmflags = [ "-fPIE" ] 151 asmflags = [ "-fPIE" ]
183 ldflags = [ "-pie" ] 152 ldflags = [ "-pie" ]
184
185 if (!use_gold) {
186 # ld needs help finding libraries when linking.
187 _rebased_sysroot = rebase_path(sysroot, root_build_dir)
188 ldflags += [ "-Wl,-rpath-link=.:$_rebased_sysroot/usr/lib" ]
189 }
190 } 153 }
191 154
192 config("hide_native_jni_exports") { 155 config("hide_native_jni_exports") {
193 ldflags = [ "-Wl,--version-script=" + 156 ldflags = [ "-Wl,--version-script=" +
194 rebase_path("//build/android/android_no_jni_exports.lst") ] 157 rebase_path("//build/android/android_no_jni_exports.lst") ]
195 } 158 }
196 159
197 # Instrumentation ------------------------------------------------------------- 160 # Instrumentation -------------------------------------------------------------
198 # 161 #
199 # The BUILDCONFIG file sets the "default_cygprofile_instrumentation" config on 162 # The BUILDCONFIG file sets the "default_cygprofile_instrumentation" config on
(...skipping 22 matching lines...) Expand all
222 185
223 # Avoid errors with current NDK: 186 # Avoid errors with current NDK:
224 # "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.6/preb uilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include/arm_neon.h:34 26:3: error: argument must be a constant" 187 # "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.6/preb uilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include/arm_neon.h:34 26:3: error: argument must be a constant"
225 "-finstrument-functions-exclude-file-list=arm_neon.h", 188 "-finstrument-functions-exclude-file-list=arm_neon.h",
226 ] 189 ]
227 } 190 }
228 } 191 }
229 192
230 config("no_cygprofile_instrumentation") { 193 config("no_cygprofile_instrumentation") {
231 } 194 }
OLDNEW
« no previous file with comments | « no previous file | build/config/compiler/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698