Skip to content

Commit

Permalink
Remove references to compression in llvm-ar. It has been a long time …
Browse files Browse the repository at this point in the history
…since we

switched from a bytecode+bzip2 to the current bitcode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161651 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Aug 10, 2012
1 parent ec175ff commit 94bc246
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 73 deletions.
44 changes: 10 additions & 34 deletions docs/CommandGuide/llvm-ar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SYNOPSIS
--------


**llvm-ar** [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
**llvm-ar** [-]{dmpqrtx}[Rabfikou] [relpos] [count] <archive> [files...]


DESCRIPTION
Expand Down Expand Up @@ -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
Expand All @@ -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.



Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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)
~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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.



Expand Down
22 changes: 7 additions & 15 deletions include/llvm/Bitcode/Archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/// @}
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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
);

Expand Down Expand Up @@ -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
);

Expand Down
7 changes: 1 addition & 6 deletions lib/Archive/ArchiveReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions lib/Archive/ArchiveWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Archive::writeMember(
std::ofstream& ARFile,
bool CreateSymbolTable,
bool TruncateNames,
bool ShouldCompress,
std::string* ErrMsg
) {

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 6 additions & 13 deletions tools/llvm-ar/llvm-ar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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();
Expand All @@ -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))
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tools/llvm-ranlib/llvm-ranlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 94bc246

Please sign in to comment.