]> granicus.if.org Git - llvm/commitdiff
gn build: Upgrade to NDK r19.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 5 Feb 2019 05:10:19 +0000 (05:10 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 5 Feb 2019 05:10:19 +0000 (05:10 +0000)
NDK r19 includes a sysroot that can be used directly by the compiler
without creating a standalone toolchain, so we just need a handful
of flags to point Clang there.

Differential Revision: https://reviews.llvm.org/D57733

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353139 91177308-0d34-0410-b5e6-96231b3b80d8

utils/gn/build/BUILD.gn
utils/gn/build/toolchain/compiler.gni
utils/gn/build/toolchain/target_flags.gni
utils/gn/secondary/compiler-rt/test/BUILD.gn
utils/gn/secondary/compiler-rt/test/test.gni

index e33cde237738fb448b1cae9a6fe03d1943c1010c..e323f99ac659da549fc0d9638c340f53f2687948 100644 (file)
@@ -10,7 +10,7 @@ config("compiler_defaults") {
     defines += [ "NDEBUG" ]
   }
 
-  cflags = target_flags + target_cflags
+  cflags = target_flags
   ldflags = target_flags + target_ldflags
 
   if (host_os == "mac" && clang_base_path != "") {
index 3c419fb29a14fc76f39bf31de15651974a11a3b6..37ad1f5bc31351d333852bdb58813b762d4d1d30 100644 (file)
@@ -10,7 +10,7 @@ declare_args() {
   # Example value: getenv("HOME") + "/src/llvm-build/Release+Asserts"
   clang_base_path = ""
 
-  # Set this to the path to Android NDK r18b. If set, cross compilation targeting
+  # Set this to the path to Android NDK r19. If set, cross compilation targeting
   # Android will be enabled.
   android_ndk_path = ""
 }
index 6b6373a00937a808a4bf3aa8115c2d4eb3af03a3..3ad02a969fd446fb4ebaa286b3e17b5049be9083 100644 (file)
@@ -2,33 +2,13 @@ import("//llvm/triples.gni")
 import("//llvm/utils/gn/build/toolchain/compiler.gni")
 
 target_flags = []
-target_cflags = []
 target_ldflags = []
 
 if (current_os == "android") {
-  assert(current_cpu == "arm64", "current_cpu not supported")
-
-  libcxx_path = "$android_ndk_path/sources/cxx-stl/llvm-libc++"
-  platform_lib_path =
-      "$android_ndk_path/platforms/android-21/arch-arm64/usr/lib"
-  libgcc_path = "$android_ndk_path/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x"
-
   target_flags += [
     "--target=$llvm_current_triple",
-    "--sysroot=$android_ndk_path/sysroot",
-  ]
-  target_cflags += [
-    "-isystem",
-    "$libcxx_path/include",
-  ]
-  target_ldflags += [
-    "-B$platform_lib_path",
-    "-L$platform_lib_path",
-    "-L$libgcc_path",
-  ]
-  target_ldflags += [
-    "-nostdlib++",
-    "-L$libcxx_path/libs/arm64-v8a",
-    "-l:libc++.a.21",
+    "--sysroot=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
+    "-B$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
   ]
+  target_ldflags += [ "-static-libstdc++" ]
 }
index 90a9201681a25dd3d562083f9532e8dcfdfaad1b..a5fa1a3f9fb05babb3c2e4b615a44d15e9aff90e 100644 (file)
@@ -47,6 +47,7 @@ write_cmake_config("lit_common_configured") {
     "SANITIZER_CAN_USE_CXXABI_PYBOOL=True",
     "COMPILER_RT_HAS_LLD_PYBOOL=True",
     "HAVE_RPC_XDR_H=0",
+    "ANDROID_NDK_VERSION=19",
     "ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
   ]
 
index 4144482bcbd2ffb09b52460df6f1b2ffe3cb341e..e2335933659fd060621480b366bf20af22a8058d 100644 (file)
@@ -7,8 +7,7 @@ declare_args() {
 
 target_flags_string = ""
 
-foreach(flag,
-        target_flags + target_cflags + target_ldflags + [ "-fuse-ld=lld" ]) {
+foreach(flag, target_flags + target_ldflags + [ "-fuse-ld=lld" ]) {
   if (target_flags_string != "") {
     target_flags_string += " "
   }