diff options
-rw-r--r-- | docs/CommandGuide/llvm-ar.rst | 44 | ||||
-rw-r--r-- | include/llvm/Bitcode/Archive.h | 22 | ||||
-rw-r--r-- | lib/Archive/ArchiveReader.cpp | 7 | ||||
-rw-r--r-- | lib/Archive/ArchiveWriter.cpp | 7 | ||||
-rw-r--r-- | tools/llvm-ar/llvm-ar.cpp | 19 | ||||
-rw-r--r-- | tools/llvm-ranlib/llvm-ranlib.cpp | 2 |
6 files changed, 28 insertions, 73 deletions
diff --git a/docs/CommandGuide/llvm-ar.rst b/docs/CommandGuide/llvm-ar.rst index eddffeba7d..8ff4192a50 100644 --- a/docs/CommandGuide/llvm-ar.rst +++ b/docs/CommandGuide/llvm-ar.rst @@ -6,7 +6,7 @@ SYNOPSIS -------- -**llvm-ar** [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...] +**llvm-ar** [-]{dmpqrtx}[Rabfikou] [relpos] [count] <archive> [files...] DESCRIPTION @@ -63,16 +63,6 @@ Here's where **llvm-ar** departs from previous ``ar`` implementations: -*Compression* - - **llvm-ar** can compress the members of an archive to save space. The - compression used depends on what's available on the platform and what choices - the LLVM Compressor utility makes. It generally favors bzip2 but will select - between "no compression" or bzip2 depending on what makes sense for the - file's content. - - - *Directory Recursion* Most ``ar`` implementations do not recurse through directories but simply @@ -86,9 +76,8 @@ Here's where **llvm-ar** departs from previous ``ar`` implementations: When **llvm-ar** prints out the verbose table of contents (``tv`` option), it precedes the usual output with a character indicating the basic kind of - content in the file. A blank means the file is a regular file. A 'Z' means - the file is compressed. A 'B' means the file is an LLVM bitcode file. An - 'S' means the file is the symbol table. + content in the file. A blank means the file is a regular file. A 'B' means + the file is an LLVM bitcode file. An 'S' means the file is the symbol table. @@ -98,7 +87,7 @@ OPTIONS The options to **llvm-ar** are compatible with other ``ar`` implementations. -However, there are a few modifiers (*zR*) that are not found in other ``ar`` +However, there are a few modifiers (*R*) that are not found in other ``ar`` implementations. The options to **llvm-ar** specify a single basic operation to perform on the archive, a variety of modifiers for that operation, the name of the archive file, and an optional list of file names. These options are used to @@ -145,9 +134,9 @@ p[k] -q[Rfz] +q[Rf] - Quickly append files to the end of the archive. The *R*, *f*, and *z* + Quickly append files to the end of the archive. The *R*, and *f* modifiers apply to this operation. This operation quickly adds the *files* to the archive without checking for duplicates that should be removed first. If no *files* are specified, the archive is not modified. @@ -156,9 +145,9 @@ q[Rfz] -r[Rabfuz] +r[Rabfu] - Replace or insert file members. The *R*, *a*, *b*, *f*, *u*, and *z* + Replace or insert file members. The *R*, *a*, *b*, *f*, and *u* modifiers apply to this operation. This operation will replace existing *files* or insert them at the end of the archive if they do not exist. If no *files* are specified, the archive is not modified. @@ -169,7 +158,7 @@ t[v] Print the table of contents. Without any modifiers, this operation just prints the names of the members to the standard output. With the *v* modifier, - **llvm-ar** also prints out the file type (B=bitcode, Z=compressed, S=symbol + **llvm-ar** also prints out the file type (B=bitcode, S=symbol table, blank=regular file), the permission mode, the owner and group, the size, and the date. If any *files* are specified, the listing is only for those files. If no *files* are specified, the table of contents for the @@ -273,15 +262,6 @@ section (above) to determine which modifiers are applicable to which operations. -[z] - - When inserting or replacing any file in the archive, compress the file first. - This - modifier is safe to use when (previously) compressed bitcode files are added to - the archive; the compressed bitcode files will not be doubly compressed. - - - Modifiers (generic) ~~~~~~~~~~~~~~~~~~~ @@ -410,11 +390,7 @@ mode - char[8] size - char[10] This field provides the size of the file, in bytes, encoded as a decimal ASCII - string. If the size field is negative (starts with a minus sign, 0x02D), then - the archive member is stored in compressed form. The first byte of the archive - member's data indicates the compression type used. A value of 0 (0x30) indicates - that no compression was used. A value of 2 (0x32) indicates that bzip2 - compression was used. + string. diff --git a/include/llvm/Bitcode/Archive.h b/include/llvm/Bitcode/Archive.h index 86c44c7f15..3c75e5882d 100644 --- a/include/llvm/Bitcode/Archive.h +++ b/include/llvm/Bitcode/Archive.h @@ -47,14 +47,13 @@ class ArchiveMember : public ilist_node<ArchiveMember> { /// characteristics of the member. The various "is" methods below provide /// access to the flags. The flags are not user settable. enum Flags { - CompressedFlag = 1, ///< Member is a normal compressed file - SVR4SymbolTableFlag = 2, ///< Member is a SVR4 symbol table - BSD4SymbolTableFlag = 4, ///< Member is a BSD4 symbol table - LLVMSymbolTableFlag = 8, ///< Member is an LLVM symbol table - BitcodeFlag = 16, ///< Member is bitcode - HasPathFlag = 64, ///< Member has a full or partial path - HasLongFilenameFlag = 128, ///< Member uses the long filename syntax - StringTableFlag = 256 ///< Member is an ar(1) format string table + SVR4SymbolTableFlag = 1, ///< Member is a SVR4 symbol table + BSD4SymbolTableFlag = 2, ///< Member is a BSD4 symbol table + LLVMSymbolTableFlag = 4, ///< Member is an LLVM symbol table + BitcodeFlag = 8, ///< Member is bitcode + HasPathFlag = 16, ///< Member has a full or partial path + HasLongFilenameFlag = 32, ///< Member uses the long filename syntax + StringTableFlag = 64 ///< Member is an ar(1) format string table }; /// @} @@ -109,11 +108,6 @@ class ArchiveMember : public ilist_node<ArchiveMember> { /// @brief Get the data content of the archive member const char* getData() const { return data; } - /// This method determines if the member is a regular compressed file. - /// @returns true iff the archive member is a compressed regular file. - /// @brief Determine if the member is a compressed regular file. - bool isCompressed() const { return flags&CompressedFlag; } - /// @returns true iff the member is a SVR4 (non-LLVM) symbol table /// @brief Determine if this member is a SVR4 symbol table. bool isSVR4SymbolTable() const { return flags&SVR4SymbolTableFlag; } @@ -427,7 +421,6 @@ class Archive { bool writeToDisk( bool CreateSymbolTable=false, ///< Create Symbol table bool TruncateNames=false, ///< Truncate the filename to 15 chars - bool Compress=false, ///< Compress files std::string* ErrMessage=0 ///< If non-null, where error msg is set ); @@ -494,7 +487,6 @@ class Archive { std::ofstream& ARFile, ///< The file to write member onto bool CreateSymbolTable, ///< Should symbol table be created? bool TruncateNames, ///< Should names be truncated to 11 chars? - bool ShouldCompress, ///< Should the member be compressed? std::string* ErrMessage ///< If non-null, place were error msg is set ); diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index 68873e2768..5cfc8109be 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -82,14 +82,9 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error) ArchiveMemberHeader* Hdr = (ArchiveMemberHeader*)At; At += sizeof(ArchiveMemberHeader); - // Extract the size and determine if the file is - // compressed or not (negative length). int flags = 0; int MemberSize = atoi(Hdr->size); - if (MemberSize < 0) { - flags |= ArchiveMember::CompressedFlag; - MemberSize = -MemberSize; - } + assert(MemberSize >= 0); // Check the size of the member for sanity if (At + MemberSize > End) { diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp index 9ef29432dd..ec6b4b8758 100644 --- a/lib/Archive/ArchiveWriter.cpp +++ b/lib/Archive/ArchiveWriter.cpp @@ -204,7 +204,6 @@ Archive::writeMember( std::ofstream& ARFile, bool CreateSymbolTable, bool TruncateNames, - bool ShouldCompress, std::string* ErrMsg ) { @@ -349,7 +348,7 @@ Archive::writeSymbolTable(std::ofstream& ARFile) { // table, flattening the file names (no directories, 15 chars max) and // compressing each archive member. bool -Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, +Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, std::string* ErrMsg) { // Make sure they haven't opened up the file, not loaded it, @@ -394,7 +393,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, // builds the symbol table, symTab. for (MembersList::iterator I = begin(), E = end(); I != E; ++I) { if (writeMember(*I, ArchiveFile, CreateSymbolTable, - TruncateNames, Compress, ErrMsg)) { + TruncateNames, ErrMsg)) { TmpArchive.eraseFromDisk(); ArchiveFile.close(); return true; @@ -446,7 +445,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, // compatibility with other ar(1) implementations as well as allowing the // archive to store both native .o and LLVM .bc files, both indexed. if (foreignST) { - if (writeMember(*foreignST, FinalFile, false, false, false, ErrMsg)) { + if (writeMember(*foreignST, FinalFile, false, false, ErrMsg)) { FinalFile.close(); TmpArchive.eraseFromDisk(); return true; diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index c1c8b2474e..7c53701f00 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -50,7 +50,7 @@ static cl::extrahelp MoreHelp( " m[abiSs] - move file(s) in the archive\n" " p[kN] - print file(s) found in the archive\n" " q[ufsS] - quick append file(s) to the archive\n" - " r[abfiuzRsS] - replace or insert file(s) into the archive\n" + " r[abfiuRsS] - replace or insert file(s) into the archive\n" " t - display contents of archive\n" " x[No] - extract file(s) from the archive\n" "\nMODIFIERS (operation specific):\n" @@ -66,7 +66,6 @@ static cl::extrahelp MoreHelp( " [s] - create an archive index (cf. ranlib)\n" " [S] - do not build a symbol table\n" " [u] - update only files newer than archive contents\n" - " [z] - compress files before inserting/extracting\n" "\nMODIFIERS (generic):\n" " [c] - do not warn if the library had to be created\n" " [v] - be verbose about actions taken\n" @@ -101,7 +100,6 @@ bool SymTable = true; ///< 's' & 'S' modifiers bool OnlyUpdate = false; ///< 'u' modifier bool Verbose = false; ///< 'v' modifier bool ReallyVerbose = false; ///< 'V' modifier -bool Compression = false; ///< 'z' modifier // Relative Positional Argument (for insert/move). This variable holds // the name of the archive member to which the 'a', 'b' or 'i' modifier @@ -208,7 +206,6 @@ ArchiveOperation parseCommandLine() { case 'u': OnlyUpdate = true; break; case 'v': Verbose = true; break; case 'V': Verbose = ReallyVerbose = true; break; - case 'z': Compression = true; break; case 'a': getRelPos(); AddAfter = true; @@ -260,8 +257,6 @@ ArchiveOperation parseCommandLine() { throw "The 'f' modifier is only applicable to the 'q' and 'r' operations"; if (OnlyUpdate && Operation != ReplaceOrInsert) throw "The 'u' modifier is only applicable to the 'r' operation"; - if (Compression && Operation!=ReplaceOrInsert && Operation!=Extract) - throw "The 'z' modifier is only applicable to the 'r' and 'x' operations"; if (Count > 1 && Members.size() > 1) throw "Only one member name may be specified with the 'N' modifier"; @@ -413,8 +408,6 @@ doDisplayTable(std::string* ErrMsg) { // Zrw-r--r-- 500/ 500 525 Nov 8 17:42 2004 Makefile if (I->isBitcode()) outs() << "b"; - else if (I->isCompressed()) - outs() << "Z"; else outs() << " "; unsigned mode = I->getMode(); @@ -437,7 +430,7 @@ doDisplayTable(std::string* ErrMsg) { } // doExtract - Implement the 'x' operation. This function extracts files back to -// the file system, making sure to uncompress any that were compressed +// the file system. bool doExtract(std::string* ErrMsg) { if (buildPaths(false, ErrMsg)) @@ -503,7 +496,7 @@ doDelete(std::string* ErrMsg) { } // We're done editting, reconstruct the archive. - if (TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ErrMsg)) + if (TheArchive->writeToDisk(SymTable,TruncateNames,ErrMsg)) return true; if (ReallyVerbose) printSymbolTable(); @@ -558,7 +551,7 @@ doMove(std::string* ErrMsg) { } // We're done editting, reconstruct the archive. - if (TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ErrMsg)) + if (TheArchive->writeToDisk(SymTable,TruncateNames,ErrMsg)) return true; if (ReallyVerbose) printSymbolTable(); @@ -583,7 +576,7 @@ doQuickAppend(std::string* ErrMsg) { } // We're done editting, reconstruct the archive. - if (TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ErrMsg)) + if (TheArchive->writeToDisk(SymTable,TruncateNames,ErrMsg)) return true; if (ReallyVerbose) printSymbolTable(); @@ -681,7 +674,7 @@ doReplaceOrInsert(std::string* ErrMsg) { } // We're done editting, reconstruct the archive. - if (TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ErrMsg)) + if (TheArchive->writeToDisk(SymTable,TruncateNames,ErrMsg)) return true; if (ReallyVerbose) printSymbolTable(); diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp index 64f795f7f6..4006765a9c 100644 --- a/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/tools/llvm-ranlib/llvm-ranlib.cpp @@ -81,7 +81,7 @@ int main(int argc, char **argv) { if (!TheArchive) throw err_msg; - if (TheArchive->writeToDisk(true, false, false, &err_msg )) + if (TheArchive->writeToDisk(true, false, &err_msg )) throw err_msg; if (Verbose) |