aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Archive
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Archive')
-rw-r--r--lib/Archive/Archive.cpp6
-rw-r--r--lib/Archive/ArchiveInternals.h1
-rw-r--r--lib/Archive/ArchiveReader.cpp88
-rw-r--r--lib/Archive/ArchiveWriter.cpp60
4 files changed, 7 insertions, 148 deletions
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index b909b39527..e6d4bae29d 100644
--- a/lib/Archive/Archive.cpp
+++ b/lib/Archive/Archive.cpp
@@ -90,12 +90,6 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) {
else
flags &= ~BSD4SymbolTableFlag;
- // LLVM symbol tables have a very specific name
- if (path.str() == ARFILE_LLVM_SYMTAB_NAME)
- flags |= LLVMSymbolTableFlag;
- else
- flags &= ~LLVMSymbolTableFlag;
-
// String table name
if (path.str() == ARFILE_STRTAB_NAME)
flags |= StringTableFlag;
diff --git a/lib/Archive/ArchiveInternals.h b/lib/Archive/ArchiveInternals.h
index f6c87e899f..bc5046de39 100644
--- a/lib/Archive/ArchiveInternals.h
+++ b/lib/Archive/ArchiveInternals.h
@@ -22,7 +22,6 @@
#define ARFILE_MAGIC "!<arch>\n" ///< magic string
#define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string
#define ARFILE_SVR4_SYMTAB_NAME "/ " ///< SVR4 symtab entry name
-#define ARFILE_LLVM_SYMTAB_NAME "#_LLVM_SYM_TAB_#" ///< LLVM symtab entry name
#define ARFILE_BSD4_SYMTAB_NAME "__.SYMDEF SORTED" ///< BSD4 symtab entry name
#define ARFILE_STRTAB_NAME "// " ///< Name of string table
#define ARFILE_PAD "\n" ///< inter-file align padding
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 6946ddb768..fc3a01f189 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -37,37 +37,6 @@ static inline unsigned readInteger(const char*&At, const char*End) {
return Result;
}
-// Completely parse the Archive's symbol table and populate symTab member var.
-bool
-Archive::parseSymbolTable(const void* data, unsigned size, std::string* error) {
- const char* At = (const char*) data;
- const char* End = At + size;
- while (At < End) {
- unsigned offset = readInteger(At, End);
- if (At == End) {
- if (error)
- *error = "Ran out of data reading vbr_uint for symtab offset!";
- return false;
- }
- unsigned length = readInteger(At, End);
- if (At == End) {
- if (error)
- *error = "Ran out of data reading vbr_uint for symtab length!";
- return false;
- }
- if (At + length > End) {
- if (error)
- *error = "Malformed symbol table: length not consistent with size";
- return false;
- }
- // we don't care if it can't be inserted (duplicate entry)
- symTab.insert(std::make_pair(std::string(At, length), offset));
- At += length;
- }
- symTabSize = size;
- return true;
-}
-
// This member parses an ArchiveMemberHeader that is presumed to be pointed to
// by At. The At pointer is updated to the byte just after the header, which
// can be variable in size.
@@ -108,10 +77,8 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
// for long file names. This library doesn't generate either of those but
// it will accept them. If the name starts with #1/ and the remainder is
// digits, then those digits specify the length of the name that is
- // stored immediately following the header. The special name
- // __LLVM_SYM_TAB__ identifies the symbol table for LLVM bitcode.
- // Anything else is a regular, short filename that is terminated with
- // a '/' and blanks.
+ // stored immediately following the header. Anything else is a regular, short
+ // filename that is terminated with a '/' and blanks.
std::string pathname;
switch (Hdr->name[0]) {
@@ -129,16 +96,6 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
*error = "invalid long filename";
return 0;
}
- } else if (Hdr->name[1] == '_' &&
- (0 == memcmp(Hdr->name, ARFILE_LLVM_SYMTAB_NAME, 16))) {
- // The member is using a long file name (>15 chars) format.
- // This format is standard for 4.4BSD and Mac OSX operating
- // systems. LLVM uses it similarly. In this format, the
- // remainder of the name field (after #1/) specifies the
- // length of the file name which occupy the first bytes of
- // the member's data. The pathname already has the #1/ stripped.
- pathname.assign(ARFILE_LLVM_SYMTAB_NAME);
- flags |= ArchiveMember::LLVMSymbolTableFlag;
}
break;
case '/':
@@ -259,7 +216,6 @@ Archive::loadArchive(std::string* error) {
At += 8; // Skip the magic string.
- bool seenSymbolTable = false;
bool foundFirstFile = false;
while (At < End) {
// parse the member header
@@ -291,21 +247,6 @@ Archive::loadArchive(std::string* error) {
if ((intptr_t(At) & 1) == 1)
At++;
delete mbr;
- } else if (mbr->isLLVMSymbolTable()) {
- // This is the LLVM symbol table for the archive. If we've seen it
- // already, its an error. Otherwise, parse the symbol table and move on.
- if (seenSymbolTable) {
- if (error)
- *error = "invalid archive: multiple symbol tables";
- return false;
- }
- if (!parseSymbolTable(mbr->getData(), mbr->getSize(), error))
- return false;
- seenSymbolTable = true;
- At += mbr->getSize();
- if ((intptr_t(At) & 1) == 1)
- At++;
- delete mbr; // We don't need this member in the list of members.
} else {
// This is just a regular file. If its the first one, save its offset.
// Otherwise just push it on the list and move on to the next file.
@@ -412,26 +353,11 @@ Archive::loadSymbolTable(std::string* ErrorMsg) {
}
}
- // See if its the symbol table
- if (mbr->isLLVMSymbolTable()) {
- if (!parseSymbolTable(mbr->getData(), mbr->getSize(), ErrorMsg)) {
- delete mbr;
- return false;
- }
-
- At += mbr->getSize();
- if ((intptr_t(At) & 1) == 1)
- At++;
- delete mbr;
- // Can't be any more symtab headers so just advance
- FirstFile = At;
- } else {
- // There's no symbol table in the file. We have to rebuild it from scratch
- // because the intent of this method is to get the symbol table loaded so
- // it can be searched efficiently.
- // Add the member to the members list
- members.push_back(mbr);
- }
+ // There's no symbol table in the file. We have to rebuild it from scratch
+ // because the intent of this method is to get the symbol table loaded so
+ // it can be searched efficiently.
+ // Add the member to the members list
+ members.push_back(mbr);
firstFileOffset = FirstFile - base;
return true;
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 695ee76109..97b34e616e 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -113,8 +113,6 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr,
memcpy(hdr.name,ARFILE_SVR4_SYMTAB_NAME,16);
} else if (mbr.isBSD4SymbolTable()) {
memcpy(hdr.name,ARFILE_BSD4_SYMTAB_NAME,16);
- } else if (mbr.isLLVMSymbolTable()) {
- memcpy(hdr.name,ARFILE_LLVM_SYMTAB_NAME,16);
} else if (TruncateNames) {
const char* nm = mbrPath.c_str();
unsigned len = mbrPath.length();
@@ -289,61 +287,6 @@ Archive::writeMember(
return false;
}
-// Write out the LLVM symbol table as an archive member to the file.
-void
-Archive::writeSymbolTable(std::ofstream& ARFile) {
-
- // Construct the symbol table's header
- ArchiveMemberHeader Hdr;
- Hdr.init();
- memcpy(Hdr.name,ARFILE_LLVM_SYMTAB_NAME,16);
- uint64_t secondsSinceEpoch = sys::TimeValue::now().toEpochTime();
- char buffer[32];
- sprintf(buffer, "%-8o", 0644);
- memcpy(Hdr.mode,buffer,8);
- sprintf(buffer, "%-6u", sys::Process::GetCurrentUserId());
- memcpy(Hdr.uid,buffer,6);
- sprintf(buffer, "%-6u", sys::Process::GetCurrentGroupId());
- memcpy(Hdr.gid,buffer,6);
- sprintf(buffer,"%-12u", unsigned(secondsSinceEpoch));
- memcpy(Hdr.date,buffer,12);
- sprintf(buffer,"%-10u",symTabSize);
- memcpy(Hdr.size,buffer,10);
-
- // Write the header
- ARFile.write((char*)&Hdr, sizeof(Hdr));
-
-#ifndef NDEBUG
- // Save the starting position of the symbol tables data content.
- unsigned startpos = ARFile.tellp();
-#endif
-
- // Write out the symbols sequentially
- for ( Archive::SymTabType::iterator I = symTab.begin(), E = symTab.end();
- I != E; ++I)
- {
- // Write out the file index
- writeInteger(I->second, ARFile);
- // Write out the length of the symbol
- writeInteger(I->first.length(), ARFile);
- // Write out the symbol
- ARFile.write(I->first.data(), I->first.length());
- }
-
-#ifndef NDEBUG
- // Now that we're done with the symbol table, get the ending file position
- unsigned endpos = ARFile.tellp();
-#endif
-
- // Make sure that the amount we wrote is what we pre-computed. This is
- // critical for file integrity purposes.
- assert(endpos - startpos == symTabSize && "Invalid symTabSize computation");
-
- // Make sure the symbol table is even sized
- if (symTabSize % 2 != 0 )
- ARFile << ARFILE_PAD;
-}
-
// Write the entire archive to the file specified when the archive was created.
// This writes to a temporary file first. Options are for creating a symbol
// table, flattening the file names (no directories, 15 chars max) and
@@ -453,9 +396,6 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames,
}
}
- // Put out the LLVM symbol table now.
- writeSymbolTable(FinalFile);
-
// Copy the temporary file contents being sure to skip the file's magic
// number.
FinalFile.write(base + sizeof(ARFILE_MAGIC)-1,