summaryrefslogtreecommitdiff
path: root/tools/llvm-ar
Commit message (Collapse)AuthorAge
* [CMake] Introduce LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR ↵NAKAMURA Takumi2013-12-16
| | | | | | | | | | to reduce references to CMAKE_CFG_INTDIR. Each of them forms like; ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR} ${CMAKE_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR} git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197394 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196908 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-ar: Let opening a directory failed in llvm-ar.NAKAMURA Takumi2013-11-08
| | | | | | | | Linux cannot open directories with open(2), although cygwin and *bsd can. Motivation: The test, Object/directory.ll, had been failing with --target=cygwin on Linux. XFAIL was improper for host issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194257 91177308-0d34-0410-b5e6-96231b3b80d8
* Support names like llvm-ar-3.4 and llvm-ranlib-3.4.Rafael Espindola2013-10-29
| | | | | | | | | They are used in some packages. For example: http://packages.ubuntu.com/saucy/i386/llvm-3.4/filelist This fixes pr17721. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193612 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix name matching to work on windows.Rafael Espindola2013-08-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189517 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a minimal implementation of ranlib.Rafael Espindola2013-08-28
| | | | | | | | | | | | This is just enough to get "llvm-ranlib foo.a" working and tested. Making llvm-ranlib a symbolic link to llvm-ar doesn't work so well with llvm's option parsing, but ar's option parsing is mostly custom anyway. This patch also removes the -X32_64 option. Looks like it was just added in r10297 as part of implementing the current command line parsing. I can add it back (with a test) if someone really has AIX portability problems without it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189489 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for the 's' operation to llvm-ar.Rafael Espindola2013-07-29
| | | | | | | | | | | | If no other operation is specified, 's' becomes an operation instead of an modifier. The s operation just creates a symbol table. It is the same as running ranlib. We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and if the symbol table is present, then it is current. We use that to optimize the most common case: a broken build system that thinks it has to run ranlib. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187353 91177308-0d34-0410-b5e6-96231b3b80d8
* Split getOpenFile into getOpenFile and getOpenFileSlice.Rafael Espindola2013-07-23
| | | | | | | | | | | | | | | | The main observation is that we never need both the filesize and the map size. When mapping a slice of a file, it doesn't make sense to request a null terminator and that would be the only case where the filesize would be used. There are other cleanups that should be done in this area: * A client should not have to pass the size (even an explicit -1) to say if it wants a null terminator or not, so we should probably swap the argument order. * The default should be to not require a null terminator. Very few clients require this, but many end up asking for it just because it is the default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the build in c++03 mode.Rafael Espindola2013-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186935 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an initial implementation of archive symbol table generation.Rafael Espindola2013-07-23
| | | | | | | | | | | The symbol table has forward references in the file. Instead of allocating a temporary buffer or counting the size and then writing, this implementation writes a dummy value first and patches it once the final value is known. There is room for performance improvement. I will implement them as soon as I get some other features (like a ranlib mode) in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186934 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace archive members in the old position.Rafael Espindola2013-07-22
| | | | | | | | | | | | This matches gnu archive behavior and since archive member order can change which member is used, not changing the order on replacement looks like the right thing to do. This patch also refactors the logic for which archive member to keep and whether to move it to a helper function (computeInsertAction). The nesting in computeNewArchiveMembers was getting a bit confusing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186829 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle replacement into a position past the original member.Rafael Espindola2013-07-21
| | | | | | | We were incorrectly computing where to insert a member if it was replacing a previous member that was before the insert point. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186792 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix inserting new elements in a specified location.Rafael Espindola2013-07-19
| | | | | | We were only handling the 'a' and 'b' options during moves before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186721 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-ar: doExtract(): Write extracted files with F_Binary. It should fix ↵NAKAMURA Takumi2013-07-17
| | | | | | llvm/test/Object/extract.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186503 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a wrapper for open.Rafael Espindola2013-07-16
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8
* On error, close the temporary file descriptor.Rafael Espindola2013-07-16
| | | | | | With this change llvm-ar can remove the temporary file on windows too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186423 91177308-0d34-0410-b5e6-96231b3b80d8
* Use open+fstat instead of stat+open.Rafael Espindola2013-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186381 91177308-0d34-0410-b5e6-96231b3b80d8
* Remember that we have a null terminated string.Rafael Espindola2013-07-16
| | | | | | | This is a micro optimization. Instead of going char*->StringRef->Twine->char*, go char*->Twine->char* and avoid having to copy the filename on the stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186380 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to open the file before use data from stat.Rafael Espindola2013-07-13
| | | | | | | Looks like on mingw we get bogus last modification times on directories. Should fix the mingw bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186240 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused file. Thanks to Sean Silva for noticing it.Rafael Espindola2013-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186239 91177308-0d34-0410-b5e6-96231b3b80d8
* Add r186216 back, but make the test tolerant of different uids and gids.Rafael Espindola2013-07-13
| | | | | | | original message: Fix a off by one error about which members need to use the string table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186238 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit r186216 -- it's breaking bots:Chandler Carruth2013-07-13
| | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/6897/steps/check-all/logs/LLVM%3A%3Aarchive-format.test Original commit log: Fix a off by one error about which members need to use the string table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186232 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a off by one error about which members need to use the string table.Rafael Espindola2013-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186216 91177308-0d34-0410-b5e6-96231b3b80d8
* fix autoconf buildRafael Espindola2013-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186200 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the build with c++03.Rafael Espindola2013-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186198 91177308-0d34-0410-b5e6-96231b3b80d8
* Change llvm-ar to use lib/Object.Rafael Espindola2013-07-12
| | | | | | | | | | | | | | | | | | | | | | This fixes two bugs is lib/Object that the use in llvm-ar found: * In OS X created archives, the name can be padded with nulls. Strip them. * In the constructor, remember the first non special member and use that in begin_children. This makes sure we skip all special members, not just the first one. The change to llvm-ar itself consist of * Using lib/Object for reading archives instead of ArchiveReader.cpp. * Writing the modified archive directly, instead of creating an in memory representation. The old Archive library was way more general than what is needed, as can be seen by the diffstat of this patch. Having llvm-ar using lib/Object now opens the way for creating regular symbol tables for both native objects and bitcode files so that we can use those archives for LTO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186197 91177308-0d34-0410-b5e6-96231b3b80d8
* Add static.Rafael Espindola2013-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186170 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-ar: Clean up memory management with OwningPtr.Benjamin Kramer2013-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186131 91177308-0d34-0410-b5e6-96231b3b80d8
* Use %llu to print a 64 bit number. Should fix the ARM bots.Rafael Espindola2013-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186113 91177308-0d34-0410-b5e6-96231b3b80d8
* InsertBefore is the same as AddBefore. Delete it.Rafael Espindola2013-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186094 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a FIXME about the format and add a test.Rafael Espindola2013-07-11
| | | | | | | While at it, use strftime on Unix too and use the thread safe versions of localtime. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186090 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the 'N' modifier from llvm-ar.Rafael Espindola2013-07-11
| | | | | | | | * It is not present on OS X. * It is untested. * It is not needed for using ar in a build system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186080 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete dead code.Rafael Espindola2013-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186079 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove support for truncating names in archives.Rafael Espindola2013-07-11
| | | | | | | | | | * All systems we support have some form of long name support. * The options has different names and semantics in different implementations ('f' on gnu, 'T' on OS X), which makes it unlikely it is normally used on build systems. * It was completely untested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186078 91177308-0d34-0410-b5e6-96231b3b80d8
* Sync llvm-ar's help string with the options it supports.Rafael Espindola2013-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186076 91177308-0d34-0410-b5e6-96231b3b80d8
* Create files with the correct permission instead of changing it afterwards.Rafael Espindola2013-07-08
| | | | | | No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185832 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixes problem when calling llvm-ar from an unmodifiable directory.Manuel Klimek2013-07-08
| | | | | | | | | This fixes a regression introduced by r185726: the new call to get a unique file does not prepend the system temporary directory, so we need to anchor on the file that the temporary file gets moved to to ensure we're on the same file system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185825 91177308-0d34-0410-b5e6-96231b3b80d8
* [llvm-ar] Added llvm_unreachable to quiet -Wreturn-type warnings.Michael Gottesman2013-07-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185751 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a createUniqueFile function and switch llvm's users of unique_file.Rafael Espindola2013-07-05
| | | | | | | | | | | | | | This function is complementary to createTemporaryFile. It handles the case were the unique file is *not* temporary: we will rename it in the end. Since we will rename it, the file has to be in the same filesystem as the final destination and we don't prepend the system temporary directory. This has a small semantic difference from unique_file: the default mode is 0666. This matches the behavior of most unix tools. For example, with this change lld now produces files with the same permissions as ld. I will add a test of this change when I port clang over to createUniqueFile (next commit). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185726 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't create an archive if, for example, we are asked to print the index.Rafael Espindola2013-07-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185697 91177308-0d34-0410-b5e6-96231b3b80d8
* Use simpler version of exists.Rafael Espindola2013-07-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185695 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove NoOperation.Rafael Espindola2013-07-05
| | | | | | | parseCommandLine prints and error and exists if no operation is specified, so it never returns NoOperation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185691 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't treat bitcode files specially in llvm-ar.Rafael Espindola2013-07-05
| | | | | | | We really want bitcode files to behave as regular object files in archives, so we don't need to track that a member is bitcode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185681 91177308-0d34-0410-b5e6-96231b3b80d8
* Use enums instead of raw octal values.Rafael Espindola2013-06-26
| | | | | | Patch by 罗勇刚(Yonggang Luo). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184971 91177308-0d34-0410-b5e6-96231b3b80d8
* Create the file with the right permissions instead of setting it afterwards.Rafael Espindola2013-06-22
| | | | | | Removes the last use of PathV1.h in llvm-ar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184630 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert some uses of PathV1.h in ArchiveWriter.cpp.Rafael Espindola2013-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184599 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a fixme.Rafael Espindola2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184486 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove last use of PathV1.h from Archive.cpp.Rafael Espindola2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184484 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a setLastModificationAndAccessTime to PathV2.Rafael Espindola2013-06-20
| | | | | | With this we can remove the last use of PathV1 from llvm-ar.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184464 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a raw_fd_ostream instead of a std::ofstream.Rafael Espindola2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184460 91177308-0d34-0410-b5e6-96231b3b80d8