mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
Start adding support for writing archives in BSD format.
No support for the symbol table yet (but will hopefully add it today). We always use the long filename format so that we can align the member, which is an advantage of the BSD format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -70,6 +70,16 @@ static cl::list<std::string>
|
||||
|
||||
static cl::opt<bool> MRI("M", cl::desc(""));
|
||||
|
||||
namespace {
|
||||
enum Format { Default, GNU, BSD };
|
||||
}
|
||||
|
||||
static cl::opt<Format>
|
||||
FormatOpt("format", cl::desc("Archive format to create"),
|
||||
cl::values(clEnumValN(Default, "defalut", "default"),
|
||||
clEnumValN(GNU, "gnu", "gnu"),
|
||||
clEnumValN(BSD, "bsd", "bsd"), clEnumValEnd));
|
||||
|
||||
std::string Options;
|
||||
|
||||
// Provide additional help output explaining the operations and modifiers of
|
||||
@@ -539,15 +549,27 @@ computeNewArchiveMembers(ArchiveOperation Operation,
|
||||
static void
|
||||
performWriteOperation(ArchiveOperation Operation, object::Archive *OldArchive,
|
||||
std::vector<NewArchiveIterator> *NewMembersP) {
|
||||
object::Archive::Kind Kind;
|
||||
switch (FormatOpt) {
|
||||
case Default:
|
||||
// FIXME: change as the support for other formats improve.
|
||||
Kind = object::Archive::K_GNU;
|
||||
case GNU:
|
||||
Kind = object::Archive::K_GNU;
|
||||
break;
|
||||
case BSD:
|
||||
Kind = object::Archive::K_BSD;
|
||||
break;
|
||||
}
|
||||
if (NewMembersP) {
|
||||
std::pair<StringRef, std::error_code> Result =
|
||||
writeArchive(ArchiveName, *NewMembersP, Symtab);
|
||||
writeArchive(ArchiveName, *NewMembersP, Symtab, Kind);
|
||||
failIfError(Result.second, Result.first);
|
||||
return;
|
||||
}
|
||||
std::vector<NewArchiveIterator> NewMembers =
|
||||
computeNewArchiveMembers(Operation, OldArchive);
|
||||
auto Result = writeArchive(ArchiveName, NewMembers, Symtab);
|
||||
auto Result = writeArchive(ArchiveName, NewMembers, Symtab, Kind);
|
||||
failIfError(Result.second, Result.first);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user