aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-06-29Remove Elf_Sym_Iter.Rafael Espindola1-2/+5
It was a fairly broken concept for an ELF only class. An ELF file can have two symbol tables, but they have exactly the same format. There is no concept of a dynamic or a static symbol. Storing this on the iterator also makes us do more work per symbol than necessary. To fetch a name we would: * Find if we had a static or a dynamic symbol. * Look at the corresponding symbol table and find the string table section. * Look at the string table section to fetch its contents. * Compute the name as a substring of the string table. All but the last step can be done per symbol table instead of per symbol. This is a step in that direction. llvm-svn: 240939
2015-06-26Rename getObjectFile to getObject for consistency.Rafael Espindola1-1/+1
llvm-svn: 240785
2015-06-26Simplify getSymbolType.Rafael Espindola1-3/+1
This is still a really odd function. Most calls are in object format specific contexts and should probably be replaced with a more direct query, but at least now this is not too obnoxious to use. llvm-svn: 240777
2015-06-25Add an ELFSymbolRef type.Rafael Espindola1-2/+2
This allows user code to say Sym.getSize() instead of having to manually fetch the object. llvm-svn: 240708
2015-06-24Change how symbol sizes are handled in lib/Object.Rafael Espindola1-4/+5
COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
2015-06-23Revert "[FaultMaps] Move FaultMapParser to Object/"Sanjoy Das1-1/+1
This reverts commit r240364 (git c49542e5bb186). The issue r240364 was trying to fix was fixed independently in r240362. llvm-svn: 240448
2015-06-23Don't pass a 32 bit value to "%08" PRIx64.Rafael Espindola1-4/+4
Should fix the arm bots. llvm-svn: 240439
2015-06-23objdump: Don't print a (always 0) size for MachO symbols.Rafael Espindola1-10/+10
Only common symbol on MachO and COFF have a size. For COFF we already had a custom format. For MachO, there is no native objdump and we were printing it as ELF. Now we only print the sizes for symbols that actually have them. llvm-svn: 240422
2015-06-23[FaultMaps] Move FaultMapParser to Object/Sanjoy Das1-1/+1
Summary: That way llvm-objdump can rely on it without adding an extra dependency on CodeGen. This change duplicates the FaultKind enum and the code that serializes it to a string. I could not figure out a way to get around this without adding a new dependency to Object Reviewers: rafael, ab Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10619 llvm-svn: 240364
2015-06-22[FaultMaps] Add a parser for the __llvm__faultmaps section.Sanjoy Das1-1/+52
Summary: The parser is exercised by llvm-objdump using -print-fault-maps. As is probably obvious, the code itself was "heavily inspired" by http://reviews.llvm.org/D10434. Reviewers: reames, atrick, JosephTremoulet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10491 llvm-svn: 240304
2015-06-09Remove object_error::success and use std::error_code() insteadRui Ueyama1-4/+4
make_error_code(object_error) is slow because object::object_category() uses a ManagedStatic variable. But the real problem is that the function is called too frequently. This patch uses std::error_code() instead of object_error::success. In most cases, we return "success", so this patch reduces number of function calls to that function. http://reviews.llvm.org/D10333 llvm-svn: 239409
2015-06-07[objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and ↵Colin LeMahieu1-0/+5
setting instprinter appropriately. llvm-svn: 239265
2015-06-04llvm-objdump: return non-zero exit code for certain cases of invalid inputAlexey Samsonov1-7/+12
* If the input file is missing; * If the type of input object file can't be recognized; * If the object file can't be parsed correctly. llvm-svn: 239065
2015-06-04Disassemble the start of sections even if there is no symbol there.Rafael Espindola1-5/+3
We already handled a section with no symbols, extend that to also handle a section with symbols that don't include the section start. llvm-svn: 239039
2015-06-03Fix the interpretation of a 0 st_name.Rafael Espindola1-11/+24
The ELF spec is very clear: ----------------------------------------------------------------------------- If the value is non-zero, it represents a string table index that gives the symbol name. Otherwise, the symbol table entry has no name. -------------------------------------------------------------------------- In particular, a st_name of 0 most certainly doesn't mean that the symbol has the same name as the section. llvm-svn: 238899
2015-06-03Move to llvm-objdump a large amount of code to that is only used there.Rafael Espindola1-3/+382
llvm-svn: 238898
2015-06-01Simplify another function that doesn't fail.Rafael Espindola1-3/+1
llvm-svn: 238703
2015-05-31Simplify interface of function that doesn't fail.Rafael Espindola1-3/+1
llvm-svn: 238700
2015-05-29[Objdump] Removing unused parameter.Colin LeMahieu1-2/+2
llvm-svn: 238557
2015-05-29[Hexagon] Disassembling, printing, and emitting instructions a whole-bundle ↵Colin LeMahieu1-3/+61
at a time which is the semantic unit for Hexagon. Fixing tests to use the new format. Disabling tests in the direct object emission path for a followup patch. llvm-svn: 238556
2015-05-29Removing a switch statement that only contains a default; NFC.Aaron Ballman1-4/+1
llvm-svn: 238552
2015-05-28[llvm] Adding vdtor to fix warning.Colin LeMahieu1-0/+1
llvm-svn: 238494
2015-05-28[Objdump] Allow instruction pretty printing to be specialized by the target ↵Colin LeMahieu1-6/+28
triple. Differential Revision: http://reviews.llvm.org/D8427 llvm-svn: 238457
2015-05-28[llvm] Parameterizing the output stream for dumpbytes and outputting ↵Colin LeMahieu1-14/+1
directly to stream. llvm-svn: 238453
2015-04-30[Object] Teach Object and llvm-objdump about ".hidden"Davide Italiano1-2/+6
Differential Revision: http://reviews.llvm.org/D9416 Reviewed by: rafael llvm-svn: 236279
2015-04-01Add the option -objc-meta-data to llvm-objdump used with -macho toKevin Enderby1-0/+1
print the Objective-C runtime meta data for Mach-O files. There are three types of Objective-C runtime meta data, Objc2 64-bit, Objc2 32-bit and Objc1 32-bit. This prints the first of these types. The changes to print the others will follow next. llvm-svn: 233840
2015-03-31Replace the MCSubtargetInfo parameter with a Triple when creatingEric Christopher1-1/+1
an MCInstPrinter. Update all callers and use where we wanted a Triple previously. llvm-svn: 233648
2015-03-27[MCInstPrinter] Enable MCInstPrinter to change its behavior based on theAkira Hatanaka1-1/+1
per-function subtarget. Currently, code-gen passes the default or generic subtarget to the constructors of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which enables some targets (AArch64, ARM, and X86) to change their instprinter's behavior based on the subtarget feature bits. Since the backend can now use different subtargets for each function, instprinter has to be changed to use the per-function subtarget rather than the default subtarget. This patch takes the first step towards enabling instprinter to change its behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the various print methods table-gen auto-generates. I will follow up with changes to instprinters of AArch64, ARM, and X86. llvm-svn: 233411
2015-03-18[Objdump] DumpBytes of uint8_t from ArrayRef<uint8_t> instead of char from ↵Colin LeMahieu1-3/+2
StringRef. Removing reinterpret_casts. llvm-svn: 232659
2015-03-18[Objdump] Removing size limit on DumpBytes and changing to range based for loop.Colin LeMahieu1-20/+7
llvm-svn: 232654
2015-03-16Add the options, -dylibs-used and -dylib-id to llvm-objdump used with -machoKevin Enderby1-0/+2
to print the Mach-O dynamic shared libraries used by a linked image or the library id of a shared library. llvm-svn: 232406
2015-03-11Add the option, -info-plist to llvm-objdump used with -macho to print theKevin Enderby1-0/+1
Mach-O info plist section as strings. llvm-svn: 231974
2015-01-31Add the -section option to llvm-objdump used with -macho that takes the argumentKevin Enderby1-1/+2
segname,sectname to specify a Mach-O section to print. The printing is based on the section type or section attributes. The printing of the module initialization and termination section types is printed with this change. Printing of other section types will be added next. llvm-svn: 227649
2015-01-27dd the option, -link-opt-hints to llvm-objdump used with -macho to print theKevin Enderby1-1/+2
Mach-O AArch64 linker optimization hints for ADRP code optimization. llvm-svn: 227246
2015-01-23[Objdump] Output information about common symbols in a way closer to GNU ↵Colin LeMahieu1-1/+11
objdump. llvm-svn: 226932
2015-01-23Add the option, -data-in-code, to llvm-objdump used with -macho to print the ↵Kevin Enderby1-1/+2
Mach-O data in code table. llvm-svn: 226921
2015-01-22Add the option, -indirect-symbols, used with -macho to print the Mach-O ↵Kevin Enderby1-1/+2
indirect symbol table to llvm-objdump. llvm-svn: 226848
2015-01-20For llvm-objdump, hook up existing options to work when using -macho (the ↵Kevin Enderby1-15/+15
Mach-O parser). llvm-svn: 226612
2015-01-15Add the option, -archive-headers, used with -macho to print the Mach-O ↵Kevin Enderby1-1/+2
archive headers to llvm-objdump. llvm-svn: 226228
2015-01-09Add the option, -universal-headers, used with -macho to print the Mach-O ↵Kevin Enderby1-1/+2
universal headers to llvm-objdump. llvm-svn: 225537
2015-01-07Slightly refactor things for llvm-objdump and the -macho option so it can be ↵Kevin Enderby1-22/+25
used with options other than just -disassemble so that universal files can be used with other options combined with -arch options. No functional change to existing options and use. One test case added for the additional functionality with a universal file an a -arch option. llvm-svn: 225383
2014-12-17Remove unused includes and out of date comment. NFC.Rafael Espindola1-1/+0
llvm-svn: 224413
2014-12-04Re-add support to llvm-objdump for Mach-O universal files and archives with ↵Kevin Enderby1-1/+1
-macho with fixes. Includes the move of tests for llvm-objdump for universal files to an X86 directory. And the fix where it was failing on linux Rafael tracked down with asan. I had both Jim Grosbach and Adam Hemet look over the second fix since I could not set up asan to reproduce with the old version but not with the fix. llvm-svn: 223416
2014-12-03This reverts commit r223306 and r223277.Rafael Espindola1-1/+1
The code is using uninitialized memory and failing on linux. llvm-svn: 223315
2014-12-03Add support to llvm-objdump for Mach-O universal files and archives with -macho.Kevin Enderby1-1/+1
llvm-svn: 223277
2014-11-26Object/COFF: Fix off-by-one error for object having lots of relocationsRui Ueyama1-1/+3
llvm-objdump printed out an error message for this off-by-one error, but because it always exits with 0 whether or not it found an error, the test (llvm-objdump/coff-many-relocs.test) succeeded. I made llvm-objdump exit with EXIT_FAILURE when an error is found. llvm-svn: 222852
2014-11-17Object, COFF: Tighten the object file parserDavid Majnemer1-2/+1
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-12Fixing more -Wcast-qual warnings; NFC.Aaron Ballman1-2/+4
llvm-svn: 221782
2014-11-12Pass an ArrayRef to MCDisassembler::getInstruction.Rafael Espindola1-7/+8
With this patch MCDisassembler::getInstruction takes an ArrayRef<uint8_t> instead of a MemoryObject. Even on X86 there is a maximum size an instruction can have. Given that, it seems way simpler and more efficient to just pass an ArrayRef to the disassembler instead of a MemoryObject and have it do a virtual call every time it wants some extra bytes. llvm-svn: 221751
2014-11-11llvm-objdump: Skip empty sections when dumping contentsDavid Majnemer1-3/+6
Empty sections are just noise when using objdump. This is similar to what binutils does. llvm-svn: 221680