Skip to content

Commit a18761a

Browse files
committedFeb 1, 2019
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 llvm-svn: 352907
1 parent 251e148 commit a18761a

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed
 

‎llvm/utils/gn/build/BUILD.gn

+8
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ config("no_rtti") {
136136
}
137137
}
138138

139+
# To make an archive that can be distributed, you need to remove this config and
140+
# set complete_static_lib.
141+
config("thin_archive") {
142+
if (current_os != "win" && current_os != "mac") {
143+
arflags = [ "-T" ]
144+
}
145+
}
146+
139147
config("llvm_code") {
140148
include_dirs = [
141149
"//llvm/include",

‎llvm/utils/gn/build/BUILDCONFIG.gn

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ shared_binary_target_configs = [
66
"//llvm/utils/gn/build:compiler_defaults",
77
"//llvm/utils/gn/build:llvm_code",
88
"//llvm/utils/gn/build:no_rtti",
9+
"//llvm/utils/gn/build:thin_archive",
910
"//llvm/utils/gn/build:warn_covered_switch_default",
1011
]
1112

‎llvm/utils/gn/build/toolchain/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ template("unix_toolchain") {
5050
# Remove the output file first so that ar doesn't try to modify the
5151
# existing file.
5252
command =
53-
"rm -f {{output}} && $ar rcsDT {{arflags}} {{output}} {{inputs}}"
53+
"rm -f {{output}} && $ar rcsD {{arflags}} {{output}} {{inputs}}"
5454
}
5555
description = "AR {{output}}"
5656
outputs = [

‎llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn

+8-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ static_library("hwasan") {
7474
output_dir = crt_current_out_dir
7575
output_name = "clang_rt.hwasan-$crt_current_target"
7676
complete_static_lib = true
77-
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
77+
configs -= [
78+
"//llvm/utils/gn/build:llvm_code",
79+
"//llvm/utils/gn/build:thin_archive",
80+
]
7881
configs += [ "//llvm/utils/gn/build:crt_code" ]
7982
deps = [
8083
":sources",
@@ -85,7 +88,10 @@ static_library("hwasan_cxx") {
8588
output_dir = crt_current_out_dir
8689
output_name = "clang_rt.hwasan_cxx-$crt_current_target"
8790
complete_static_lib = true
88-
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
91+
configs -= [
92+
"//llvm/utils/gn/build:llvm_code",
93+
"//llvm/utils/gn/build:thin_archive",
94+
]
8995
configs += [ "//llvm/utils/gn/build:crt_code" ]
9096
deps = [
9197
":cxx_sources",

0 commit comments

Comments
 (0)