summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/COFFObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused SF_ThreadLocal.Rafael Espindola2014-02-041-1/+1
| | | | llvm-svn: 200800
* Simplify getSymbolFlags.Rafael Espindola2014-01-311-4/+3
| | | | | | | 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-301-10/+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-301-24/+8
| | | | | | | | | | | | 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
* 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
* Make ObjectFile ownership of the MemoryBuffer optional.Rafael Espindola2014-01-241-7/+9
| | | | | | This allows llvm-ar to mmap the input files only once. llvm-svn: 200040
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-211-8/+11
| | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* 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
* move getSymbolNMTypeChar to the one program that needs it: nm.Rafael Espindola2013-11-021-68/+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
* Add missing #include's to cctype when using isdigit/alpha/etc.Will Dietz2013-10-121-0/+1
| | | | llvm-svn: 192519
* Object/COFF: Rename getXXX{Begin,End} -> xxx_{begin,end}.Rui Ueyama2013-09-271-4/+4
| | | | | | | 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
* Retry submitting r186623: COFFDumper: Dump data directory entries.Rui Ueyama2013-07-191-37/+49
| | | | | | | | The original change was rolled back in r186627 because of test failures on the big endian machine. I believe I fixed the issue so re-submitting. llvm-svn: 186734
* Revert "COFFDumper: Dump data directory entries."Rui Ueyama2013-07-181-46/+36
| | | | | | Because it broke s390x and ppc64-linux buildbots. This reverts commit r186623. llvm-svn: 186627
* COFFDumper: Dump data directory entries.Rui Ueyama2013-07-181-36/+46
| | | | | | | | | | | | | | | | | Summary: Dump optional data directory entries in the PE/COFF header, so that we can test the output of LLD linker. This patch updates the test binary file, but the source of the binary is the same. I just re-linked the file. I don't know how the previous file was linked, but the previous file did not have any data directory entries for some reason. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1148 llvm-svn: 186623
* readobj: Dump PE/COFF optional records.Rui Ueyama2013-06-121-36/+63
| | | | | | | | | | | | These records are mandatory for executables and are used by the loader. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D939 llvm-svn: 183852
* Handle relocations that don't point to symbols.Rafael Espindola2013-06-051-4/+2
| | | | | | | | In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols. llvm-svn: 183284
* Change getRelocationAdditionalInfo to be ELF only.Rafael Espindola2013-05-091-5/+0
| | | | | | | It was only implemented for ELF where it collected the Addend, so this patch also renames it to getRelocationAddend. llvm-svn: 181502
* Clarify getRelocationAddress x getRelocationOffset a bit.Rafael Espindola2013-04-251-2/+1
| | | | | | | | | | getRelocationAddress is for dynamic libraries and executables, getRelocationOffset for relocatable objects. Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a test of ELF's. llvm-readobj -r now prints the same values as readelf -r. llvm-svn: 180259
* Remove unused argument.Rafael Espindola2013-04-071-1/+1
| | | | llvm-svn: 178987
* Add static cast to unsigned char whenever a character classification ↵Guy Benyei2013-02-121-1/+1
| | | | | | function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
* Add interface for querying object files for symbol values.Tim Northover2012-10-291-0/+5
| | | | | | | | Currently only implemented for ELF. Patch by Amara Emerson. llvm-svn: 166918
* Cosmetic changesAndrew Kaylor2012-10-101-1/+1
| | | | llvm-svn: 165588
* This patch adds new functions to the SectionRef and ObjectFile interfaces to ↵Andrew Kaylor2012-10-101-0/+7
| | | | | | | | determine whether or not a section is meant to be read-only. These functions will be used by the MCJIT RuntimeDyld to give hints to the memory manager during the object loading process in a future patch. Patch by Ashok Thirumurthi. llvm-svn: 165586
* Added accessors for getting coff_relocation infoMarshall Clow2012-06-181-0/+5
| | | | llvm-svn: 158675
* Had a closing brace inside an #ifdef -- oops!Marshall Clow2012-06-151-1/+1
| | | | llvm-svn: 158485
* Adding acessors to COFFObjectFile so that clients can get at the ↵Marshall Clow2012-06-151-0/+31
| | | | | | (non-generic) bits llvm-svn: 158484
* This patch improves the MCJIT runtime dynamic loader by adding new handlingPreston Gurd2012-04-121-0/+21
| | | | | | | | | | of zero-initialized sections, virtual sections and common symbols and preventing the loading of sections which are not required for execution such as debug information. Patch by Andy Kaylor! llvm-svn: 154610
* Add a constructor for DataRefImpl and remove excess initialization.Danil Malyshev2012-04-101-9/+0
| | | | llvm-svn: 154371
* [Object/COFF]: Expose getSectionContents.Michael J. Spencer2012-03-191-10/+19
| | | | llvm-svn: 153051
* [Object/COFF]: Expose getSectionName.Michael J. Spencer2012-03-191-19/+24
| | | | | | Also add some documentation. llvm-svn: 153050
* Fix bug found by warning.Michael J. Spencer2012-03-151-1/+2
| | | | llvm-svn: 152812
* [Object]David Meyer2012-03-091-1/+1
| | | | | | Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big llvm-svn: 152435
* [Object]David Meyer2012-03-011-0/+6
| | | | | | Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object. llvm-svn: 151845
* [Object]David Meyer2012-03-011-0/+20
| | | | | | | | | * Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile. * Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable. * Implement this new interface completely for ELF, leave stubs for COFF and MachO. * Add 'llvm-readobj' tool for dumping ObjectFile information. llvm-svn: 151785
* [Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ↵David Meyer2012-02-291-2/+6
| | | | | | | | | ST_Undefined. Implement these completely for ELF. Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type is unknown, not that the symbol is undefined. (For that, use ST_Undefined). llvm-svn: 151696
OpenPOWER on IntegriCloud