summaryrefslogtreecommitdiff
path: root/lib/Object/Archive.cpp
Commit message (Collapse)AuthorAge
* 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
* Add 'const' qualifiers to static const char* variables.Craig Topper2013-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186371 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
* Don't reject an empty archive.Rafael Espindola2013-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186159 91177308-0d34-0410-b5e6-96231b3b80d8
* Find the symbol table on archives created on OS X.Rafael Espindola2013-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186041 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash in 'llvm -s' when an archive has no symtab.Rafael Espindola2013-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186029 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing getters. They will be used in llvm-ar.Rafael Espindola2013-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185937 91177308-0d34-0410-b5e6-96231b3b80d8
* Archive members cannot be larger than 4GB. Return a uint32_t.Rafael Espindola2013-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185936 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getHeader helper and move ToHeader to the cpp file.Rafael Espindola2013-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185933 91177308-0d34-0410-b5e6-96231b3b80d8
* Compute the size of an archive member in the constructor.Rafael Espindola2013-07-09
| | | | | | | It is always computed the same way (by parsing the header). Doing it in the constructor simplifies the callers a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185905 91177308-0d34-0410-b5e6-96231b3b80d8
* Move some code out of line. No functionality change.Rafael Espindola2013-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185901 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a useless declarations (found by scan-build)Sylvestre Ledru2013-07-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185709 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the raw member names in Archive::Archive.Rafael Espindola2013-07-05
| | | | | | | This a bit more efficient and avoids having a function that uses the string table being called by a function that searches for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185680 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for archives with no symbol table or string table.Rafael Espindola2013-07-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185664 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for gnu archives with a string table and no symtab.Rafael Espindola2013-07-03
| | | | | | While there, use early returns to reduce nesting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185547 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the LLVM specific archive index.Rafael Espindola2013-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Archive files (.a) can have a symbol table indicating which object files in them define which symbols. The purpose of this symbol table is to speed up linking by allowing the linker the read only the .o files it is actually going to use instead of having to parse every object's symbol table. LLVM's archive library currently supports a LLVM specific format for such table. It is hard to see any value in that now that llvm-ld is gone: * System linkers don't use it: GNU ar uses the same plugin as the linker to create archive files with a regular index. The OS X ar creates no symbol table for IL files, I assume the linker just parses all IL files. * It doesn't interact well with archives having both IL and native objects. * We probably don't want to be responsible for yet another archive format variant. This patch then: * Removes support for creating and reading such index from lib/Archive. * Remove llvm-ranlib, since there is nothing left for it to do. We should in the future add support for regular indexes to llvm-ar for both native and IL objects. When we do that, llvm-ranlib should be reimplemented as a symlink to llvm-ar, as it is equivalent to "ar s". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184019 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object/COFF] Fix Windows .lib name handling.Rui Ueyama2013-06-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183091 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][Archive] Improve performance.Michael J. Spencer2013-02-03
| | | | | | | | | | | | Improve performance of iterating over children and accessing the member file buffer by caching the file size and moving code out to the header. This also makes getBuffer return a StringRef instead of a MemoryBuffer. Both fixing a memory leak and removing a malloc. This takes getBuffer from ~10% of the time in lld to unmeasurable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174272 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][Archive] Fix name handling with bsd style long names.Michael J. Spencer2013-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172026 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][Archive] Apparently StringRef::getAsInteger for APInt accepts spaces.Michael J. Spencer2013-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172022 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][Archive] Use uint64_t instead of APInt. It is significantly faster.Michael J. Spencer2013-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172015 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* s/assert/llvm_unreachable/Matt Beaumont-Gay2012-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167936 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix broken asserts. Also, spell 'indices' correctly.Matt Beaumont-Gay2012-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167894 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object] Fix endianess bug by refactoring Archive::Symbol::getMember.Michael J. Spencer2012-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167893 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding changes to support GNU style archive library readingShankar Easwaran2012-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167853 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158248 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark some static arrays as const.Craig Topper2012-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157377 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object]David Meyer2012-03-09
| | | | | | | | | Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152435 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove static ctor.Benjamin Kramer2012-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151160 91177308-0d34-0410-b5e6-96231b3b80d8
* Unweaken vtables as per ↵David Blaikie2011-12-20
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code.Benjamin Kramer2011-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143695 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed unused variable.Chad Rosier2011-11-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143591 91177308-0d34-0410-b5e6-96231b3b80d8
* Object/Archive: Add symbol table iteration.Michael J. Spencer2011-11-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143561 91177308-0d34-0410-b5e6-96231b3b80d8
* Object/Archive: Cleanup anon namespace.Michael J. Spencer2011-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142983 91177308-0d34-0410-b5e6-96231b3b80d8
* Object/Archive: Add BSD style long file name support and skip internal members.Michael J. Spencer2011-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142981 91177308-0d34-0410-b5e6-96231b3b80d8
* lib/Object: Suppress warnings on gcc-4.3.4 cygwinNAKAMURA Takumi2011-10-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141485 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: constize Archive.Michael J. Spencer2011-10-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141448 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add archive support.Michael J. Spencer2011-09-27
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140626 91177308-0d34-0410-b5e6-96231b3b80d8