aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-readobj
AgeCommit message (Collapse)AuthorFilesLines
2015-01-03llvm-readobj: add support to dump COFF export tablesSaleem Abdulrasool3-0/+28
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-25Correctly handle Tag_CPU_arch_profile.Charlie Turner1-1/+1
Fix ARMAttributeParser::CPU_arch_profile so that it doesn't switch on the value '0' as a legal value of this build attribute. Change-Id: Ie05a08900a82bb10b78c841b437df747ce3bb38e llvm-svn: 222743
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 Ueyama3-1/+40
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-17Implement MachODumper::printFileHeadersFrederic Riss1-1/+175
Patch by Chilledheart. Differential Revision: http://reviews.llvm.org/D6163 llvm-svn: 222115
2014-11-13llvm-readobj: relocAddressLess could potentially lieDavid Majnemer1-2/+2
On error conditions, relocAddressLess might claim that a value is less than itself. Instead, abort llvm-readobj. No functionality change intended. llvm-svn: 221872
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-11-03MSVC requires redeclarations to repeat noexceptReid Kleckner1-1/+1
llvm-svn: 221177
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-17Add a test that would have found the bug in r219829.Rafael Espindola1-1/+2
llvm-svn: 220016
2014-10-17Revert commit r219835 and r219829.Rafael Espindola1-2/+1
Revert "Correctly handle references to section symbols." Revert "Allow forward references to section symbols." Rui found a regression I am debugging. llvm-svn: 220010
2014-10-15Correctly handle references to section symbols.Rafael Espindola1-1/+2
When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. llvm-svn: 219829
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 Espindola3-18/+6
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 Abdulrasool3-0/+27
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 Ueyama3-0/+24
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 Majnemer3-5/+11
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-11Support: Delete {aligned_,}{u,}{little,big}8_tRui Ueyama2-49/+46
The byte has no endianness, so these types don't make sense. uint8_t should be used instead. llvm-svn: 217631
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 Topper2-12/+12
llvm-svn: 216823
2014-08-27Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper1-8/+8
just letting them be implicitly created. llvm-svn: 216525
2014-08-19Don't own the buffer in object::Binary.Rafael Espindola1-2/+2
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
2014-08-13Canonicalize header guards into a common format.Benjamin Kramer8-16/+16
Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
2014-08-08getLoadName is only implemented for ELF, make it ELF only.Rafael Espindola1-1/+13
llvm-svn: 215219
2014-08-01Remove some calls to std::move.Rafael Espindola1-3/+3
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
2014-07-31Use std::unique_ptr to make the ownership explicit.Rafael Espindola1-2/+2
llvm-svn: 214377
2014-07-13[Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,Simon Atanasyan1-0/+1
obj2yaml and yaml2obj tools. llvm-svn: 212908
2014-07-05[llvm-readobj] Fix output of MIPS GOT without local and global entries.Simon Atanasyan1-1/+1
llvm-svn: 212374
2014-07-04llvm-readobj: fix MachO relocatoin printing a bit.Tim Northover1-6/+18
There were two issues here: 1. At the very least, scattered relocations cannot use the same code to determine the corresponding symbol being referred to. For some reason we pretend there is no symbol, even when one actually exists in the symtab, so to match this behaviour getRelocationSymbol should simply return symbols_end for scattered relocations. 2. Printing "-" when we can't get a symbol (including the scattered case, but not exclusively), isn't that helpful. In both cases there *is* interesting information in that field, so we should print it. As hex will do. Small part of rdar://problem/17553104 llvm-svn: 212332
2014-07-01Rephrase loop so it doesn't leave unused bools around in Release mode.Benjamin Kramer1-4/+2
llvm-svn: 212102
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-26Revert "Introduce a string_ostream string builder facilty"Alp Toker2-3/+4
Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
2014-06-26Introduce a string_ostream string builder faciltyAlp Toker2-4/+3
string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
2014-06-18[llvm-readobj] Fix member functions name style.Simon Atanasyan1-13/+13
llvm-svn: 211152
2014-06-18[llvm-readobj] Fix compile error.Simon Atanasyan1-1/+1
llvm-svn: 211151
2014-06-18[llvm-readobj][ELF] New `-mips-plt-got` command line option to outputSimon Atanasyan4-0/+241
MIPS GOT section. Patch reviewed by Rafael Espindola. llvm-svn: 211150