summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-ar] Support multiple dashed optionsPeter Collingbourne2018-03-281-104/+171
| | | | | | | | | | | | | | | This allows syntax like: $ llvm-ar -c -r -u file.a file.o This is in addition to the other formats that are already supported: $ llvm-ar cru file.a file.o $ llvm-ar -cru file.a file.o Patch by Tom Anderson! Differential Revision: https://reviews.llvm.org/D44452 llvm-svn: 328716
* On Windows expansion of regex file name patterns is the responsibility of eachDmitry Mikulin2018-03-051-4/+10
| | | | | | | | tool. Fix ar to do that. Differential Revision: https://reviews.llvm.org/D43987 llvm-svn: 326734
* Implementation of MRI "delete" command.Dmitry Mikulin2018-03-021-1/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D43989 llvm-svn: 326636
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-4/+0
| | | | llvm-svn: 320631
* [llvm-ar] Support an options string that start with a dashMartin Storsjo2017-11-031-0/+20
| | | | | | | | Some projects call $AR like "$AR -crs output input1 input2". Differential Revision: https://reviews.llvm.org/D39538 llvm-svn: 317358
* [tools] Add option to install binutils symlinksShoaib Meenai2017-11-021-0/+6
| | | | | | | | | | | | The LLVM tools can be used as a replacement for binutils, in which case it's convenient to create symlinks with the binutils names. Add support for these symlinks in the build system. As with any other llvm tool symlinks, the user can limit the installed symlinks by only adding the desired ones to `LLVM_TOOLCHAIN_TOOLS`. Differential Revision: https://reviews.llvm.org/D39530 llvm-svn: 317272
* Convert the archive writer to use Error.Rafael Espindola2017-09-211-2/+2
| | | | | | This found one place in lld that was not checking the error. llvm-svn: 313937
* Don't call exit from cl::PrintHelpMessage.Rafael Espindola2017-09-071-2/+1
| | | | | | | | | Most callers were not expecting the exit(0) and trying to exit with a different value. This also adds back the call to cl::PrintHelpMessage in llvm-ar. llvm-svn: 312761
* llvm-ar: exit with 1 if there is an error.Rafael Espindola2017-09-071-20/+14
| | | | | | This is pr34396. llvm-svn: 312752
* Simplify writeArchive return type.Rui Ueyama2017-08-301-2/+2
| | | | | | | | | | writeArchive returned a pair, but the first element of the pair is always its first argument on failure, so it doesn't make sense to return it from the function. This patch change the return type so that it does't return it. Differential Revision: https://reviews.llvm.org/D37313 llvm-svn: 312177
* llvm: add llvm-dlltool support to the archiverMartell Malone2017-07-182-1/+7
| | | | | | | | | | | | | | | | A PE COFF spec compliant import library generator. Intended to be used with mingw-w64. Supports: PE COFF spec (section 8, Import Library Format) PE COFF spec (Aux Format 3: Weak Externals) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D29892 This reapplies rL308329, which was reverted in rL308374 llvm-svn: 308379
* Revert r308329: llvm: add llvm-dlltool support to the archiverRui Ueyama2017-07-182-7/+1
| | | | | | This reverts commit r308329 because it broke buildbots. llvm-svn: 308374
* llvm: add llvm-dlltool support to the archiverMartell Malone2017-07-182-1/+7
| | | | | | | | | | | | | | | A PE COFF spec compliant import library generator. Intended to be used with mingw-w64. Supports: PE COFF spec (section 8, Import Library Format) PE COFF spec (Aux Format 3: Weak Externals) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D29892 llvm-svn: 308329
* [llvm-ar] Make llvm-lib behave more like the MSVC archiverReid Kleckner2017-06-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: Use the filepath used to open the archive member as the archive member name instead of the file basename. This path might be absolute or relative. This is important because the archive member name will show up in the PDB, and we want our PDBs to look as much like MSVC's as possible. This also helps avoid an issue in our PDB module descriptor writing code, which assumes that all module names are unique. Relative paths still aren't guaranteed to be unique, but they're much better than basenames, which definitely aren't unique. Reviewers: ruiu, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33575 llvm-svn: 305223
* [llvm-ar] Fix AddNewMember typo in enumReid Kleckner2017-06-121-4/+4
| | | | llvm-svn: 305209
* Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.Peter Collingbourne2017-05-131-1/+1
| | | | | | | This reorganisation prevents us from cluttering up the top-level lib directory with more driver libraries such as llvm-dlltool (see D29892). llvm-svn: 302995
* [llvm-ar] Remove unneeded std::, NFCI.Davide Italiano2017-04-051-2/+2
| | | | | | | This makes it more consistent with other exit() calls in llvm-ar (and the tools in general). llvm-svn: 299549
* [llvm-ar] errors go on stderr and not on stdout.Davide Italiano2017-04-051-1/+1
| | | | llvm-svn: 299548
* [llvm-ar] Extract objects to their basename in the CWDReid Kleckner2017-03-311-1/+3
| | | | | | | This is helpful when extracting objects from archives produced by MSVC's lib.exe, which users absolute paths to describe the archive members. llvm-svn: 299264
* Don't modify archive members unless really needed.Rafael Espindola2017-02-211-4/+11
| | | | | | | | | | | For whatever reason ld64 requires that member headers (not the member themselves) should be aligned. The only way to do that is to edit the previous member so that it ends at an aligned boundary. Since modifying data put in an archive is an undesirable property, llvm-ar should only do it when it is absolutely necessary. llvm-svn: 295765
* Always use / as the path separator.Rafael Espindola2016-12-041-1/+1
| | | | | | | It is not clear if it is worth the complexity to use \ on windows. This should fix the bots. llvm-svn: 288616
* Prefix path when displaying thin archives.Rafael Espindola2016-12-041-0/+5
| | | | | | Patch by Mark Santaniello. llvm-svn: 288615
* [CMake] llvm-ar depends on intrinsics_genChris Bieneman2016-11-181-0/+3
| | | | | | | | | | | | | | llvm-ar.cpp has the following include chain: llvm/IR/Module.h llvm/IR/Function.h llvm/IR/Argument.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means llvm-ar needs to depend on intrinsics_gen. llvm-svn: 287395
* Make the Error class constructor protectedMehdi Amini2016-11-111-4/+4
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* [Object] Replace TimeValue with std::chronoPavel Labath2016-10-241-1/+1
| | | | | | | | | | | | | | | Summary: Most of the changes are very straight-forward. The only choice I had to make was to use second-precision time points in the Archive classes. I did this because the archive files use that precision in the on-disk representation anyway. Reviewers: rafael, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25773 llvm-svn: 284974
* Remove TimeValue usage from llvm/SupportPavel Labath2016-10-241-5/+6
| | | | | | | | | | | | | | | | | Summary: This is a follow-up to D25416. It removes all usages of TimeValue from llvm/Support library (except for the actual TimeValue declaration), and replaces them with appropriate usages of std::chrono. To facilitate this, I have added small utility functions for converting time points and durations into appropriate OS-specific types (FILETIME, struct timespec, ...). Reviewers: zturner, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25730 llvm-svn: 284966
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-1/+1
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* Use the range variant of find_if instead of unpacking begin/endDavid Majnemer2016-08-121-4/+3
| | | | | | No functionality change is intended. llvm-svn: 278443
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-111-1/+1
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* Clean up of libObject/Archive interfaces and change the last three uses of ↵Kevin Enderby2016-08-031-3/+5
| | | | | | | | | | | | ErrorOr<> changing them to Expected<> to allow them to pass through llvm Errors. No functional change. This commit by itself will break the next lld builds.  I’ll be committing the matching change for lld immediately next. llvm-svn: 277656
* Reapply "More fixes to get good error messages for bad archives."Vedant Kumar2016-08-031-8/+23
| | | | | | | | This reverts commit the revert commit r277627. The build errors mentioned in r277627 were likely caused by an unclean build directory. Sorry for the noise. llvm-svn: 277630
* Revert "More fixes to get good error messages for bad archives."Vedant Kumar2016-08-031-23/+8
| | | | | | | | | | | | | This reverts commit r277540. It breaks the build with: ../lib/Object/Archive.cpp:264:41: error: return type of out-of-line definition of 'llvm::object::ArchiveMemberHeader::getUID' differs from that in the declaration Expected<unsigned> ArchiveMemberHeader::getUID() const { ~~~~~~~~~~~~~~~~~~ ^ include/llvm/Object/Archive.h:53:12: note: previous declaration is here unsigned getUID() const; ~~~~~~~~ ^ llvm-svn: 277627
* More fixes to get good error messages for bad archives.Kevin Enderby2016-08-021-8/+23
| | | | | | | Fixed the last incorrect uses of llvm_unreachable() in the code which were actually just cases of errors in the input Archives. llvm-svn: 277540
* The next step along the way to getting good error messages for bad archives.Kevin Enderby2016-07-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | As mentioned in commit log for r276686 this next step is adding a new method in the ArchiveMemberHeader class to get the full name that does proper error checking, and can be use for error messages. To do this the name of ArchiveMemberHeader::getName() is changed to ArchiveMemberHeader::getRawName() to be consistent with Archive::Child::getRawName(). Then the “new” method is the addition of a new implementation of ArchiveMemberHeader::getName() which gets the full name and provides proper error checking. Which is mostly a rewrite of what was Archive::Child::getName() and cleaning up incorrect uses of llvm_unreachable() in the code which were actually just cases of errors in the input Archives. Then Archive::Child::getName() is changed to return Expected<> and use the new implementation of ArchiveMemberHeader::getName() . Also needed to change Archive::getMemoryBufferRef() with these changes to return Expected<> as well to propagate Errors up. As well as changing Archive::isThinMember() to return Expected<> . llvm-svn: 277177
* [llvm-ar] Document 'T' thin archive modifier (NFC)Teresa Johnson2016-07-221-0/+1
| | | | llvm-svn: 276457
* Next step along the way to getting good error messages for bad archives.Kevin Enderby2016-07-191-2/+2
| | | | | | | | | This step builds on Lang Hames work to change Archive::child_iterator for better interoperation with Error/Expected. Building on that it is now possible to return an error message when the size field of an archive contains non-decimal characters. llvm-svn: 276025
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-141-32/+36
| | | | llvm-svn: 275361
* [Object] Revert r275316, Archive::child_iterator changes, while I update lld.Lang Hames2016-07-141-36/+32
| | | | | | Should fix the bots broken by r275316. llvm-svn: 275353
* [Object] Change Archive::child_iterator for better interop with Error/Expected.Lang Hames2016-07-131-32/+36
| | | | | | | | | | | | | | | | | | | | | | | See http://reviews.llvm.org/D22079 Changes the Archive::child_begin and Archive::children to require a reference to an Error. If iterator increment fails (because the archive header is damaged) the iterator will be set to 'end()', and the error stored in the given Error&. The Error value should be checked by the user immediately after the loop. E.g.: Error Err; for (auto &C : A->children(Err)) { // Do something with archive child C. } // Check the error immediately after the loop. if (Err) return Err; Failure to check the Error will result in an abort() when the Error goes out of scope (as guaranteed by the Error class). llvm-svn: 275316
* Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI.Peter Collingbourne2016-06-291-67/+54
| | | | | | | | | | | | | | | | The NewArchiveIterator class has a problem: it requires too much context. Any memory buffers added to the archive must be stored within an Archive::Member, which must have an associated Archive. This makes it harder than necessary to create new archive members (or new archives entirely) from scratch using memory buffers. This patch replaces NewArchiveIterator with a NewArchiveMember class that stores just the memory buffer and the information that goes into the archive member header. Differential Revision: http://reviews.llvm.org/D21721 llvm-svn: 274183
* Change Archive::create() from ErrorOr<...> to Expected<...> and updateKevin Enderby2016-06-291-2/+5
| | | | | | | | | its clients. This commit will break the next lld builds. I’ll be committing the matching change for lld next. llvm-svn: 274160
* [llvm-ar] Ignore -plugin option.Davide Italiano2016-06-271-0/+1
| | | | | | | | | | | binutils ar uses -plugin to specify the LTO plugin, but LLVM doesn't need this as it doesn't use a plugin for LTO. Accepting (and ignoring) the option allows interoperability with existing build systems and make downstream consumers life much easier. No objections from Rafael on this change. llvm-svn: 273938
* llvm-ar: reduce some duplication, NFCSaleem Abdulrasool2016-06-221-27/+19
| | | | | | | Improve the previous change by using a local function to reduce the duplication of the object file scanning. NFC. llvm-svn: 273429
* llvm-ar: be more clever about default formatSaleem Abdulrasool2016-06-221-18/+76
| | | | | | | | | | | | Try to be more clever about selecting the default format. When an existing archive is used, use the type of the archive to determine the format. When existing members are present, use the first member's format to determine the format to use. If we are creating an empty archive (MRI mode) or are adding non-object members, default to the current behaviour of using the host type due to the lack of a better alternative. This aids in cross-compilation on Darwin to non-Darwin platforms which rely on GNU format archives. llvm-svn: 273373
* llvm-ar: correct typoSaleem Abdulrasool2016-06-211-1/+1
| | | | | | Default was misspelt. NFC. llvm-svn: 273287
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Fix bug where temporary file would be left behind every time an archive was ↵Rafael Espindola2016-05-091-7/+13
| | | | | | | | | | | | | | | | | | | updated. When updating an existing archive, llvm-ar opens the old archive into a `MemoryBuffer`, does its thing, and writes the results to a temporary file. That file is then renamed to the original archive filename, thus replacing it with the updated contents. However, on Windows at least, what would happen is that the `MemoryBuffer` for the old archive would actually be an mmap'ed view of the file, so when it came time to do the rename via Win32's `ReplaceFile`, it would succeed but would be unable to fully replace the file since there would still be a handle open on it; instead, the old version got renamed to a random temporary name and left behind. Patch by Cameron! llvm-svn: 268916
* Simplify. NFC.Rafael Espindola2016-05-021-4/+1
| | | | llvm-svn: 268326
* Don't try to create thin bsd archives.Rafael Espindola2016-05-021-1/+3
| | | | | | Not such variant has been specified yet. llvm-svn: 268305
* Fix formatting and wording of llvm-ranlib error message. NFC.Sunil Srivastava2016-04-081-1/+1
| | | | | | | | Patch by Douglas Yung! Reviewed by Rafael Espindola llvm-svn: 265753
OpenPOWER on IntegriCloud