summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove autoconf supportChris Bieneman2016-01-261-21/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [llvm-ar] Use failIfError/fail helpers.Davide Italiano2015-11-141-11/+4
| | | | llvm-svn: 253141
* [llvm-ar] Use fail() helper to reduce duplication.Davide Italiano2015-11-141-4/+2
| | | | llvm-svn: 253139
* [llvm-ar] Simplify the code.Davide Italiano2015-11-141-12/+3
| | | | llvm-svn: 253138
* Reapply r250906 with many suggested updates from Rafael Espindola.Kevin Enderby2015-11-051-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is expected. This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. These changes will require corresponding changes to the lld project. That will be committed immediately after this change. But this revision will cause lld failures with this alone which is expected. llvm-svn: 252192
* This doesn't need a object::Archive::child_iterator.Rafael Espindola2015-11-021-2/+2
| | | | llvm-svn: 251796
* Make a few definitions static. NFC.Rafael Espindola2015-11-011-5/+6
| | | | llvm-svn: 251759
* Use Child instead of child_iterator in the archive writer.Rafael Espindola2015-11-011-4/+3
| | | | | | | We never need to pass end(). This will also remove some complication once we start adding error checking. llvm-svn: 251758
* Prefer ranlib mode over ar mode.Ed Schouten2015-10-271-2/+2
| | | | | | | | | | | | | | | | | For CloudABI's toolchain I have a symlink that goes from <target>-ar and <target>-ranlib to LLVM's ar binary, to mimick GNU Binutils' naming scheme. The problem is that if we're targetting ARM64, the name of the ranlib executable is aarch64-unknown-cloudabi-ranlib. This already contains the string "ar". Let's move the "ranlib" test above the "ar" test. It's not that likely that we're going to see operating systems or harwdare architectures that are called "ranlib". Reviewed by: rafael Differential Revision: http://reviews.llvm.org/D14123 llvm-svn: 251413
* Backing out commit r250906 as it broke lld.Kevin Enderby2015-10-211-26/+6
| | | | llvm-svn: 250908
* This removes the eating of the error in Archive::Child::getSize() when the ↵Kevin Enderby2015-10-211-6/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. Also corrected the code where the size gets us to the “at the end of the archive” which is OK but past the end of the archive will return object_error::parse_failed now. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. llvm-svn: 250906
* [CMake] Refactor and cleanup generating and installing symlinks to tools.Chris Bieneman2015-09-142-58/+2
| | | | | | | | | | | | Summary: This change generalizes symlink generation and makes symlinks to tools obey LLVM_TOOLCHAIN_TOOLS. It makes it so that if you exclude llvm-ar from LLVM_TOOLCHAIN_TOOLS you don't end up with broken symlinks to llvm-lib and llvm-ranlib in your install. Reviewers: bogner, chapuni, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12864 llvm-svn: 247632
* For new archive member we only need to store the full path.Rafael Espindola2015-07-151-9/+7
| | | | | | | We were storing both the path and the file name, which was redundant and easy to get confused up with. llvm-svn: 242347
* Handle the error of trying to convert a regular archive to a thin one.Rafael Espindola2015-07-151-2/+13
| | | | | | While at it, test that we can add to a thin archive. llvm-svn: 242330
* Initial support for writing thin archives.Rafael Espindola2015-07-151-3/+7
| | | | llvm-svn: 242269
* Add support for reading members out of thin archives.Rafael Espindola2015-07-141-2/+4
| | | | | | | | | | For now the Archive owns the buffers of the thin archive members. This makes for a simple API, but all the buffers are destructed only when the archive is destructed. This should be fine since we close the files after mmap so we should not hit an open file limit. llvm-svn: 242215
* 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-094-7/+31
| | | | | | | | | | 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
* Manually specify the folder that llvm-ranlib should reside in for ↵Aaron Ballman2015-01-071-0/+2
| | | | | | CMake-produced solutions that care about such things (like MSVC). This takes llvm-ranlib out of the root solution folder and places it into the Tools folder where it belongs. llvm-svn: 225353
* 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
* [CMake] Fix installation of llvm-ranlib on multiconfig builder.NAKAMURA Takumi2014-12-082-1/+26
| | | | | | | Introduce install_symlink.cmake from clang/tools/driver/clang_symlink.cmake. FIXME: Would it be generalized? llvm-svn: 223655
* Introduce "llvm-ranlib" as a name of targets since ↵NAKAMURA Takumi2014-12-041-1/+1
| | | | | | Object/archive-symtab.test requires llvm-ranlib. llvm-svn: 223332
* For copy, cmake needs the full path to llvm-ar.Rafael Espindola2014-12-041-1/+2
| | | | | | This should fix the windows build. llvm-svn: 223324
* Add missing dependency on llvm-ar. Should hopefully fix the bots.Rafael Espindola2014-12-041-1/+2
| | | | llvm-svn: 223321
* Make llvm-ar a real build target and install it.Rafael Espindola2014-12-031-10/+5
| | | | llvm-svn: 223309
* 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
OpenPOWER on IntegriCloud