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

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

Issue 1475943003: gn: add support for clang for MIPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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") 7 import("//build/config/sysroot.gni")
8 8
9 assert(is_android) 9 assert(is_android)
10 10
(...skipping 15 matching lines...) Expand all
26 ] 26 ]
27 ldflags = [] 27 ldflags = []
28 28
29 if (!is_clang) { 29 if (!is_clang) {
30 # Clang doesn't support these flags. 30 # Clang doesn't support these flags.
31 cflags += [ "-finline-limit=64" ] 31 cflags += [ "-finline-limit=64" ]
32 } 32 }
33 if (is_clang) { 33 if (is_clang) {
34 rebased_android_toolchain_root = 34 rebased_android_toolchain_root =
35 rebase_path(android_toolchain_root, root_build_dir) 35 rebase_path(android_toolchain_root, root_build_dir)
36 if (current_cpu == "arm") { 36 if (current_cpu == "arm" || current_cpu == "mipsel") {
37 cflags += [ 37 cflags += [
38 # TODO(hans) Enable integrated-as (crbug.com/124610). 38 # TODO(hans) Enable integrated-as (crbug.com/124610).
39 "-no-integrated-as", 39 "-no-integrated-as",
40 "-B${rebased_android_toolchain_root}/bin", # Else /usr/bin/as gets pick ed up. 40 "-B${rebased_android_toolchain_root}/bin", # Else /usr/bin/as gets pick ed up.
41 ] 41 ]
42 } 42 }
43 } 43 }
44 44
45 # Use gold for Android for most CPU architectures. 45 # Use gold for Android for most CPU architectures.
46 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") { 46 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
47 ldflags += [ "-fuse-ld=gold" ] 47 ldflags += [ "-fuse-ld=gold" ]
48 if (is_clang) { 48 if (is_clang) {
49 # Let clang find the ld.gold in the NDK. 49 # Let clang find the ld.gold in the NDK.
50 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ] 50 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
51 } 51 }
52 52
53 # Use -mstackrealign due to a bug on ia32 Jelly Bean. 53 # Use -mstackrealign due to a bug on ia32 Jelly Bean.
54 # See crbug.com/521527 54 # See crbug.com/521527
55 if (current_cpu == "x86") { 55 if (current_cpu == "x86") {
56 cflags += [ "-mstackrealign" ] 56 cflags += [ "-mstackrealign" ]
57 } 57 }
58 } 58 }
59 59
60 if (current_cpu == "mipsel" && is_clang) {
61 # Let clang find the ld.bfd in the NDK.
62 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
63 }
64
60 ldflags += [ 65 ldflags += [
61 "-Wl,--no-undefined", 66 "-Wl,--no-undefined",
62 67
63 # Don't allow visible symbols from libgcc or libc++ to be 68 # Don't allow visible symbols from libgcc or libc++ to be
64 # re-exported. 69 # re-exported.
65 "-Wl,--exclude-libs=libgcc.a", 70 "-Wl,--exclude-libs=libgcc.a",
66 "-Wl,--exclude-libs=libc++_static.a", 71 "-Wl,--exclude-libs=libc++_static.a",
67 72
68 # Don't allow visible symbols from libraries that contain 73 # Don't allow visible symbols from libraries that contain
69 # assembly code with symbols that aren't hidden properly. 74 # assembly code with symbols that aren't hidden properly.
(...skipping 14 matching lines...) Expand all
84 abi_target = "i686-linux-androideabi" 89 abi_target = "i686-linux-androideabi"
85 } else if (current_cpu == "arm64") { 90 } else if (current_cpu == "arm64") {
86 # Place holder for arm64 support, not tested. 91 # Place holder for arm64 support, not tested.
87 # TODO: Enable clang support for Android Arm64. http://crbug.com/539781 92 # TODO: Enable clang support for Android Arm64. http://crbug.com/539781
88 abi_target = "aarch64-linux-androideabi" 93 abi_target = "aarch64-linux-androideabi"
89 } else if (current_cpu == "x64") { 94 } else if (current_cpu == "x64") {
90 # Place holder for x64 support, not tested. 95 # Place holder for x64 support, not tested.
91 # TODO: Enable clang support for Android x64. http://crbug.com/539781 96 # TODO: Enable clang support for Android x64. http://crbug.com/539781
92 abi_target = "x86_64-linux-androideabi" 97 abi_target = "x86_64-linux-androideabi"
93 } else if (current_cpu == "mipsel") { 98 } else if (current_cpu == "mipsel") {
94 # Place holder for mips support, not tested. 99 abi_target = "mipsel-linux-android"
95 abi_target = "mipsel-linux-androideabi"
96 } else if (current_cpu == "mips64el") { 100 } else if (current_cpu == "mips64el") {
97 # Place holder for mips64 support, not tested. 101 # Place holder for mips64 support, not tested.
98 abi_target = "mips64el-linux-androideabi" 102 abi_target = "mips64el-linux-androideabi"
99 } else { 103 } else {
100 assert(false, "Architecture not supported") 104 assert(false, "Architecture not supported")
101 } 105 }
102 cflags += [ 106 cflags += [
103 "-target", 107 "-target",
104 abi_target, 108 abi_target,
105 ] 109 ]
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 defines = [ "__GNU_SOURCE=1" ] # Necessary for clone(). 143 defines = [ "__GNU_SOURCE=1" ] # Necessary for clone().
140 ldflags = [ "-nostdlib" ] 144 ldflags = [ "-nostdlib" ]
141 lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ] 145 lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ]
142 146
143 # The libc++ runtime library (must come first). 147 # The libc++ runtime library (must come first).
144 if (is_component_build) { 148 if (is_component_build) {
145 libs = [ "c++_shared" ] 149 libs = [ "c++_shared" ]
146 } else { 150 } else {
147 libs = [ "c++_static" ] 151 libs = [ "c++_static" ]
148 } 152 }
153
154 # libgcc must come before libdl for ld.bfd (MIPS)
155 if (current_cpu == "mipsel") {
156 libs += [
157 # ld linker is used for mips Android, and ld does not accept library
158 # absolute path prefixed by "-l"; Since libgcc does not exist in mips
159 # sysroot the proper library will be linked.
160 # TODO(gordanac): Remove once gold linker is used for mips Android.
161 "gcc",
162 ]
163 } else {
164 libs += [
165 # Manually link the libgcc.a that the cross compiler uses. This is
166 # absolute because the linker will look inside the sysroot if it's not.
167 rebase_path(android_libgcc_file),
168 ]
169 }
170
149 libs += [ 171 libs += [
150 "c", 172 "c",
151 "dl", 173 "dl",
152 "m", 174 "m",
153 ] 175 ]
154 176
155 if (is_clang) { 177 if (is_clang) {
156 # Work around incompatibilities between bionic and clang headers. 178 # Work around incompatibilities between bionic and clang headers.
157 defines += [ 179 defines += [
158 "__compiler_offsetof=__builtin_offsetof", 180 "__compiler_offsetof=__builtin_offsetof",
159 "nan=__builtin_nan", 181 "nan=__builtin_nan",
160 ] 182 ]
161 } 183 }
162 184
163 # TODO(jdduke) Re-enable on mips after resolving linking 185 # TODO(jdduke) Re-enable on mips after resolving linking
164 # issues with libc++ (crbug.com/456380). 186 # issues with libc++ (crbug.com/456380).
165 if (current_cpu != "mipsel" && current_cpu != "mips64el") { 187 if (current_cpu != "mipsel" && current_cpu != "mips64el") {
166 ldflags += [ "-Wl,--warn-shared-textrel" ] 188 ldflags += [ "-Wl,--warn-shared-textrel" ]
167 } 189 }
168 190
169 if (current_cpu == "mipsel") {
170 libs += [
171 # ld linker is used for mips Android, and ld does not accept library
172 # absolute path prefixed by "-l"; Since libgcc does not exist in mips
173 # sysroot the proper library will be linked.
174 # TODO(gordanac): Remove once gold linker is used for mips Android.
175 "gcc",
176 ]
177 } else {
178 libs += [
179 # Manually link the libgcc.a that the cross compiler uses. This is
180 # absolute because the linker will look inside the sysroot if it's not.
181 rebase_path(android_libgcc_file),
182 ]
183 }
184
185 # Clang with libc++ does not require an explicit atomic library reference. 191 # Clang with libc++ does not require an explicit atomic library reference.
186 if (!is_clang) { 192 if (!is_clang) {
187 libs += [ "atomic" ] 193 libs += [ "atomic" ]
188 } 194 }
189 } 195 }
190 196
191 config("executable_config") { 197 config("executable_config") {
192 cflags = [ "-fPIE" ] 198 cflags = [ "-fPIE" ]
193 asmflags = [ "-fPIE" ] 199 asmflags = [ "-fPIE" ]
194 ldflags = [ "-pie" ] 200 ldflags = [ "-pie" ]
(...skipping 30 matching lines...) Expand all
225 231
226 # Avoid errors with current NDK: 232 # Avoid errors with current NDK:
227 # "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.6/prebui lt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include/arm_neon.h:3426 :3: error: argument must be a constant" 233 # "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.6/prebui lt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include/arm_neon.h:3426 :3: error: argument must be a constant"
228 "-finstrument-functions-exclude-file-list=arm_neon.h,SaturatedArithmeticARM. h", 234 "-finstrument-functions-exclude-file-list=arm_neon.h,SaturatedArithmeticARM. h",
229 ] 235 ]
230 defines = [ "CYGPROFILE_INSTRUMENTATION=1" ] 236 defines = [ "CYGPROFILE_INSTRUMENTATION=1" ]
231 } 237 }
232 238
233 config("no_cygprofile_instrumentation") { 239 config("no_cygprofile_instrumentation") {
234 } 240 }
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