[PATCH] D56577: gn build: Add a stage2 toolchain for Android.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 11 06:40:58 PST 2019


thakis accepted this revision.
thakis added a comment.
This revision is now accepted and ready to land.

Super cool!



================
Comment at: llvm/utils/gn/build/libs/pthread/BUILD.gn:9
 group("pthread") {
-  if (llvm_enable_threads && host_os != "win") {
+  if (llvm_enable_threads && current_os != "win" && current_os != "android") {
     public_configs = [ ":pthread_config" ]
----------------
Maybe add a `# On Android, bionic has built-in support for pthreads.` like comment (I had to look that up just now).


================
Comment at: llvm/utils/gn/build/toolchain/BUILD.gn:49
+        command =
+            "rm -f {{output}} && $ar rcsDT {{arflags}} {{output}} {{inputs}}"
       }
----------------
(this might be a git merge issue -- be sure to run `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format` though :-)


================
Comment at: llvm/utils/gn/build/toolchain/BUILD.gn:158
+      "//:llvm-ar($host_toolchain)",
+    ]
+
----------------
Whoa, do deps on toolchains work now? Is that new?


================
Comment at: llvm/utils/gn/build/toolchain/BUILD.gn:169
+
+    target_flags =
+        "--target=aarch64-linux-android21 --sysroot=$android_ndk_path/sysroot"
----------------
That's alright for now, but I think eventually we want to remove the target_foo stuff from the toolchain definition again and instead use configs for this (like https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn?type=cs&q=build/config/compiler&sq=package:chromium&g=0&l=217)


================
Comment at: llvm/utils/gn/build/toolchain/BUILD.gn:172
+    target_cflags = "$target_flags -isystem $libcxx_path/include"
+    target_ldflags = "$target_flags -fuse-ld=lld -B$platform_lib_path -L$platform_lib_path -L$libgcc_path"
+    target_ldflags +=
----------------
The `-fuse-ld=lld` will probably need revisiting -- probably want to also add that on Linux when e.g. clang_base_path is set, and maybe if some use_lld arg is explicitly set to on. But ok for now.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56577/new/

https://reviews.llvm.org/D56577





More information about the llvm-commits mailing list