Don't treat bitcode files specially in llvm-ar.

We really want bitcode files to behave as regular object files in archives, so
we don't need to track that a member is bitcode.

llvm-svn: 185681
This commit is contained in:
Rafael Espindola 2013-07-05 04:19:32 +00:00
parent 6cc2dc713e
commit 46312e8e72
5 changed files with 2 additions and 34 deletions

View File

@ -125,13 +125,6 @@ bool ArchiveMember::replaceWith(StringRef newFile, std::string* ErrMsg) {
return true;
}
// Determine what kind of file it is.
if (sys::fs::identify_magic(StringRef(signature, 4)) ==
sys::fs::file_magic::bitcode)
flags |= BitcodeFlag;
else
flags &= ~BitcodeFlag;
return false;
}

View File

@ -52,7 +52,6 @@ class ArchiveMember : public ilist_node<ArchiveMember> {
enum Flags {
SVR4SymbolTableFlag = 1, ///< Member is a SVR4 symbol table
BSD4SymbolTableFlag = 2, ///< Member is a BSD4 symbol table
BitcodeFlag = 4, ///< Member is bitcode
HasLongFilenameFlag = 8, ///< Member uses the long filename syntax
StringTableFlag = 16 ///< Member is an ar(1) format string table
};
@ -121,10 +120,6 @@ class ArchiveMember : public ilist_node<ArchiveMember> {
/// @brief Determine if this member is the ar(1) string table.
bool isStringTable() const { return flags&StringTableFlag; }
/// @returns true iff the archive member is a bitcode file.
/// @brief Determine if this member is a bitcode file.
bool isBitcode() const { return flags&BitcodeFlag; }
/// Long filenames are an artifact of the ar(1) file format which allows
/// up to sixteen characters in its header and doesn't allow a path
/// separator character (/). To avoid this, a "long format" member name is

View File

@ -162,13 +162,6 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
break;
}
// Determine if this is a bitcode file
if (sys::fs::identify_magic(StringRef(At, 4)) ==
sys::fs::file_magic::bitcode)
flags |= ArchiveMember::BitcodeFlag;
else
flags &= ~ArchiveMember::BitcodeFlag;
// Instantiate the ArchiveMember to be filled
ArchiveMember* member = new ArchiveMember(this);

View File

@ -183,13 +183,6 @@ bool Archive::addFileBefore(StringRef filePath, iterator where,
sys::fs::file_magic type;
if (sys::fs::identify_magic(mbr->path, type))
type = sys::fs::file_magic::unknown;
switch (type) {
case sys::fs::file_magic::bitcode:
flags |= ArchiveMember::BitcodeFlag;
break;
default:
break;
}
mbr->flags = flags;
members.insert(where,mbr);
return false;

View File

@ -99,7 +99,6 @@ bool AddBefore = false; ///< 'b' modifier
bool Create = false; ///< 'c' modifier
bool TruncateNames = false; ///< 'f' modifier
bool InsertBefore = false; ///< 'i' modifier
bool DontSkipBitcode = false; ///< 'k' modifier
bool UseCount = false; ///< 'N' modifier
bool OriginalDates = false; ///< 'o' modifier
bool FullPath = false; ///< 'P' modifier
@ -219,7 +218,6 @@ ArchiveOperation parseCommandLine() {
case 'x': ++NumOperations; Operation = Extract; break;
case 'c': Create = true; break;
case 'f': TruncateNames = true; break;
case 'k': DontSkipBitcode = true; break;
case 'l': /* accepted but unused */ break;
case 'o': OriginalDates = true; break;
case 's': break; // Ignore for now.
@ -323,8 +321,7 @@ bool doPrint(std::string* ErrMsg) {
const char* data = reinterpret_cast<const char*>(I->getData());
// Skip things that don't make sense to print
if (I->isSVR4SymbolTable() ||
I->isBSD4SymbolTable() || (!DontSkipBitcode && I->isBitcode()))
if (I->isSVR4SymbolTable() || I->isBSD4SymbolTable())
continue;
if (Verbose)
@ -373,10 +370,7 @@ doDisplayTable(std::string* ErrMsg) {
if (Verbose) {
// FIXME: Output should be this format:
// Zrw-r--r-- 500/ 500 525 Nov 8 17:42 2004 Makefile
if (I->isBitcode())
outs() << "b";
else
outs() << " ";
outs() << " ";
unsigned mode = I->getMode();
printMode((mode >> 6) & 007);
printMode((mode >> 3) & 007);