aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-readobj/COFFDumper.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-01-03llvm-readobj: add support to dump COFF export tablesSaleem Abdulrasool1-0/+21
This enhances llvm-readobj to print out the COFF export table, similar to the -coff-import option. This is useful for testing in lld. llvm-svn: 225120
2014-11-19[llvm-readobj][NFC]Colin LeMahieu1-1/+2
Appeasing mingw without C++11 std::to_string llvm-svn: 222369
2014-11-19llvm-readobj: fix off-by-one error in COFFDumperRui Ueyama1-4/+1
It printed out base relocation table header as table entry. This patch also makes llvm-readobj to not skip ABSOLUTE entries becuase it was confusing. llvm-svn: 222299
2014-11-19llvm-readobj: teach it how to dump COFF base relocation tableRui Ueyama1-0/+31
llvm-svn: 222289
2014-11-18llvm-readobj: Don't print the Characteristics field as the SubsystemDavid Majnemer1-1/+1
We claimed that we were printing the Subystem field when we were actually printing the Characteristics field. llvm-svn: 222216
2014-11-17Object, COFF: Tighten the object file parserDavid Majnemer1-14/+22
We were a little lax in a few areas: - We pretended that import libraries were like any old COFF file, they are not. In fact, they aren't really COFF files at all, we should probably grow some specialized functionality to handle them smarter. - Our symbol iterators were more than happy to attempt to go past the end of the symbol table if you had a symbol with a bad list of auxiliary symbols. llvm-svn: 222124
2014-11-13llvm-readobj, COFF: Remove an unused variableDavid Majnemer1-3/+0
printRelocation doesn't use the section contents. No functionality change intended. llvm-svn: 221871
2014-11-13Object, COFF: getRelocationSymbol shouldn't assertDavid Majnemer1-3/+3
lib/Object is supposed to be robust to malformed object files. Don't assert if we don't have a symbol table. I'll try to come up with a test case later. llvm-svn: 221870
2014-11-13llvm-readobj: Print out address table when dumping COFF delay-import tableRui Ueyama1-1/+21
llvm-svn: 221855
2014-11-12[COFF] Make it clearer that the symbols subsection holds function display ↵Timur Iskhodzhanov1-2/+2
name rather than just name llvm-svn: 221812
2014-11-05llvm-readobj: Add support for dumping the DOS header in PE filesDavid Majnemer1-0/+25
llvm-svn: 221333
2014-10-31Object, COFF: Cleanup symbol type code, improve binutils compatibilityDavid Majnemer1-1/+1
Do a better job classifying symbols. This increases the consistency between the COFF handling code and the ELF side of things. llvm-svn: 220952
2014-10-23PR21189: Teach llvm-readobj to dump bits of COFF symbol subsections required ↵Timur Iskhodzhanov1-0/+82
to debug using VS2012+ Reviewed at http://reviews.llvm.org/D5755 Thanks to Andrey Guskov for his help investigating this! llvm-svn: 220526
2014-10-09Object: Add range iterators for COFF import/export tableRui Ueyama1-21/+15
llvm-svn: 219383
2014-10-08Remove bogus std::error_code returns form SectionRef.Rafael Espindola1-2/+1
There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
2014-10-07llvm-readobj: add support to dump (COFF) directivesSaleem Abdulrasool1-0/+19
PE/COFF has a special section (.drectve) which can be used to pass options to the linker (similar to LC_LINKER_OPTION). Add support to llvm-readobj to print the contents of the section for tests. llvm-svn: 219228
2014-10-06Fix dumping codeview line tables when there are multiple debug sectionsTimur Iskhodzhanov1-10/+10
Codeview line tables for functions in different sections refer to a common STRING_TABLE_SUBSECTION for filenames. This happens when building with -Gy or with inline functions with MSVC. Original patch by Jeff Muizelaar! llvm-svn: 219125
2014-10-03llvm-readobj: print out the fields of the COFF delay-import tableRui Ueyama1-0/+8
llvm-svn: 218996
2014-10-03llvm-readobj: print COFF delay-load import tableRui Ueyama1-8/+27
This patch adds another iterator to access the delay-load import table and use it from llvm-readobj. http://reviews.llvm.org/D5594 llvm-svn: 218933
2014-10-02llvm-readobj: print COFF imported symbolsRui Ueyama1-0/+8
This patch defines a new iterator for the imported symbols. Make a change to COFFDumper to use that iterator to print out imported symbols and its ordinals. llvm-svn: 218915
2014-10-02This patch adds a new flag "-coff-imports" to llvm-readobj.Rui Ueyama1-0/+15
When the flag is given, the command prints out the COFF import table. Currently only the import table directory will be printed. I'm going to make another patch to print out the imported symbols. The implementation of import directory entry iterator in COFFObjectFile.cpp was buggy. This patch fixes that too. http://reviews.llvm.org/D5569 llvm-svn: 218891
2014-09-26Object: BSS/virtual sections don't have contentsDavid Majnemer1-1/+2
Users of getSectionContents shouldn't try to pass in BSS or virtual sections. In all instances, this is a bug in the code calling this routine. N.B. Some COFF implementations (like CL) will mark their BSS sections as taking space on disk. This would confuse COFFObjectFile into thinking the section is larger than the file. llvm-svn: 218549
2014-09-20llvm-readobj: pretty-print special COFF section namesDavid Majnemer1-3/+19
Print IMAGE_SYM_DEBUG and the like instead of (-2). llvm-svn: 218172
2014-09-15MC: Add support for BigObjDavid Majnemer1-3/+5
Teach WinCOFFObjectWriter how to write -mbig-obj style object files; these object files allow for more sections inside an object file. Our support for BigObj is notably different from binutils and cl: we implicitly upgrade object files to BigObj instead of asking the user to compile the same file *again* but with another flag. This matches up with how LLVM treats ELF variants. This was tested by forcing LLVM to always emit BigObj files and running the entire test suite. A specific test has also been added. I've lowered the maximum number of sections in a normal COFF file, VS "14" CTP 3 supports no more than 65279 sections. This is important otherwise we might not switch to BigObj quickly enough, leaving us with a COFF file that we couldn't link. yaml2obj support is all that remains to implement. Differential Revision: http://reviews.llvm.org/D5349 llvm-svn: 217812
2014-09-10Object: Add support for bigobjDavid Majnemer1-55/+42
This adds support for reading the "bigobj" variant of COFF produced by cl's /bigobj and mingw's -mbig-obj. The most significant difference that bigobj brings is more than 2**16 sections to COFF. bigobj brings a few interesting differences with it: - It doesn't have a Characteristics field in the file header. - It doesn't have a SizeOfOptionalHeader field in the file header (it's only used in executable files). - Auxiliary symbol records have the same width as a symbol table entry. Since symbol table entries are bigger, so are auxiliary symbol records. Write support will come soon. Differential Revision: http://reviews.llvm.org/D5259 llvm-svn: 217496
2014-08-30Remove 'virtual' keyword from methods markedwith 'override' keyword.Craig Topper1-6/+6
llvm-svn: 216823
2014-06-27Support: update DLLCharacteristics enumerationSaleem Abdulrasool1-0/+2
Add the new AppContainer characteristic which is import for Windows Store (Metro) compatible applications. Add the new Control Flow Guard flag to bring the enumeration up to date with the current values as of Windows 8.1. llvm-svn: 211855
2014-06-13Remove 'using std::error_code' from tools.Rafael Espindola1-27/+29
llvm-svn: 210876
2014-06-13Remove all uses of 'using std::error_code' from headers.Rafael Espindola1-0/+1
llvm-svn: 210866
2014-06-12Remove system_error.h.Rafael Espindola1-2/+2
This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
2014-06-04tools: initial implementation of WoA EH decodingSaleem Abdulrasool1-0/+6
Add support to llvm-readobj to decode Windows ARM Exception Handling data. This uses the previously added datastructures to decode the information into a format that can be used by tests. This is a necessary step to add support for emitting Windows on ARM exception handling information. A fair amount of formatting inspiration is drawn from the Win64 EH printer as well as the ARM EHABI printer. This allows for a reasonably thorough look into the encoded data. llvm-svn: 210192
2014-05-25tools: avoid use of std::functionSaleem Abdulrasool1-4/+5
Remove the use of the std::function and replace the capturing lambda with a non-capturing one, opting to pass the user data down to the context. This is needed as std::function is not yet available on all hosted platforms (it requires RTTI, which breaks on Windows). Thanks to Nico Rieck for pointing this out! llvm-svn: 209607
2014-05-25tools: split out Win64EHDumper from COFFDumperSaleem Abdulrasool1-328/+16
Move the implementation of the Win64 EH printer from the COFFDumper into its own class. This is in preparation for adding support to print ARM EH information. The only real change here is in printUnwindInfo where we now lambda lift the implicit this parameter for the resolveFunction. Also setup the printing to handle ARM. This now has set the stage to introduce ARM EH printing. llvm-svn: 209606
2014-05-25tools: inline simple single-use functionSaleem Abdulrasool1-18/+6
This inlines the single use function in preparation for splitting the Win64EH printing out of the COFFDumper into its own entity. llvm-svn: 209605
2014-05-25tools: refactor COFFDumper symbol resolution logicSaleem Abdulrasool1-61/+69
Make the use of the cache more transparent to the users. There is no reason that the cached entries really need to be passed along. The overhead for doing so is minimal: a single extra parameter. This requires that some standalone functions be brought into the COFFDumper class so that they may access the cache. llvm-svn: 209604
2014-05-25tools: use references rather than out pointers in COFFDumperSaleem Abdulrasool1-18/+8
Switch to use references for parameters that are guaranteed to be non-null. Simplifies the code a slight bit in preparation for another change. llvm-svn: 209603
2014-05-24llvm-readobj: remove some dead codeSaleem Abdulrasool1-28/+0
llvm-svn: 209586
2014-05-20llvm-readobj: use range-based for loopSaleem Abdulrasool1-5/+3
Convert an additional site to a range based for loop. NFC. llvm-svn: 209194
2014-04-25[C++] Use 'nullptr'. Tools edition.Craig Topper1-6/+7
llvm-svn: 207176
2014-04-16tools: fix invalid printing, buffer overrun in llvm-readobjSaleem Abdulrasool1-0/+1
All auxiliary records are consumed when accessing a File record. llvm-svn: 206354
2014-04-14tools: address possible non-null terminated filenamesSaleem Abdulrasool1-1/+4
If a filename is a multiple of 18 characters, there will be no null-terminator. This will result in an invalid access by the constructed StringRef. Add a test case to exercise this and fix that handling. Address this same vulnerability in llvm-readobj as well. llvm-svn: 206145
2014-04-13tools: remove duplication of coff_aux_fileSaleem Abdulrasool1-9/+1
Now that COFF::coff_aux_file is defined, use that rather than redefining the type locally. llvm-svn: 206140
2014-03-19Object: Provide a richer means of describing auxiliary symbolsDavid Majnemer1-18/+5
The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 llvm-svn: 204214
2014-03-19Object: Move auxiliary symbol definitions from llvm-readobjDavid Majnemer1-26/+7
Summary: These definitions are useful to other aspects of LLVM, move them out. Reviewers: rafael, nrieck, ruiu CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3105 llvm-svn: 204213
2014-03-18Object/COFF: Add function to check if section number is reserved one.Rui Ueyama1-1/+1
Differential Revision: http://llvm-reviews.chandlerc.com/D3103 llvm-svn: 204199
2014-03-18[C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make ↵Alexey Samsonov1-51/+40
it work with range-based for loops. Reviewers: ruiu Reviewed By: ruiu CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3097 llvm-svn: 204120
2014-03-17llvm-readobj: Print referred symbol name for CLR token definitionNico Rieck1-1/+10
llvm-svn: 204024
2014-03-17llvm-readobj: Add test for COFF auxiliary symbols as used by C++/CLINico Rieck1-1/+3
llvm-svn: 204023
2014-03-14[C++11] Introduce SectionRef::relocations() to use range-based loopsAlexey Samsonov1-22/+20
Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3077 llvm-svn: 203927
2014-03-11Object: rename ARMV7 to ARMNTSaleem Abdulrasool1-1/+1
The official specifications state the name to be ARMNT (as per the Microsoft Portable Executable and Common Object Format Specification v8.3). llvm-svn: 203530