From: Rafael Espindola Date: Fri, 17 Jul 2015 16:01:11 +0000 (+0000) Subject: Add support for producing thin archives in llvm-lib. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f82375c972c643a93a674a8fcb5fb896860a1e06;p=oota-llvm.git Add support for producing thin archives in llvm-lib. I will send an entry in docs/CommandGuide for review today. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242533 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/LibDriver/LibDriver.cpp b/lib/LibDriver/LibDriver.cpp index 17680e3b3bb..b0e704d6bad 100644 --- a/lib/LibDriver/LibDriver.cpp +++ b/lib/LibDriver/LibDriver.cpp @@ -141,7 +141,7 @@ int llvm::libDriverMain(llvm::ArrayRef ArgsArr) { std::pair Result = llvm::writeArchive(getOutputPath(&Args, Members[0]), Members, /*WriteSymtab=*/true, object::Archive::K_GNU, - /*Deterministic*/ true, /*Thin*/ false); + /*Deterministic*/ true, Args.hasArg(OPT_llvmlibthin)); if (Result.second) { if (Result.first.empty()) diff --git a/lib/LibDriver/Options.td b/lib/LibDriver/Options.td index 0aa1affbebc..5a56ef7468d 100644 --- a/lib/LibDriver/Options.td +++ b/lib/LibDriver/Options.td @@ -12,6 +12,8 @@ class P : def libpath: P<"libpath", "Object file search path">; def out : P<"out", "Path to file to write output">; +def llvmlibthin : F<"llvmlibthin">; + //============================================================================== // The flags below do nothing. They are defined only for lib.exe compatibility. //============================================================================== diff --git a/test/LibDriver/thin.test b/test/LibDriver/thin.test new file mode 100644 index 00000000000..4ab9d61952b --- /dev/null +++ b/test/LibDriver/thin.test @@ -0,0 +1,9 @@ +RUN: echo foo > %t + +RUN: llvm-lib -out:%t.a %t +RUN: FileCheck --check-prefix=FAT %s < %t.a +FAT: ! + +RUN: llvm-lib -out:%t.thin.a -llvmlibthin %t +RUN: FileCheck --check-prefix=THIN %s < %t.thin.a +THIN: !