[llvm] r353139 - gn build: Upgrade to NDK r19.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 21:10:19 PST 2019


Author: pcc
Date: Mon Feb  4 21:10:19 2019
New Revision: 353139

URL: http://llvm.org/viewvc/llvm-project?rev=353139&view=rev
Log:
gn build: Upgrade to NDK r19.

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

Modified:
    llvm/trunk/utils/gn/build/BUILD.gn
    llvm/trunk/utils/gn/build/toolchain/compiler.gni
    llvm/trunk/utils/gn/build/toolchain/target_flags.gni
    llvm/trunk/utils/gn/secondary/compiler-rt/test/BUILD.gn
    llvm/trunk/utils/gn/secondary/compiler-rt/test/test.gni

Modified: llvm/trunk/utils/gn/build/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/BUILD.gn?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/BUILD.gn (original)
+++ llvm/trunk/utils/gn/build/BUILD.gn Mon Feb  4 21:10:19 2019
@@ -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 != "") {

Modified: llvm/trunk/utils/gn/build/toolchain/compiler.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/toolchain/compiler.gni?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/toolchain/compiler.gni (original)
+++ llvm/trunk/utils/gn/build/toolchain/compiler.gni Mon Feb  4 21:10:19 2019
@@ -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 = ""
 }

Modified: llvm/trunk/utils/gn/build/toolchain/target_flags.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/toolchain/target_flags.gni?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/toolchain/target_flags.gni (original)
+++ llvm/trunk/utils/gn/build/toolchain/target_flags.gni Mon Feb  4 21:10:19 2019
@@ -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++" ]
 }

Modified: llvm/trunk/utils/gn/secondary/compiler-rt/test/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/test/BUILD.gn?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/test/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/test/BUILD.gn Mon Feb  4 21:10:19 2019
@@ -47,6 +47,7 @@ write_cmake_config("lit_common_configure
     "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",
   ]
 

Modified: llvm/trunk/utils/gn/secondary/compiler-rt/test/test.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/test/test.gni?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/test/test.gni (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/test/test.gni Mon Feb  4 21:10:19 2019
@@ -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 += " "
   }




More information about the llvm-commits mailing list