]> granicus.if.org Git - llvm/commitdiff
gn build: Create regular archives for the sanitizer runtimes.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 1 Feb 2019 20:34:43 +0000 (20:34 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 1 Feb 2019 20:34:43 +0000 (20:34 +0000)
We'll need to do this eventually if we create an installable package.
For now, this lets me use the archives to build Android, whose build
system wants to copy the archives to another location.

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

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

utils/gn/build/BUILD.gn
utils/gn/build/BUILDCONFIG.gn
utils/gn/build/toolchain/BUILD.gn
utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn

index 4c5c3bbbb3964576fee8000f413256649014cfe1..cd22d21bcb485efd6ceba5ad124df21d90b70e5b 100644 (file)
@@ -136,6 +136,14 @@ config("no_rtti") {
   }
 }
 
+# To make an archive that can be distributed, you need to remove this config and
+# set complete_static_lib.
+config("thin_archive") {
+  if (current_os != "win" && current_os != "mac") {
+    arflags = [ "-T" ]
+  }
+}
+
 config("llvm_code") {
   include_dirs = [
     "//llvm/include",
index cec736fd8faee777932a2513ca7292a27abf46c1..7de638ff3df3862a4094af44cdc5aa0aec224802 100644 (file)
@@ -6,6 +6,7 @@ shared_binary_target_configs = [
   "//llvm/utils/gn/build:compiler_defaults",
   "//llvm/utils/gn/build:llvm_code",
   "//llvm/utils/gn/build:no_rtti",
+  "//llvm/utils/gn/build:thin_archive",
   "//llvm/utils/gn/build:warn_covered_switch_default",
 ]
 
index 4be5e4b8f31bca5531f56ede27a536d360f8c2a4..5ba76d4ea55669c986b7aad8894932f089a1473d 100644 (file)
@@ -50,7 +50,7 @@ template("unix_toolchain") {
         # Remove the output file first so that ar doesn't try to modify the
         # existing file.
         command =
-            "rm -f {{output}} && $ar rcsDT {{arflags}} {{output}} {{inputs}}"
+            "rm -f {{output}} && $ar rcsD {{arflags}} {{output}} {{inputs}}"
       }
       description = "AR {{output}}"
       outputs = [
index 5979a6924ec2c6055ff607f86d253ec0a614aa04..fe5870ad7824e789234e5ec11244a9b71b393f6a 100644 (file)
@@ -74,7 +74,10 @@ static_library("hwasan") {
   output_dir = crt_current_out_dir
   output_name = "clang_rt.hwasan-$crt_current_target"
   complete_static_lib = true
-  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
+  configs -= [
+    "//llvm/utils/gn/build:llvm_code",
+    "//llvm/utils/gn/build:thin_archive",
+  ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
   deps = [
     ":sources",
@@ -85,7 +88,10 @@ static_library("hwasan_cxx") {
   output_dir = crt_current_out_dir
   output_name = "clang_rt.hwasan_cxx-$crt_current_target"
   complete_static_lib = true
-  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
+  configs -= [
+    "//llvm/utils/gn/build:llvm_code",
+    "//llvm/utils/gn/build:thin_archive",
+  ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
   deps = [
     ":cxx_sources",