summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Pass an ArrayRef to MCDisassembler::getInstruction.Rafael Espindola2014-11-121-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
* llvm-objdump: Skip empty sections when dumping contentsDavid Majnemer2014-11-111-3/+6
| | | | | | | Empty sections are just noise when using objdump. This is similar to what binutils does. llvm-svn: 221680
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-34/+12
| | | | | | | | | | | | | | 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
* Flush out enough of llvm-objdump’s SymbolizerSymbolLookUp() for Mach-O ↵Kevin Enderby2014-09-241-3/+4
| | | | | | | | | | | | | | | | | | | | | files to get the literal string “Hello world” printed as a comment on the instruction that loads the pointer to it. For now this is just for x86_64. So for object files with relocation entries it produces things like: leaq L_.str(%rip), %rax ## literal pool for: "Hello world\n" and similar for fully linked images like executables: leaq 0x4f(%rip), %rax ## literal pool for: "Hello world\n" Also to allow testing against darwin’s otool(1), I hooked up the existing -no-show-raw-insn option to the Mach-O parser code, added the new Mach-O only -full-leading-addr option to match otool(1)'s printing of addresses and also added the new -print-imm-hex option. llvm-svn: 218423
* [llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind optionsNick Kledzik2014-09-161-1/+51
| | | | | | | | | | | | | | | | This finishes the ability of llvm-objdump to print out all information from the LC_DYLD_INFO load command. The -bind option prints out symbolic references that dyld must resolve immediately. The -lazy-bind option prints out symbolc reference that are lazily resolved on first use. The -weak-bind option prints out information about symbols which dyld must try to coalesce across images. llvm-svn: 217853
* MC: Add support for BigObjDavid Majnemer2014-09-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [llvm-objdump] support -rebase option for mach-o to dump rebasing infoNick Kledzik2014-09-121-1/+19
| | | | | | | | | | Similar to my previous -exports-trie option, the -rebase option dumps info from the LC_DYLD_INFO load command. The rebasing info is a list of the the locations that dyld needs to adjust if a mach-o image is not loaded at its preferred address. Since ASLR is now the default, images almost never load at their preferred address, and thus need to be rebased by dyld. llvm-svn: 217709
* Object: Add support for bigobjDavid Majnemer2014-09-101-19/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* Nuke MCAnalysis.Sean Silva2014-09-021-119/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is buggy and barely tested. It is also mostly boilerplate. (This includes MCObjectDisassembler, which is the interface to that functionality) Following an IRC discussion with Jim Grosbach, it seems sensible to just nuke the whole lot of functionality, and dig it up from VCS if necessary (I hope not!). All of this stuff appears to have been added in a huge patch dump (look at the timeframe surrounding e.g. r182628) where almost every patch seemed to be untested and not reviewed before being committed. Post-review responses to the patches were never addressed. I don't think any of it would have passed pre-commit review. I doubt anyone is depending on this, since this code appears to be extremely buggy. In limited testing that Michael Spencer and I did, we couldn't find a single real-world object file that wouldn't crash the CFG reconstruction stuff. The symbolizer stuff has O(n^2) behavior and so is not much use to anyone anyway. It seemed simpler to remove them as a whole. Most of this code is boilerplate, which is the only way it was able to scrape by 60% coverage. HEADSUP: Modules folks, some files I nuked were referenced from include/llvm/module.modulemap; I just deleted the references. Hopefully that is the right fix (one was a FIXME though!). llvm-svn: 216983
* Object/llvm-objdump: allow dumping of mach-o exports trieNick Kledzik2014-08-301-1/+18
| | | | | | | | | | | | | | | | | | MachOObjectFile in lib/Object currently has no support for parsing the rebase, binding, and export information from the LC_DYLD_INFO load command in final linked mach-o images. This patch adds support for parsing the exports trie data structure. It also adds an option to llvm-objdump to dump that export info. I did the exports parsing first because it is the hardest. The information is encoded in a trie structure, but the standard ObjectFile way to inspect content is through iterators. So I needed to make an iterator that would do a non-recursive walk through the trie and maintain the concatenation of edges needed for the current string prefix. I plan to add similar support in MachOObjectFile and llvm-objdump to parse/display the rebasing and binding info too. llvm-svn: 216808
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-8/+8
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Add the start of the support for llvm-objdump’s -private-headers for ↵Kevin Enderby2014-08-221-0/+2
| | | | | | | | Mach-O files. This adds the printing of the mach header. Load command printing will be next. llvm-svn: 216285
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-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
* llvm-objdump: don't print relocations in non-relocatable files.Rafael Espindola2014-08-171-0/+5
| | | | | | This matches the behavior of GNU objdump. llvm-svn: 215844
* Fix an off-by-one bug in the target independent llvm-objdump.Rafael Espindola2014-08-171-10/+5
| | | | | | | | It would prevent the display of a single byte instruction before a label. Patch by Steve King! llvm-svn: 215837
* Add the -mcpu= option to llvm-objdump for use with the disassemblers.Kevin Enderby2014-08-061-3/+9
| | | | | | | Also make the disassembler created with the Mach-O parser (the -m option) pick up the Target specific attributes specified with -mattr option. llvm-svn: 215032
* Remove some calls to std::move.Rafael Espindola2014-08-011-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
* llvm-objdump: implement printing for MachO __compact_unwind info.Tim Northover2014-08-011-2/+4
| | | | llvm-svn: 214509
* Move MCObjectSymbolizer.h to MC/MCAnalysis.Rafael Espindola2014-07-311-1/+1
| | | | | | The cpp file is already in lib/MC/MCAnalysis. llvm-svn: 214424
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* llvm-objdump: Handle BSS sections larger than the object fileDavid Majnemer2014-07-141-4/+8
| | | | | | | | | The size of the uninitialized sections, like BSS, can exceed the size of the object file. Do not attempt to grab the contents of such sections. llvm-svn: 212953
* Move CFG building code to a new lib/MC/MCAnalysis library.Rafael Espindola2014-07-021-4/+4
| | | | | | | The new library is 150KB on a Release+Asserts build, so it is quiet a bit of code that regular users of MC don't need to link with now. llvm-svn: 212209
OpenPOWER on IntegriCloud