]> granicus.if.org Git - llvm/commitdiff
gn build: Make builtin library build on macOS
authorNico Weber <nicolasweber@gmx.de>
Wed, 31 Jul 2019 17:12:33 +0000 (17:12 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 31 Jul 2019 17:12:33 +0000 (17:12 +0000)
For now, it only builds the x86_64 slice.

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

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

utils/gn/build/toolchain/BUILD.gn
utils/gn/secondary/BUILD.gn
utils/gn/secondary/compiler-rt/BUILD.gn
utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
utils/gn/secondary/compiler-rt/target.gni

index 33cde2373809a9cae92e5fb9b0500521828e2126..70e259e116f4b5657b1b1d58595a72846ffaa0d7 100644 (file)
@@ -166,6 +166,8 @@ unix_toolchain("unix") {
   }
 }
 
+# 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, "*")
index aa0c6b82c4c1ece712d08422e2746f1367e41bea..4e5016445ecb8da0b95a85f5f6c935758a1d3458 100644 (file)
@@ -10,9 +10,11 @@ group("default") {
     "//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 d2bfd1c07b3dc4091acd611004e81212e13ebb66..1da710d5ac9ba52e897abed5742d3eee96a50bf7 100644 (file)
@@ -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 9af7d6b3845eac1727f01e042313b1101ad55883..c1fbf08834fd31de661f41be666a96d35ef4fb52 100644 (file)
@@ -11,7 +11,11 @@ declare_args() {
 
 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 0d55e0da0f68fae397b91414fa18d9d16b4fea93..c739acc656f8410174b59e152ff0e75628a80208 100644 (file)
@@ -24,6 +24,8 @@ if (clang_enable_per_target_runtime_dir) {
   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)
 }