summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar/llvm-ar.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* llvm-ar: Don't try to extract from thin archives.Rafael Espindola2015-07-141-0/+5
| | | | | | This matches the gnu ar behavior. llvm-svn: 242162
* llvm-ar: print an error when the requested member is not found.Rafael Espindola2015-07-141-3/+12
| | | | llvm-svn: 242156
* Use a range loop. NFC.Rafael Espindola2015-07-141-19/+17
| | | | llvm-svn: 242153
* Add support deterministic output in llvm-ar and make it the default.Rafael Espindola2015-07-131-2/+10
| | | | llvm-svn: 242061
* Create BSD archives by default on OS X.Rafael Espindola2015-07-091-3/+9
| | | | | | | | | They should probably be created on anything that is not windows or linux, but I will test on freebsd before changing that. With this it is possible to bootstrap with llvm-ar instead of ar+ranlib on OS X. llvm-svn: 241849
* Disallow Archive::child_iterator that don't point to an archive.Rafael Espindola2015-07-081-1/+2
| | | | | | NFC, just less error prone. llvm-svn: 241747
* Start adding support for writing archives in BSD format.Rafael Espindola2015-07-081-2/+24
| | | | | | | | 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. llvm-svn: 241721
* ArrayRef-ify libDriverMainDavid Blaikie2015-06-211-1/+1
| | | | llvm-svn: 240234
* LibDriver, llvm-lib: introduce.Peter Collingbourne2015-06-091-6/+11
| | | | | | | | | | llvm-lib is intended to be a lib.exe compatible utility that also understands bitcode. The implementation lives in a library so that lld can use it to implement /lib. Differential Revision: http://reviews.llvm.org/D10297 llvm-svn: 239434
* llvm-ar: Move archive writer to Object.Peter Collingbourne2015-06-081-326/+6
| | | | | | | | | No functional change intended, other than some minor changes to certain diagnostics. Differential Revision: http://reviews.llvm.org/D10296 llvm-svn: 239278
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-0/+1
| | | | | | NFC. llvm-svn: 232976
* llvm-ar: Remove unimplemented -N option from -helpDavid Majnemer2015-01-281-1/+0
| | | | | | This fixes PR22358. llvm-svn: 227296
* Only seek once before writing the member offsets.Rafael Espindola2014-12-111-18/+20
| | | | | | | This cuts down the number on system calls done by a static llvm-ar producing lib/libclangSema.a from 9164 to 442. llvm-svn: 224025
* llvm-ar: close input files early.Rafael Espindola2014-12-111-16/+13
| | | | | | We already have them mapped into memory, so we can just close the file. llvm-svn: 224020
* Remove unused variable.Rafael Espindola2014-11-071-2/+2
| | | | llvm-svn: 221549
* Make two helper functions static.Rafael Espindola2014-10-221-2/+2
| | | | llvm-svn: 220389
* Handle spaces and quotes in file names in MRI scripts.Rafael Espindola2014-10-221-0/+3
| | | | llvm-svn: 220364
* MRI scripts: Add addlib support.Rafael Espindola2014-10-211-1/+20
| | | | llvm-svn: 220346
* Use a range loop. NFC.Rafael Espindola2014-10-211-7/+6
| | | | llvm-svn: 220344
* Overwrite instead of adding to archives when creating them in mri scripts.Rafael Espindola2014-10-211-67/+75
| | | | | | | This matches the behavior of GNU ar and also makes it easier to implemnt support for the addlib command. llvm-svn: 220336
* Convert a few std::string with StringRef. NFC.Rafael Espindola2014-10-211-24/+30
| | | | | | | | | This is a micro optimization, but also makes the code a bit more flexible. The MRIMembers variable is a short term hack. It is going away in the next commit. llvm-svn: 220334
* Use a StringRef. No functionality change.Rafael Espindola2014-10-211-5/+4
| | | | llvm-svn: 220327
* Move code a bit to avoid a few declarations. NFC.Rafael Espindola2014-10-211-45/+40
| | | | llvm-svn: 220317
* Comment cleanup. NFC.Rafael Espindola2014-10-211-16/+14
| | | | | | | Don't duplicate names in comments and remove useless ones. Hopefully anyone reading this knows what main is. llvm-svn: 220298
* Add support for addmod to mri scripts.Rafael Espindola2014-10-211-1/+5
| | | | llvm-svn: 220294
* llvm-ar: Start adding support for mri scripts.Rafael Espindola2014-10-101-2/+57
| | | | | | | | | | | | | | | | | | | | | | I was quiet surprised to find this feature being used. Fortunately the uses I found look fairly simple. In fact, they are just a very verbose version of the regular ar commands. Start implementing it then by parsing the script and setting the command variables as if we had a regular command line. This patch adds just enough support to create an empty archive and do a bit of error checking. In followup patches I will implement at least addmod and addlib. From the description in the manual, even the more general case should not be too hard to implement if needed. The features that don't map 1:1 to the simple command line are * Reading from multiple archives. * Creating multiple archives. llvm-svn: 219521
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
* Remove some calls to std::move.Rafael Espindola2014-08-011-5/+4
| | | | | | | | | Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-7/+8
| | | | llvm-svn: 212405
* Add support for inline asm symbols in llvm-ar.Rafael Espindola2014-07-031-0/+5
| | | | | | | This should allow llvm-ar to be used instead of gnu ar + plugin in a LTO build. I will add a release note about it once I finish a LTO bootstrap with it. llvm-svn: 212287
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-261-1/+2
| | | | | | Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-261-2/+1
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
* Pass a unique_ptr<MemoryBuffer> to the constructors in the Binary hierarchy.Rafael Espindola2014-06-241-1/+1
| | | | | | | Once the objects are constructed, they own the buffer. Passing a unique_ptr makes that clear. llvm-svn: 211595
* Pass a std::unique_ptr& to the create??? methods is lib/Object.Rafael Espindola2014-06-231-3/+3
| | | | | | | | This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constructed that now owns the buffer. llvm-svn: 211546
* Make ObjectFile and BitcodeReader always own the MemoryBuffer.Rafael Espindola2014-06-231-1/+2
| | | | | | | | | | This allows us to just use a std::unique_ptr to store the pointer to the buffer. The flip side is that they have to support releasing the buffer back to the caller. Overall this looks like a more efficient and less brittle api. llvm-svn: 211542
* Simplify memory management with std::unique_ptr.Rafael Espindola2014-06-231-12/+8
| | | | llvm-svn: 211538
* Add a symbols() range and use a range loop.Rafael Espindola2014-06-181-5/+3
| | | | llvm-svn: 211222
* Simplify code.Rafael Espindola2014-06-181-10/+1
| | | | | | We can delete the objects earlier now that we are copying the names to a buffer. llvm-svn: 211221
* Convert the Archive API to use ErrorOr.Rafael Espindola2014-06-161-5/+10
| | | | | | | | | Now that we have c++11, even things like ErrorOr<std::unique_ptr<...>> are easy to use. No intended functionality change. llvm-svn: 211033
* Finishing touch for the std::error_code transition.Rafael Espindola2014-06-131-3/+4
| | | | | | | | | | | While std::error_code itself seems to work OK in all platforms, there are few annoying differences with regards to the std::errc enumeration. This patch adds a simple llvm enumeration, which will hopefully avoid build breakages in other platforms and surprises as we get more uses of std::error_code. llvm-svn: 210920
* Remove 'using std::error_code' from tools.Rafael Espindola2014-06-131-3/+2
| | | | llvm-svn: 210876
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Don't import make_error_code into the llvm namespace.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210772
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of this patch is to turn llvm/Support/system_error.h into a transitional header that just brings in the erorr_code api to the llvm namespace. I will remove it shortly afterwards. The cases where the general idea needed some tweaking: * std::errc is a namespace in msvc, so we cannot use "using std::errc". I could add an #ifdef, but there were not that many uses, so I just added std:: to them in this patch. * Template specialization had to be moved to the std namespace in this patch set already. * The msvc implementation of default_error_condition doesn't seem to provide the same transformations as we need. Not too surprising since the standard doesn't actually say what "equivalent" means. I fixed the problem by keeping our old mapping and using it at error_code construction time. Despite these shortcomings I think this is still a good thing. Some reasons: * The different implementations of system_error might improve over time. * It removes 925 lines of code from llvm already. * It removes 6313 bytes from the text segment of the clang binary when it is built with gcc and 2816 bytes when building with clang and libstdc++. llvm-svn: 210687
* Turn errc and windows_error into enum classes.Rafael Espindola2014-05-311-2/+1
| | | | llvm-svn: 209957
* llvm-ar: Output the file we errored on.Filipe Cabecinhas2014-05-231-1/+1
| | | | llvm-svn: 209500
* [C++] Use 'nullptr'. Tools edition.Craig Topper2014-04-251-2/+2
| | | | llvm-svn: 207176
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+2
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-2/+2
| | | | llvm-svn: 202957
OpenPOWER on IntegriCloud