[llvm] r352907 - gn build: Create regular archives for the sanitizer runtimes.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 12:34:43 PST 2019


Author: pcc
Date: Fri Feb  1 12:34:43 2019
New Revision: 352907

URL: http://llvm.org/viewvc/llvm-project?rev=352907&view=rev
Log:
gn build: Create regular archives for the sanitizer runtimes.

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

Modified:
    llvm/trunk/utils/gn/build/BUILD.gn
    llvm/trunk/utils/gn/build/BUILDCONFIG.gn
    llvm/trunk/utils/gn/build/toolchain/BUILD.gn
    llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn

Modified: llvm/trunk/utils/gn/build/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/BUILD.gn?rev=352907&r1=352906&r2=352907&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/BUILD.gn (original)
+++ llvm/trunk/utils/gn/build/BUILD.gn Fri Feb  1 12:34:43 2019
@@ -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",

Modified: llvm/trunk/utils/gn/build/BUILDCONFIG.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/BUILDCONFIG.gn?rev=352907&r1=352906&r2=352907&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/BUILDCONFIG.gn (original)
+++ llvm/trunk/utils/gn/build/BUILDCONFIG.gn Fri Feb  1 12:34:43 2019
@@ -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",
 ]
 

Modified: llvm/trunk/utils/gn/build/toolchain/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/toolchain/BUILD.gn?rev=352907&r1=352906&r2=352907&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/toolchain/BUILD.gn (original)
+++ llvm/trunk/utils/gn/build/toolchain/BUILD.gn Fri Feb  1 12:34:43 2019
@@ -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 = [

Modified: llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn?rev=352907&r1=352906&r2=352907&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn Fri Feb  1 12:34:43 2019
@@ -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",




More information about the llvm-commits mailing list