gn build: Unbreak Android cross-compilation.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 19 Mar 2021 23:23:30 +0000 (16:23 -0700)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 19 Mar 2021 23:28:24 +0000 (16:28 -0700)
- D96404 defaulted to libunwind which isn't provided by NDK r21
  (or r22), so specify -rtlib=libgcc on non-arm32.
- D97993 means that we need to use --gcc-toolchain instead of -B
  to let the driver find libgcc.

llvm/utils/gn/build/toolchain/target_flags.gni

index 0af52a0..573e758 100644 (file)
@@ -13,8 +13,11 @@ if (current_os == "android") {
   target_flags += [
     "--target=$llvm_current_triple",
     "--sysroot=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
-    "-B$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
+    "--gcc-toolchain=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
   ]
+  if (current_cpu != "arm") {
+    target_flags += [ "-rtlib=libgcc" ]
+  }
   target_ldflags += [ "-static-libstdc++" ]
   if (current_cpu == "arm") {
     target_flags += [ "-march=armv7-a" ]