summaryrefslogtreecommitdiffstats
path: root/llvm/utils/gn
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/gn')
-rw-r--r--llvm/utils/gn/build/toolchain/BUILD.gn2
-rw-r--r--llvm/utils/gn/secondary/BUILD.gn4
-rw-r--r--llvm/utils/gn/secondary/compiler-rt/BUILD.gn3
-rw-r--r--llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn6
-rw-r--r--llvm/utils/gn/secondary/compiler-rt/target.gni2
5 files changed, 15 insertions, 2 deletions
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index 33cde237380..70e259e116f 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -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, "*")
diff --git a/llvm/utils/gn/secondary/BUILD.gn b/llvm/utils/gn/secondary/BUILD.gn
index aa0c6b82c4c..4e5016445ec 100644
--- a/llvm/utils/gn/secondary/BUILD.gn
+++ b/llvm/utils/gn/secondary/BUILD.gn
@@ -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",
diff --git a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
index d2bfd1c07b3..1da710d5ac9 100644
--- a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
+++ b/llvm/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)",
]
diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
index 9af7d6b3845..c1fbf08834f 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -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",
diff --git a/llvm/utils/gn/secondary/compiler-rt/target.gni b/llvm/utils/gn/secondary/compiler-rt/target.gni
index 0d55e0da0f6..c739acc656f 100644
--- a/llvm/utils/gn/secondary/compiler-rt/target.gni
+++ b/llvm/utils/gn/secondary/compiler-rt/target.gni
@@ -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)
}
OpenPOWER on IntegriCloud