summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
* Change the begin and end methods in ObjectFile to match the style guide.Rafael Espindola2014-02-103-28/+28
| | | | llvm-svn: 201108
* Use the information provided by getFlags to unify some code in llvm-nm.Rafael Espindola2014-02-051-3/+7
| | | | | | | | | | It is not clear how much we should try to expose in getFlags. For example, should there be a SF_Object and a SF_Text? But for information that is already being exposed, we may as well use it in llvm-nm. llvm-svn: 200820
* Remove unused SF_ThreadLocal.Rafael Espindola2014-02-042-2/+1
| | | | llvm-svn: 200800
* Simplify getSymbolFlags.Rafael Espindola2014-01-312-12/+8
| | | | | | | None of the object formats require extra parsing to compute these flags, so the method cannot fail. llvm-svn: 200574
* Only ELF has a dynamic symbol table. Remove it from ObjectFile.Rafael Espindola2014-01-302-20/+0
| | | | | | | | | COFF has only one symbol table. MachO has a LC_DYSYMTAB, but that is not a symbol table, just extra info about the one symbol table (LC_SYMTAB). IR (coming soon) also has only one table. llvm-svn: 200488
* Simplify the handling of iterators in ObjectFile.Rafael Espindola2014-01-303-70/+24
| | | | | | | | | | | | None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. llvm-svn: 200442
* Make createObjectFile's signature a bit less error prone.Rafael Espindola2014-01-291-1/+1
| | | | | | | This will be better with c++11, but right now file_magic converts to bool, which makes the api really easy to misuse. llvm-svn: 200357
* llvm-readobj: add support for PE32+ (Windows 64 bit executable).Rui Ueyama2014-01-261-14/+33
| | | | | | | | | | | | PE32+ supports 64 bit address space, but the file format remains 32 bit. So its file format is pretty similar to PE32 (32 bit executable). The differences compared to PE32 are (1) the lack of "BaseOfData" field and (2) some of its data members are 64 bit. In this patch, I added a new member function to get a PE32+ Header object to COFFObjectFile class and made llvm-readobj to use it. llvm-svn: 200117
* [Sparc] Add support for sparc relocation types in ELF object file.Venkatraman Govindaraju2014-01-261-0/+92
| | | | llvm-svn: 200112
* Make ObjectFile ownership of the MemoryBuffer optional.Rafael Espindola2014-01-245-36/+50
| | | | | | This allows llvm-ar to mmap the input files only once. llvm-svn: 200040
* Pass the computed magic to createBinary and createObjectFile if available.Rafael Espindola2014-01-222-12/+14
| | | | | | | identify_magic is not free, so we should avoid calling it twice. The argument also makes it cheap for createBinary to just forward to createObjectFile. llvm-svn: 199813
* Change createObjectFile to return an ErrorOr.Rafael Espindola2014-01-222-15/+13
| | | | llvm-svn: 199776
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-217-75/+74
| | | | | | | | | | | | | | | | | | | | | | | 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
* 80-column.Rui Ueyama2014-01-171-3/+6
| | | | llvm-svn: 199519
* llvm-objdump/COFF: Print ordinal base number.Rui Ueyama2014-01-171-0/+6
| | | | llvm-svn: 199518
* llvm-objdump/COFF: Print DLL name in the export table header.Rui Ueyama2014-01-161-1/+11
| | | | llvm-svn: 199422
* Use static instead of anonymous namespace.Rui Ueyama2014-01-161-8/+4
| | | | llvm-svn: 199419
* Reduce nesting.Rui Ueyama2014-01-161-13/+11
| | | | llvm-svn: 199418
* Use the current local variable naming style.Rui Ueyama2014-01-161-244/+242
| | | | llvm-svn: 199417
* llmv-objdump/COFF: Print export table contents.Rui Ueyama2014-01-161-3/+95
| | | | | | | | | | | | | | | | This patch adds the capability to dump export table contents. An example output is this: Export Table: Ordinal RVA Name 5 0x2008 exportfn1 6 0x2010 exportfn2 By adding this feature to llvm-objdump, we will be able to use it to check export table contents in LLD's tests. Currently we are doing binary comparison in the tests, which is fragile and not readable to humans. llvm-svn: 199358
* Don't use DataRefImpl to implement ImportDirectoryEntryRef.Rui Ueyama2014-01-161-37/+17
| | | | | | | | | DataRefImpl (a union of two integers and a pointer) is not the ideal data type to represent a reference to an import directory entity. We should just use the pointer to the import table and an offset instead to simplify. No functionality change. llvm-svn: 199349
* Return an ErrorOr<Binary *> from createBinary.Rafael Espindola2014-01-152-34/+29
| | | | | | | | 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
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-073-3/+2
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* Support for microMIPS TLS relocations.Zoran Jovanovic2013-12-191-0/+2
| | | | llvm-svn: 197685
* Fix a pair of array index checks.Eric Christopher2013-12-061-2/+5
| | | | | | Patch by Marius Wachtler. llvm-svn: 196560
* Path: Recognize COFF import library file magic.Rui Ueyama2013-11-152-0/+2
| | | | | | | | | | | | Summary: Make identify_magic to recognize COFF import file. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2165 llvm-svn: 194852
* Readobj: If NumbersOfSections is 0xffff, it's an COFF import library.Rui Ueyama2013-11-151-4/+7
| | | | | | | | 0xffff does not mean that there are 65535 sections in a COFF file but indicates that it's a COFF import library. This patch fixes SEGV error when an import library file is passed to llvm-readobj. llvm-svn: 194844
* Support for microMIPS branch instructions.Zoran Jovanovic2013-11-041-0/+1
| | | | llvm-svn: 193992
* move getSymbolNMTypeChar to the one program that needs it: nm.Rafael Espindola2013-11-022-105/+0
| | | | llvm-svn: 193933
* Convert another use of getSymbolNMTypeChar.Rafael Espindola2013-11-021-5/+9
| | | | llvm-svn: 193932
* Avoid some getSymbolNMTypeChar uses in COFFObjectFile.cpp itself.Rafael Espindola2013-11-021-12/+6
| | | | | | This is a fixed version of 193928 which keeps these uses in sync. llvm-svn: 193931
* Revert "Don't use getSymbolNMTypeChar for implementing ↵Rafael Espindola2013-11-021-2/+4
| | | | | | | | | | COFFObjectFile::getSymbolFileOffset." Investigating a bot failure. This reverts commit r193928. llvm-svn: 193929
* Don't use getSymbolNMTypeChar for implementing ↵Rafael Espindola2013-11-021-4/+2
| | | | | | COFFObjectFile::getSymbolFileOffset. llvm-svn: 193928
* Fix llvm-nm to mach OS X's nm on some tests.Rafael Espindola2013-11-021-6/+17
| | | | | | | There is still a long way to go for llvm-nm, but at least we now match nm's letter output in the cases we test for. llvm-svn: 193912
* Support for microMIPS jump instructionsZoran Jovanovic2013-10-291-0/+1
| | | | llvm-svn: 193623
* Support for microMIPS relocations 1.Zoran Jovanovic2013-10-231-0/+11
| | | | llvm-svn: 193247
* Path: Recognize Windows compiled resource file.Rui Ueyama2013-10-152-1/+3
| | | | | | | | | | | | | | Some background: One can pass compiled resource files (.res files) directly to the linker on Windows. If a resource file is given, the linker will run "cvtres" command in background to convert the resource file to a COFF file to link it. What I'm trying to do with this patch is to make the linker to recognize the resource file by file magic, so that it can run cvtres command. Differential Revision: http://llvm-reviews.chandlerc.com/D1943 llvm-svn: 192742
* Add missing #include's to cctype when using isdigit/alpha/etc.Will Dietz2013-10-122-0/+2
| | | | llvm-svn: 192519
* Object/COFF: Rename getXXX{Begin,End} -> xxx_{begin,end}.Rui Ueyama2013-09-272-10/+10
| | | | | | | It is mentioned in the LLVM coding standard that _begin() and _end() suffixes should be used. llvm-svn: 191569
* Re-submit r191472 with a fix for big endian.Rui Ueyama2013-09-271-30/+166
| | | | | llvm-objdump: Dump COFF import table if -private-headers option is given. llvm-svn: 191557
* Revert "llvm-objdump: Dump COFF import table if -private-headers option is ↵Rui Ueyama2013-09-271-166/+30
| | | | | | | | given." This reverts commit r191472 because it's failing on BE machine. llvm-svn: 191480
* llvm-objdump: Dump COFF import table if -private-headers option is given.Rui Ueyama2013-09-271-30/+166
| | | | | | | | | | | | | | | | This is a patch to add capability to llvm-objdump to dump COFF Import Table entries, so that we can write tests for LLD checking Import Table contents. llvm-objdump did not print anything but just file name if the format is COFF and -private-headers option is given. This is a patch adds capability for dumping DLL Import Table, which is specific to the COFF format. In this patch I defined a new iterator to iterate over import table entries. Also added a few functions to COFFObjectFile.cpp to access fields of the entry. Differential Revision: http://llvm-reviews.chandlerc.com/D1719 llvm-svn: 191472
* ELF: Add support for the exclude section bit for gas compat.Benjamin Kramer2013-09-151-0/+1
| | | | llvm-svn: 190769
* Move everything depending on Object/MachOFormat.h over to Support/MachO.h.Charles Davis2013-09-012-395/+401
| | | | llvm-svn: 189728
* Revert "Fix the build broken by r189315." and "Move everything depending on ↵Charles Davis2013-08-272-403/+397
| | | | | | | | | Object/MachOFormat.h over to Support/MachO.h." This reverts commits r189319 and r189315. r189315 broke some tests on what I believe are big-endian platforms. llvm-svn: 189321
* Move everything depending on Object/MachOFormat.h over to Support/MachO.h.Charles Davis2013-08-272-397/+403
| | | | llvm-svn: 189315
* Support/MachO: Add a bunch of defines.Charles Davis2013-08-271-26/+26
| | | | | | | | Right now we have two headers for the Mach-O format. I'd like to get rid of one. Since the other object formats are all in Support, I chose to keep the Mach-O header in Support, and discard the other one. llvm-svn: 189314
* Move #includes from .h to .cpp file.Jakub Staszak2013-08-211-0/+2
| | | | llvm-svn: 188852
* Add back missing PPC relocation types.Ulrich Weigand2013-08-091-0/+36
| | | | llvm-svn: 188064
OpenPOWER on IntegriCloud