summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert obj->getSymbolName to sym->getName.Rafael Espindola2015-06-291-1/+1
| | | | | | I doesn't depend on the object anymore. llvm-svn: 240996
* Factor out the checking of string tables.Rafael Espindola2015-06-291-1/+5
| | | | | | | | | | This moves the error checking for string tables to getStringTable which returns an ErrorOr<StringRef>. This improves error checking, makes it uniform across all string tables and makes it possible to check them once instead of once per name. llvm-svn: 240950
* Remove Elf_Sym_Iter.Rafael Espindola2015-06-291-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
* Rename getObjectFile to getObject for consistency.Rafael Espindola2015-06-261-1/+1
| | | | llvm-svn: 240785
* Simplify getSymbolType.Rafael Espindola2015-06-261-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
* Add an ELFSymbolRef type.Rafael Espindola2015-06-251-2/+2
| | | | | | | This allows user code to say Sym.getSize() instead of having to manually fetch the object. llvm-svn: 240708
* Change how symbol sizes are handled in lib/Object.Rafael Espindola2015-06-241-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
* Revert "[FaultMaps] Move FaultMapParser to Object/"Sanjoy Das2015-06-231-1/+1
| | | | | | | This reverts commit r240364 (git c49542e5bb186). The issue r240364 was trying to fix was fixed independently in r240362. llvm-svn: 240448
* Don't pass a 32 bit value to "%08" PRIx64.Rafael Espindola2015-06-231-4/+4
| | | | | | Should fix the arm bots. llvm-svn: 240439
* objdump: Don't print a (always 0) size for MachO symbols.Rafael Espindola2015-06-231-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
* [FaultMaps] Move FaultMapParser to Object/Sanjoy Das2015-06-231-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
* [FaultMaps] Add a parser for the __llvm__faultmaps section.Sanjoy Das2015-06-221-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
* Remove object_error::success and use std::error_code() insteadRui Ueyama2015-06-091-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
* [objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and ↵Colin LeMahieu2015-06-071-0/+5
| | | | | | setting instprinter appropriately. llvm-svn: 239265
* llvm-objdump: return non-zero exit code for certain cases of invalid inputAlexey Samsonov2015-06-041-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
* Disassemble the start of sections even if there is no symbol there.Rafael Espindola2015-06-041-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
* Fix the interpretation of a 0 st_name.Rafael Espindola2015-06-031-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
* Move to llvm-objdump a large amount of code to that is only used there.Rafael Espindola2015-06-031-3/+382
| | | | llvm-svn: 238898
* Simplify another function that doesn't fail.Rafael Espindola2015-06-011-3/+1
| | | | llvm-svn: 238703
* Simplify interface of function that doesn't fail.Rafael Espindola2015-05-311-3/+1
| | | | llvm-svn: 238700
* [Objdump] Removing unused parameter.Colin LeMahieu2015-05-291-2/+2
| | | | llvm-svn: 238557
* [Hexagon] Disassembling, printing, and emitting instructions a whole-bundle ↵Colin LeMahieu2015-05-291-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
* Removing a switch statement that only contains a default; NFC.Aaron Ballman2015-05-291-4/+1
| | | | llvm-svn: 238552
* [llvm] Adding vdtor to fix warning.Colin LeMahieu2015-05-281-0/+1
| | | | llvm-svn: 238494
* [Objdump] Allow instruction pretty printing to be specialized by the target ↵Colin LeMahieu2015-05-281-6/+28
| | | | | | | | triple. Differential Revision: http://reviews.llvm.org/D8427 llvm-svn: 238457
* [llvm] Parameterizing the output stream for dumpbytes and outputting ↵Colin LeMahieu2015-05-281-14/+1
| | | | | | directly to stream. llvm-svn: 238453
* [Object] Teach Object and llvm-objdump about ".hidden"Davide Italiano2015-04-301-2/+6
| | | | | | | Differential Revision: http://reviews.llvm.org/D9416 Reviewed by: rafael llvm-svn: 236279
* Add the option -objc-meta-data to llvm-objdump used with -macho toKevin Enderby2015-04-011-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
* Replace the MCSubtargetInfo parameter with a Triple when creatingEric Christopher2015-03-311-1/+1
| | | | | | | an MCInstPrinter. Update all callers and use where we wanted a Triple previously. llvm-svn: 233648
* [MCInstPrinter] Enable MCInstPrinter to change its behavior based on theAkira Hatanaka2015-03-271-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
* [Objdump] DumpBytes of uint8_t from ArrayRef<uint8_t> instead of char from ↵Colin LeMahieu2015-03-181-3/+2
| | | | | | StringRef. Removing reinterpret_casts. llvm-svn: 232659
* [Objdump] Removing size limit on DumpBytes and changing to range based for loop.Colin LeMahieu2015-03-181-20/+7
| | | | llvm-svn: 232654
* Add the options, -dylibs-used and -dylib-id to llvm-objdump used with -machoKevin Enderby2015-03-161-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
* Add the option, -info-plist to llvm-objdump used with -macho to print theKevin Enderby2015-03-111-0/+1
| | | | | | Mach-O info plist section as strings. llvm-svn: 231974
* Add the -section option to llvm-objdump used with -macho that takes the argumentKevin Enderby2015-01-311-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
* dd the option, -link-opt-hints to llvm-objdump used with -macho to print theKevin Enderby2015-01-271-1/+2
| | | | | | Mach-O AArch64 linker optimization hints for ADRP code optimization. llvm-svn: 227246
* [Objdump] Output information about common symbols in a way closer to GNU ↵Colin LeMahieu2015-01-231-1/+11
| | | | | | objdump. llvm-svn: 226932
* Add the option, -data-in-code, to llvm-objdump used with -macho to print the ↵Kevin Enderby2015-01-231-1/+2
| | | | | | Mach-O data in code table. llvm-svn: 226921
* Add the option, -indirect-symbols, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-221-1/+2
| | | | | | indirect symbol table to llvm-objdump. llvm-svn: 226848
* For llvm-objdump, hook up existing options to work when using -macho (the ↵Kevin Enderby2015-01-201-15/+15
| | | | | | Mach-O parser). llvm-svn: 226612
* Add the option, -archive-headers, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-151-1/+2
| | | | | | archive headers to llvm-objdump. llvm-svn: 226228
* Add the option, -universal-headers, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-091-1/+2
| | | | | | universal headers to llvm-objdump. llvm-svn: 225537
* Slightly refactor things for llvm-objdump and the -macho option so it can be ↵Kevin Enderby2015-01-071-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
* Remove unused includes and out of date comment. NFC.Rafael Espindola2014-12-171-1/+0
| | | | llvm-svn: 224413
* Re-add support to llvm-objdump for Mach-O universal files and archives with ↵Kevin Enderby2014-12-041-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
* This reverts commit r223306 and r223277.Rafael Espindola2014-12-031-1/+1
| | | | | | The code is using uninitialized memory and failing on linux. llvm-svn: 223315
* Add support to llvm-objdump for Mach-O universal files and archives with -macho.Kevin Enderby2014-12-031-1/+1
| | | | llvm-svn: 223277
* Object/COFF: Fix off-by-one error for object having lots of relocationsRui Ueyama2014-11-261-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
* Object, COFF: Tighten the object file parserDavid Majnemer2014-11-171-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
* Fixing more -Wcast-qual warnings; NFC.Aaron Ballman2014-11-121-2/+4
| | | | llvm-svn: 221782
OpenPOWER on IntegriCloud