Skip to content

Commit 2bec850

Browse files
committed
Add support for producing thin archives in llvm-lib.
I will send an entry in docs/CommandGuide for review today. llvm-svn: 242533
1 parent 6512cad commit 2bec850

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

llvm/lib/LibDriver/LibDriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int llvm::libDriverMain(llvm::ArrayRef<const char*> ArgsArr) {
141141
std::pair<StringRef, std::error_code> Result =
142142
llvm::writeArchive(getOutputPath(&Args, Members[0]), Members,
143143
/*WriteSymtab=*/true, object::Archive::K_GNU,
144-
/*Deterministic*/ true, /*Thin*/ false);
144+
/*Deterministic*/ true, Args.hasArg(OPT_llvmlibthin));
145145

146146
if (Result.second) {
147147
if (Result.first.empty())

llvm/lib/LibDriver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class P<string name, string help> :
1212
def libpath: P<"libpath", "Object file search path">;
1313
def out : P<"out", "Path to file to write output">;
1414

15+
def llvmlibthin : F<"llvmlibthin">;
16+
1517
//==============================================================================
1618
// The flags below do nothing. They are defined only for lib.exe compatibility.
1719
//==============================================================================

llvm/test/LibDriver/thin.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
RUN: echo foo > %t
2+
3+
RUN: llvm-lib -out:%t.a %t
4+
RUN: FileCheck --check-prefix=FAT %s < %t.a
5+
FAT: !<arch>
6+
7+
RUN: llvm-lib -out:%t.thin.a -llvmlibthin %t
8+
RUN: FileCheck --check-prefix=THIN %s < %t.thin.a
9+
THIN: !<thin>

0 commit comments

Comments
 (0)