summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-add support to llvm-objdump for Mach-O universal files and archives with ↵Kevin Enderby2014-12-042-18/+241
| | | | | | | | | | | -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
* Add mach-o LC_RPATH support to llvm-objdumpJean-Daniel Dupas2014-12-041-0/+19
| | | | | | | | | | Summary: Add rpath load command support in Mach-O object and update llvm-objdump to use it. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6512 llvm-svn: 223343
* This reverts commit r223306 and r223277.Rafael Espindola2014-12-032-241/+18
| | | | | | 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-032-18/+241
| | | | 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
* Fix Use-of-uninitialized-value for adrp_addr and adrp_inst in MachODump.cppKevin Enderby2014-11-191-0/+4
| | | | | | Fixes PR21607 llvm-svn: 222385
* 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
* Add the code and test cases for 64-bit ARM to llvm-objdump’s Mach-O ↵Kevin Enderby2014-11-141-23/+185
| | | | | | | | | symbolizer. FYI, removed the unused MCInstrAnalysis as it does not exist for 64-bit ARM and was causing a “couldn't initialize disassembler for target” error. llvm-svn: 222045
* Object, Mach-O: Refactor and clean code upDavid Majnemer2014-11-131-6/+7
| | | | | | | Don't assert if we can return an error code, reuse existing functionality like is64Bit(). llvm-svn: 221915
* Fixing more -Wcast-qual warnings; NFC.Aaron Ballman2014-11-122-6/+14
| | | | llvm-svn: 221782
* Remove the now unused StringRefMemoryObject.h.Rafael Espindola2014-11-121-1/+0
| | | | llvm-svn: 221755
* Pass an ArrayRef to MCDisassembler::getInstruction.Rafael Espindola2014-11-122-20/+18
| | | | | | | | | | | | 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
* Fix a warning about ‘r_type’ may be used uninitialized.Kevin Enderby2014-11-111-1/+1
| | | | | | Thanks to Aaron Ballman for noticing this! llvm-svn: 221696
* 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
* Use StringRefMemoryObject. NFC.Rafael Espindola2014-11-071-34/+5
| | | | llvm-svn: 221502
* Plumb in the ARM thumb symbolizer in llvm-objdump’s Mach-O disassembler andKevin Enderby2014-11-061-24/+235
| | | | | | | | | | | | add the code and test cases for 32-bit ARM symbolizer. Also fixed the printing of data in code as it was not using the table correctly and needed to fix one of the test cases too. This will break lld’s test/mach-o/arm-interworking-movw.yaml till the tweak for that is made. Which I’ll be committing immediately after this commit. llvm-svn: 221470
* llvm-objdump: Pass DiceTableEntry by referenceDavid Majnemer2014-11-041-2/+2
| | | | | | | | | DiceTableEntry is 24 bytes on my machine, it's probably better to pass them by reference. This fixes PR21464. llvm-svn: 221247
* Add the code and test cases for 32-bit Intel to llvm-objdump’s Mach-O ↵Kevin Enderby2014-11-041-14/+94
| | | | | | symbolizer. llvm-svn: 221211
* Run clang-format on tools/llvm-objdump/MachODump.cpp . No functional change.Kevin Enderby2014-10-291-113/+82
| | | | llvm-svn: 220875
* Update llvm-objdump’s Mach-O symbolizer code to demangle C++ names.Kevin Enderby2014-10-281-6/+41
| | | | llvm-svn: 220833
* MachODump.cpp: fix MSVC buildHans Wennborg2014-10-231-4/+4
| | | | llvm-svn: 220518
* Change the name of the field BindTable to bindtable to not over lap the type.Kevin Enderby2014-10-231-9/+9
| | | | | | Should fix the build bot issues from commit r220500. llvm-svn: 220504
* Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.Kevin Enderby2014-10-231-44/+571
| | | | | | | This prints disassembly comments for Objective-C references to CFStrings, Selectors, Classes and method calls. llvm-svn: 220500
* [llvm-objdump] Fix -private-headers for mach-o to print all LC_*_DYLIB variantsNick Kledzik2014-10-161-1/+6
| | | | llvm-svn: 219945
* [llvm-objdump] Update error message and add test case for mach-o file with ↵Nick Kledzik2014-10-141-1/+1
| | | | | | bad library ordinals llvm-svn: 219746
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-082-64/+30
| | | | | | | | | | | | | | 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
* Rename data -> DataRui Ueyama2014-10-021-1/+1
| | | | llvm-svn: 218916
* [llvm-objdump] switch some uses of format() to format_hex() and left_justify()Nick Kledzik2014-09-301-29/+26
| | | | llvm-svn: 218649
* Update llvm-objdump’s Mach-O symbolizer code to print the name of symbol ↵Kevin Enderby2014-09-261-1/+96
| | | | | | | | | | | | | | | | stubs. So in fully linked images when a call is made through a stub it now gets a comment like the following in the disassembly: callq 0x100000f6c ## symbol stub for: _printf indicating the call is to a symbol stub and which symbol it is for. This is done for branch reference types and seeing if the branch target is in a stub section and if so using the indirect symbol table entry for that stub and using that symbol table entries symbol name. llvm-svn: 218546
* Since the DisasmMemoryObject only operates on const data, it now only ↵Aaron Ballman2014-09-251-3/+3
| | | | | | accepts a const data pointer. This silences a -Wcast-qual warning. llvm-svn: 218454
* Flush out enough of llvm-objdump’s SymbolizerSymbolLookUp() for Mach-O ↵Kevin Enderby2014-09-243-34/+305
| | | | | | | | | | | | | | | | | | | | | 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] properly use c_str() with format("%s"). Improve ↵Nick Kledzik2014-09-171-2/+2
| | | | | | getLibraryShortNameByIndex() error handling. llvm-svn: 217930
* [llvm-objdump] improve error reporting of bad mach-o ordinalsNick Kledzik2014-09-161-2/+8
| | | | llvm-svn: 217909
* Hookup the MCSymbolizer to llvm-objdump’s disassembly for Mach-O files.Kevin Enderby2014-09-161-1/+183
| | | | | | | | | | | | | | First step done in this commit is to get flush out enough of the SymbolizerGetOpInfo() routine to symbolic an X86_64 hello world .o and its loading of the literal string and call to printf. Also the code to symbolicate the X86_64_RELOC_SUBTRACTOR relocation and a test is also added to show a slightly more complicated case. Next will be to flush out enough of SymbolizerSymbolLookUp() to get the literal string “Hello world” printed as a comment on the instruction that load the pointer to it. llvm-svn: 217893
* [llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind optionsNick Kledzik2014-09-163-2/+170
| | | | | | | | | | | | | | | | 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] Use PRIX64 with format()Nick Kledzik2014-09-131-1/+2
| | | | llvm-svn: 217724
* [llvm-objdump] support -rebase option for mach-o to dump rebasing infoNick Kledzik2014-09-123-1/+126
| | | | | | | | | | 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-102-28/+17
| | | | | | | | | | | | | | | | | | | | | | 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
* llvm-objdump: don't crash when __compact_unwind has no relocs.Tim Northover2014-09-091-0/+3
| | | | llvm-svn: 217433
* Adds the next bit of support for llvm-objdump’s -private-headers for ↵Kevin Enderby2014-09-041-1/+303
| | | | | | | | | executable Mach-O files. This adds the printing of more load commands, so that the normal load commands in a typical X86 Mach-O executable can all be printed. llvm-svn: 217172
* Replace printf with outs() <<Nick Kledzik2014-09-031-1/+1
| | | | llvm-svn: 217005
* Nuke MCAnalysis.Sean Silva2014-09-025-124/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Code review tweaksNick Kledzik2014-09-021-17/+17
| | | | llvm-svn: 216931
* Object/llvm-objdump: allow dumping of mach-o exports trieNick Kledzik2014-08-303-2/+79
| | | | | | | | | | | | | | | | | | 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
* Next bit of support for llvm-objdump’s -private-headers for Mach-O files.Kevin Enderby2014-08-291-3/+495
| | | | | | | This adds the printing of the LC_SEGMENT load command and sections, LC_SYMTAB and LC_DYSYMTAB load commands. llvm-svn: 216795
* 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
* This code is from r216285, which did not go out to the mailing list for some ↵Aaron Ballman2014-08-241-6/+1
| | | | | | | | reason. The switch statement would never fire due to the preceding break statement. Also, the switch statement has a default label with no case labels. Simplified the code, and allow it to execute. llvm-svn: 216346
* Add the start of the support for llvm-objdump’s -private-headers for ↵Kevin Enderby2014-08-223-0/+297
| | | | | | | | 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-192-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud