[PATCH] D65513: gn build: Make builtin library build on macOS

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 10:14:31 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL367449: gn build: Make builtin library build on macOS (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65513?vs=212571&id=212618#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65513

Files:
  llvm/trunk/utils/gn/build/toolchain/BUILD.gn
  llvm/trunk/utils/gn/secondary/BUILD.gn
  llvm/trunk/utils/gn/secondary/compiler-rt/BUILD.gn
  llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
  llvm/trunk/utils/gn/secondary/compiler-rt/target.gni


Index: llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -11,7 +11,11 @@
 
 static_library("builtins") {
   output_dir = crt_current_out_dir
-  output_name = "clang_rt.builtins$crt_current_target_suffix"
+  if (current_os == "mac") {
+    output_name = "clang_rt.osx"
+  } else {
+    output_name = "clang_rt.builtins$crt_current_target_suffix"
+  }
   complete_static_lib = true
   cflags = [
     "-fPIC",
Index: llvm/trunk/utils/gn/secondary/compiler-rt/target.gni
===================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/target.gni
+++ llvm/trunk/utils/gn/secondary/compiler-rt/target.gni
@@ -24,6 +24,8 @@
   if (current_os == "android") {
     crt_current_target_suffix += "-android"
   }
+} else if (current_os == "mac") {
+  crt_current_out_dir = "$clang_resource_dir/lib/darwin"
 } else {
   assert(false, "unimplemented current_os " + current_os)
 }
Index: llvm/trunk/utils/gn/secondary/compiler-rt/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/compiler-rt/BUILD.gn
@@ -1,4 +1,7 @@
 group("compiler-rt") {
+  # In the GN build, compiler-rt is always built by just-built clang and lld.
+  # FIXME: For macOS and iOS builds, depend on lib in all needed target arch
+  # toolchains and then lipo them together for the final output.
   deps = [
     "//compiler-rt/lib(//llvm/utils/gn/build/toolchain:stage2_unix)",
   ]
Index: llvm/trunk/utils/gn/secondary/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/BUILD.gn
@@ -10,9 +10,11 @@
     "//lld/test",
     "//llvm/test",
   ]
+  if (current_os == "linux" || current_os == "mac") {
+    deps += [ "//compiler-rt" ]
+  }
   if (current_os == "linux") {
     deps += [
-      "//compiler-rt",
       "//libcxx",
       "//libcxxabi",
       "//libunwind",
Index: llvm/trunk/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/build/toolchain/BUILD.gn
+++ llvm/trunk/utils/gn/build/toolchain/BUILD.gn
@@ -166,6 +166,8 @@
   }
 }
 
+# This template defines a toolchain that uses just-built clang and lld
+# as compiler and linker.
 template("stage2_unix_toolchain") {
   unix_toolchain(target_name) {
     forward_variables_from(invoker, "*")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65513.212618.patch
Type: text/x-patch
Size: 2674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190731/ac7b55ad/attachment.bin>


More information about the llvm-commits mailing list