| 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 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), | 135 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), |
| 136 "-isystem" + rebase_path( | 136 "-isystem" + rebase_path( |
| 137 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include"
, | 137 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include"
, |
| 138 root_build_dir), | 138 root_build_dir), |
| 139 "-isystem" + | 139 "-isystem" + |
| 140 rebase_path("$android_ndk_root/sources/android/support/include", | 140 rebase_path("$android_ndk_root/sources/android/support/include", |
| 141 root_build_dir), | 141 root_build_dir), |
| 142 ] | 142 ] |
| 143 | 143 |
| 144 defines = [ "__GNU_SOURCE=1" ] # Necessary for clone(). | 144 defines = [ "__GNU_SOURCE=1" ] # Necessary for clone(). |
| 145 ldflags = [ "-nostdlib" ] | |
| 146 lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ] | |
| 147 | |
| 148 # The libc++ runtime library (must come first). | |
| 149 # ASan needs to dynamically link to libc++ even in static builds so | |
| 150 # that it can interpose operator new. | |
| 151 if (is_component_build || is_asan) { | |
| 152 libs = [ "c++_shared" ] | |
| 153 } else { | |
| 154 libs = [ "c++_static" ] | |
| 155 } | |
| 156 | |
| 157 # libgcc must come before libdl for ld.bfd (MIPS) | |
| 158 if (current_cpu == "mipsel") { | |
| 159 libs += [ | |
| 160 # ld linker is used for mips Android, and ld does not accept library | |
| 161 # absolute path prefixed by "-l"; Since libgcc does not exist in mips | |
| 162 # sysroot the proper library will be linked. | |
| 163 # TODO(gordanac): Remove once gold linker is used for mips Android. | |
| 164 "gcc", | |
| 165 ] | |
| 166 } else { | |
| 167 libs += [ | |
| 168 # Manually link the libgcc.a that the cross compiler uses. This is | |
| 169 # absolute because the linker will look inside the sysroot if it's not. | |
| 170 rebase_path(android_libgcc_file), | |
| 171 ] | |
| 172 } | |
| 173 | |
| 174 libs += [ | |
| 175 "c", | |
| 176 "dl", | |
| 177 "m", | |
| 178 ] | |
| 179 | 145 |
| 180 if (is_clang) { | 146 if (is_clang) { |
| 181 # Work around incompatibilities between bionic and clang headers. | 147 # Work around incompatibilities between bionic and clang headers. |
| 182 defines += [ | 148 defines += [ |
| 183 "__compiler_offsetof=__builtin_offsetof", | 149 "__compiler_offsetof=__builtin_offsetof", |
| 184 "nan=__builtin_nan", | 150 "nan=__builtin_nan", |
| 185 ] | 151 ] |
| 186 } | 152 } |
| 187 | 153 |
| 188 # TODO(jdduke) Re-enable on mips after resolving linking | 154 # TODO(jdduke) Re-enable on mips after resolving linking |
| 189 # issues with libc++ (crbug.com/456380). | 155 # issues with libc++ (crbug.com/456380). |
| 190 if (current_cpu != "mipsel" && current_cpu != "mips64el") { | 156 if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
| 191 ldflags += [ "-Wl,--warn-shared-textrel" ] | 157 ldflags = [ "-Wl,--warn-shared-textrel" ] |
| 192 } | |
| 193 | |
| 194 # Clang with libc++ does not require an explicit atomic library reference. | |
| 195 if (!is_clang) { | |
| 196 libs += [ "atomic" ] | |
| 197 } | 158 } |
| 198 } | 159 } |
| 199 | 160 |
| 200 config("executable_config") { | 161 config("executable_config") { |
| 201 cflags = [ "-fPIE" ] | 162 cflags = [ "-fPIE" ] |
| 202 asmflags = [ "-fPIE" ] | 163 asmflags = [ "-fPIE" ] |
| 203 ldflags = [ "-pie" ] | 164 ldflags = [ "-pie" ] |
| 204 } | 165 } |
| 205 | 166 |
| 206 config("hide_native_jni_exports") { | 167 config("hide_native_jni_exports") { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 236 | 197 |
| 237 # Avoid errors with current NDK: | 198 # Avoid errors with current NDK: |
| 238 # "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" | 199 # "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" |
| 239 "-finstrument-functions-exclude-file-list=arm_neon.h", | 200 "-finstrument-functions-exclude-file-list=arm_neon.h", |
| 240 ] | 201 ] |
| 241 } | 202 } |
| 242 } | 203 } |
| 243 | 204 |
| 244 config("no_cygprofile_instrumentation") { | 205 config("no_cygprofile_instrumentation") { |
| 245 } | 206 } |
| OLD | NEW |