summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Archive.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Add overloads for externally used OwningPtr functions.Ahmed Charles2014-03-051-7/+24
| | | | | | | | This will allow external callers of these functions to switch over time rather than forcing a breaking change all a once. These particular functions were determined by building clang/lld/lldb. llvm-svn: 202959
* Add a SymbolicFile interface between Binary and ObjectFile.Rafael Espindola2014-02-211-2/+3
| | | | | | | | | | | This interface allows IRObjectFile to be implemented without having dummy methods for all section and segment related methods. Both llvm-ar and llvm-nm are changed to use it. Unfortunately the mangler is still not plugged in since it requires some refactoring to make a Module hold a DataLayout. llvm-svn: 201881
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | The constructors of classes deriving from Binary normally take an error_code as an argument to the constructor. My original intent was to change them to have a trivial constructor and move the initial parsing logic to a static method returning an ErrorOr. I changed my mind because: * A constructor with an error_code out parameter is extremely convenient from the implementation side. We can incrementally construct the object and give up when we find an error. * It is very efficient when constructing on the stack or when there is no error. The only inefficient case is where heap allocating and an error is found (we have to free the memory). The result is that this is a much smaller patch. It just standardizes the create* helpers to return an ErrorOr. Almost no functionality change: The only difference is that this found that we were trying to read past the end of COFF import library but ignoring the error. llvm-svn: 199770
* Rename these methods to match the style guide.Rafael Espindola2014-01-211-15/+15
| | | | llvm-svn: 199751
* Return an ErrorOr<Binary *> from createBinary.Rafael Espindola2014-01-151-3/+4
| | | | | | | | I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too cumbersome to use without std::move. I will keep the patch locally and submit when we switch to c++11. llvm-svn: 199326
* Add support for the 's' operation to llvm-ar.Rafael Espindola2013-07-291-2/+6
| | | | | | | | | | | | 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. llvm-svn: 187353
* Add 'const' qualifiers to static const char* variables.Craig Topper2013-07-161-1/+1
| | | | llvm-svn: 186371
* Change llvm-ar to use lib/Object.Rafael Espindola2013-07-121-26/+23
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 186197
* Don't reject an empty archive.Rafael Espindola2013-07-121-4/+6
| | | | llvm-svn: 186159
* Find the symbol table on archives created on OS X.Rafael Espindola2013-07-101-3/+14
| | | | llvm-svn: 186041
* Don't crash in 'llvm -s' when an archive has no symtab.Rafael Espindola2013-07-101-1/+7
| | | | llvm-svn: 186029
* Add missing getters. They will be used in llvm-ar.Rafael Espindola2013-07-091-0/+32
| | | | llvm-svn: 185937
* Archive members cannot be larger than 4GB. Return a uint32_t.Rafael Espindola2013-07-091-5/+5
| | | | llvm-svn: 185936
* Add getHeader helper and move ToHeader to the cpp file.Rafael Espindola2013-07-091-2/+6
| | | | llvm-svn: 185933
* Compute the size of an archive member in the constructor.Rafael Espindola2013-07-091-14/+13
| | | | | | | It is always computed the same way (by parsing the header). Doing it in the constructor simplifies the callers a bit. llvm-svn: 185905
* Move some code out of line. No functionality change.Rafael Espindola2013-07-091-0/+70
| | | | llvm-svn: 185901
* Remove a useless declarations (found by scan-build)Sylvestre Ledru2013-07-051-1/+0
| | | | llvm-svn: 185709
* Use the raw member names in Archive::Archive.Rafael Espindola2013-07-051-15/+10
| | | | | | | This a bit more efficient and avoids having a function that uses the string table being called by a function that searches for it. llvm-svn: 185680
* Add support for archives with no symbol table or string table.Rafael Espindola2013-07-041-1/+1
| | | | llvm-svn: 185664
* Add support for gnu archives with a string table and no symtab.Rafael Espindola2013-07-031-27/+52
| | | | | | While there, use early returns to reduce nesting. llvm-svn: 185547
* Remove the LLVM specific archive index.Rafael Espindola2013-06-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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". llvm-svn: 184019
* [Object/COFF] Fix Windows .lib name handling.Rui Ueyama2013-06-031-4/+10
| | | | llvm-svn: 183091
* [Object][Archive] Improve performance.Michael J. Spencer2013-02-031-98/+10
| | | | | | | | | | | | 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. llvm-svn: 174272
* [Object][Archive] Fix name handling with bsd style long names.Michael J. Spencer2013-01-101-8/+14
| | | | llvm-svn: 172026
* [Object][Archive] Apparently StringRef::getAsInteger for APInt accepts spaces.Michael J. Spencer2013-01-101-2/+6
| | | | llvm-svn: 172022
* [Object][Archive] Use uint64_t instead of APInt. It is significantly faster.Michael J. Spencer2013-01-091-10/+10
| | | | llvm-svn: 172015
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-1/+1
| | | | | | | | | | | | | | | | | 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. =] llvm-svn: 169131
* s/assert/llvm_unreachable/Matt Beaumont-Gay2012-11-141-3/+4
| | | | llvm-svn: 167936
* Fix broken asserts. Also, spell 'indices' correctly.Matt Beaumont-Gay2012-11-141-6/+6
| | | | llvm-svn: 167894
* [Object] Fix endianess bug by refactoring Archive::Symbol::getMember.Michael J. Spencer2012-11-141-18/+32
| | | | llvm-svn: 167893
* Adding changes to support GNU style archive library readingShankar Easwaran2012-11-131-26/+118
| | | | llvm-svn: 167853
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-091-1/+1
| | | | llvm-svn: 158248
* Mark some static arrays as const.Craig Topper2012-05-241-2/+2
| | | | llvm-svn: 157377
* [Object]David Meyer2012-03-091-1/+1
| | | | | | Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big llvm-svn: 152435
* Remove static ctor.Benjamin Kramer2012-02-221-2/+2
| | | | llvm-svn: 151160
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* Simplify code.Benjamin Kramer2011-11-041-4/+3
| | | | llvm-svn: 143695
* Removed unused variable.Chad Rosier2011-11-021-1/+0
| | | | llvm-svn: 143591
* Object/Archive: Add symbol table iteration.Michael J. Spencer2011-11-021-9/+71
| | | | llvm-svn: 143561
* Object/Archive: Cleanup anon namespace.Michael J. Spencer2011-10-251-8/+5
| | | | llvm-svn: 142983
* Object/Archive: Add BSD style long file name support and skip internal members.Michael J. Spencer2011-10-251-7/+48
| | | | llvm-svn: 142981
* lib/Object: Suppress warnings on gcc-4.3.4 cygwinNAKAMURA Takumi2011-10-081-1/+1
| | | | llvm-svn: 141485
* Object: constize Archive.Michael J. Spencer2011-10-081-2/+2
| | | | llvm-svn: 141448
* Object: Add archive support.Michael J. Spencer2011-09-271-0/+172
llvm-svn: 140626
OpenPOWER on IntegriCloud