summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* Add the printing the Mach-O (__LLVM,__bundle) xar archive file section ↵Kevin Enderby2016-05-232-0/+60
| | | | | | | | | | | | | "verbosely" to llvm-objdump. This section is created with -fembed-bitcode option. This requires the use of libxar and the Cmake and lit support were crafted by Chris Bieneman! rdar://26202242 llvm-svn: 270491
* add support for -print-imm-hex for AArch64Paul Osmialowski2016-05-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Most immediates are printed in Aarch64InstPrinter using 'formatImm' macro, but not all of them. Implementation contains following rules: - floating point immediates are always printed as decimal - signed integer immediates are printed depends on flag settings (for negative values 'formatImm' macro prints the value as i.e -0x01 which may be convenient when imm is an address or offset) - logical immediates are always printed as hex - the 64-bit immediate for advSIMD, encoded in "a:b:c:d:e:f:g:h" is always printed as hex - the 64-bit immedaite in exception generation instructions like: brk, dcps1, dcps2, dcps3, hlt, hvc, smc, svc is always printed as hex - the rest of immediates is printed depends on availability of -print-imm-hex Signed-off-by: Maciej Gabka <maciej.gabka@arm.com> Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com> Differential Revision: http://reviews.llvm.org/D16929 llvm-svn: 269446
* Fix a bug in llvm-objdump for -private-headers printing the ↵Kevin Enderby2016-04-282-0/+7
| | | | | | | | LC_CODE_SIGNATURE Mach-O load command. rdar://25985653 llvm-svn: 267940
* Update llvm-objdump for disassembly of ARM Mach-O files to always include ↵Kevin Enderby2016-04-281-4/+4
| | | | | | | | | | the opcode bytes. As this is the expected behavior of the old darwin otool(1) for ARM Mach-O files. rdar://25896249 llvm-svn: 267929
* Fix bugs in llvm-objdump printing the last word for -section in non i386 and ↵Kevin Enderby2016-04-272-1/+5
| | | | | | | | | | | x86 files. Two problems, 1) for the last 4 bytes it would print them as separate bytes not a word and 2) it would print the same last byte for those bytes less than a word. rdar://25938224 llvm-svn: 267819
* Fix a bug in llvm-objdump printing of 32-bit addresses for -section in non ↵Kevin Enderby2016-04-272-0/+4
| | | | | | | | i386 and x86 files. rdar://25896202 llvm-svn: 267807
* Add a test case for the crash fixed with r267037. David Blaikie said it ↵Kevin Enderby2016-04-272-0/+3
| | | | | | | | | would be nice to have! This was crashing llvm-objdump with -macho -objc-meta-data when trying dump a non-existent section. So the test binary is simply created from an empty .s file compiled with: clang -arch armv7 empty.s -c llvm-svn: 267782
* llvm-objdump: deal with invalid ARM encodings slightly better.Tim Northover2016-04-222-2/+10
| | | | | | | | | | | | | | Before we printed a warning to stderr and left the actual output stream in a mess. This tries to print a .long or .short representation of what we saw (as if there was a data-in-code directive). This isn't guaranteed to restore synchronization in Thumb-mode (if the invalid instruction was supposed to be 32-bits, we may be off-by-16 for the rest of the function). But there's no certain way to deal with that, and it's invalid code anyway (if the data really wasn't an instruction, the user can add proper .data_in_code directives if they care) llvm-svn: 267250
* MachO: remove weird ARM/Thumb interface from MachOObjectFileTim Northover2016-04-221-0/+10
| | | | | | | | | | | | | | | | Only one consumer (llvm-objdump) actually cared about the fact that there were two triples. Others were actively working around the fact that the Triple returned by getArch might have been invalid. As for llvm-objdump, it needs to be acutely aware of both Triples anyway, so being generic in the exposed API is no benefit. Also rename the version of getArch returning a Triple. Users were having to pass an unwanted nullptr to disambiguate the two, which was nasty. The only functional change here is that armv7m and armv7em object files no longer crash llvm-objdump. llvm-svn: 267249
* Revert r265817Colin LeMahieu2016-04-0810-29/+29
| | | | | | lld tests need to be addressed. llvm-svn: 265822
* [llvm-objdump] Printing hex instead of dec by defaultColin LeMahieu2016-04-0810-29/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D18770 llvm-svn: 265817
* Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby2016-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to produce a real error message Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”.  Many more good error messages will follow after this first one. This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> . So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> : object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary() Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values. So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 265606
* Revert "[llvm-objdump] Printing relocations in executable and shared object ↵Rafael Espindola2016-03-212-9/+0
| | | | | | | | | files. This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does." This reverts commit r263971. It produces the wrong results for .rela.dyn. I will add a test. llvm-svn: 263987
* [llvm-objdump] Printing relocations in executable and shared object files. ↵Colin LeMahieu2016-03-212-0/+9
| | | | | | | | | | This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does. In executable and shared object ELF files, relocations in the file contain the final virtual address rather than section offset so this is adjusted to display section offset. Differential revision: http://reviews.llvm.org/D15965 llvm-svn: 263971
* [llvm-objdump] Move test case to the X86 sub-directory because it depends on ↵Simon Atanasyan2016-03-182-11/+6
| | | | | | X86 target supporting. NFC. llvm-svn: 263781
* [llvm-objdump] Add REQUIRES x86 directive to fix buildbotsSimon Atanasyan2016-03-171-0/+1
| | | | llvm-svn: 263708
* [llvm-objdump] Add '0x' prefix to a target displacement number to accent its ↵Simon Atanasyan2016-03-171-0/+10
| | | | | | | | | | | hex format It might be hard to recognize a hexadecimal number without '0x' prefix. Besides that '0x' prefix corresponds to GNU objdump behaviour. Differential Revision: http://reviews.llvm.org/D18207 llvm-svn: 263705
* [llvm-objdump] Add support for dumping the PE TLS directoryDavid Majnemer2016-03-152-0/+12
| | | | | | | | The PE TLS directory contains information about where the TLS data resides in the image, what functions should be executed when threads are created, etc. llvm-svn: 263537
* [DebugInfo] Dump CIE augmentation data as a list of hex bytesSimon Atanasyan2016-03-013-1/+28
| | | | | | | | | CIE augmentation data might contain non-printable characters. The patch prints the data as a list of hex bytes. Differential Revision: http://reviews.llvm.org/D17759 llvm-svn: 262361
* [DebugInfo] Support zero-length CIE in the _eh_frame parserIgor Laevsky2016-01-272-0/+10
| | | | | | | | | | | | MCJIT emits zero-length CIE at the end of the _eh_frame section. This change ensures that parser inside DebugInfo will not crash and correctly record such cases. We are now recording DW_EH_PE_omit as a default value for FDE and LSDA encodings. Also Offset != EndAugmentationOffset assertion check will only happen if augmentation string had 'z' letter in it. Differential Revision: http://reviews.llvm.org/D16588 llvm-svn: 258931
* Re-submit r256008 "Improve DWARFDebugFrame::parse to also handle __eh_frame."Igor Laevsky2016-01-261-22/+22
| | | | | | | Originally this change was causing failures on windows buildbots. But those problems were fixed in r258806. llvm-svn: 258811
* [llvm-objdump] Use report_error() and improve error coverage.Davide Italiano2016-01-133-1/+3
| | | | llvm-svn: 257561
* For llvm-objdump, add the option -private-header (without the trailing ’s’)Kevin Enderby2016-01-131-0/+6
| | | | | | | | | | | | | | | to only print the first private header. Which for Mach-O files only prints the Mach header and not the subsequent load commands. Which is used by scripts to match what the darwin otool(1) with the -h flag does without the -l flag. For non-Mach-O files it has the same functionality as -private-headers (with the trailing ’s’). rdar://24158331 llvm-svn: 257548
* Revert "Improve DWARFDebugFrame::parse to also handle __eh_frame."Pete Cooper2015-12-181-22/+22
| | | | | | | | This reverts commit r256008. Its breaking multiple buildbots, although works for me locally. llvm-svn: 256013
* Improve DWARFDebugFrame::parse to also handle __eh_frame.Pete Cooper2015-12-181-22/+22
| | | | | | | | | | | | | | | LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's. This code improves DWARFDebugFrame::parse to do the same for parsing. This also allows llvm-objdump to support the --dwarf=frames option which objdump supports. This option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse. http://reviews.llvm.org/D15535 Reviewed by Rafael Espindola. llvm-svn: 256008
* Start implementing FDE dumping when printing the eh_frame.Pete Cooper2015-12-141-1/+6
| | | | | | | | | | This code adds some simple decoding of the FDE's in an eh_frame. There's still more to be done in terms of error handling and verification. Also, we need to be able to decode the CFI's. llvm-svn: 255550
* Print the eh_frame section in MachoDump.Pete Cooper2015-12-142-0/+18
| | | | | | | | | | | | | | This is the start of work to dump the contents of the eh_frame section. It currently emits CIE entries. FDE entries will come later. It also needs improved error checking which will follow soon. http://reviews.llvm.org/D15502 Reviewed by Kevin Enderby and Lang Hames. llvm-svn: 255546
* [llvm-objdump] Use the COFF export table for additional symbolsDavid Majnemer2015-11-182-0/+8
| | | | | | | | | Most linked executables do not have a symbol table in COFF. However, it is pretty typical to have some export entries. Use those entries to inform the disassembler about potential function definitions and call targets. llvm-svn: 253429
* [Object, MachO] Mark symbols from DATA and BSS sections as ST_DataKuba Brecka2015-11-121-3/+3
| | | | | | | | In `MachOObjectFile::getSymbolType` we currently always return `SymbolRef::ST_Function` for symbols from any section. In order for llvm-symbolizer to correctly symbolize Mach-O globals, symbols from data and BSS sections should return `SymbolRef::ST_Data`. Differential Revision: http://reviews.llvm.org/D14576 llvm-svn: 252867
* Reapply r250906 with many suggested updates from Rafael Espindola.Kevin Enderby2015-11-054-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is expected. This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. These changes will require corresponding changes to the lld project. That will be committed immediately after this change. But this revision will cause lld failures with this alone which is expected. llvm-svn: 252192
* Backing out commit r250906 as it broke lld.Kevin Enderby2015-10-214-62/+0
| | | | llvm-svn: 250908
* This removes the eating of the error in Archive::Child::getSize() when the ↵Kevin Enderby2015-10-214-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. Also corrected the code where the size gets us to the “at the end of the archive” which is OK but past the end of the archive will return object_error::parse_failed now. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. llvm-svn: 250906
* Tweak to r250117 and change to use ErrorOr and drop isSizeValid forKevin Enderby2015-10-131-7/+0
| | | | | | | | | | ArchiveMemberHeader, suggestion by Rafael Espíndola. Also The clang-x86-win2008-selfhost bot still does not like the malformed-machos 00000031.a test, so removing it for now. All the other bots are fine with it however. llvm-svn: 250222
* The issue with the malformed-machos 00000031.a test is that it needed ↵Kevin Enderby2015-10-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ‘-arch x86_64’ flag as it was a Mach-O universal file. The default as to which architecture slice that is dumped without an -arch flag depends on the host architecture and the contents of the universal file. The malformed archive 00000031.a file has both an x86_64 and i386 slice. So for for x86_64 hosts only that slice is dumped, for non-x86_64 hosts, which is many of the bots both slices are dumped. The test is intended to only check that the malformation of the x86_64 which has a non-decimal characters in the size field of the archive header so it no longer crashes. The problem turned out that the i388 slice of the malformed archive had a different malformation which was causing the non-x86_64 bots to get this error: llvm-objdump -macho -disassemble -arch i386 00000031.a Archive : .00000031.a 00000031.a(c_start.o): LLVM ERROR: Symbol name entry points before beginning or past end of file. and causing the test as it was written to fail. So by adding ‘-arch x86_64’ it should correct the test and the malformation on the i388 slice will not be dumped. Also the removal of the malformed-machos mem-crup-0261.macho was not causing the issue so that is put back in. Sorry for the churn on these tests, Kev llvm-svn: 250184
* Looks like malformed-machos 00000031.a test is just getting a different errorKevin Enderby2015-10-131-6/+0
| | | | | | on some of the bots. I’ll remove this test for now. llvm-svn: 250141
* Remove the correct unstable malformed-machos test mem-crup-0261.macho andKevin Enderby2015-10-131-3/+6
| | | | | | | restore the malformed-machos 00000031.a test. Hopefully this will get all the build bots happy again. I’ll again keep an eye on them. llvm-svn: 250130
* Temporarily remove the test added in r250117 while I investigate why twoKevin Enderby2015-10-121-6/+0
| | | | | | of the build bots get a different error on that malformed file. llvm-svn: 250120
* Fixed bugs in llvm-obdump while parsing Mach-O files from malformed archivesKevin Enderby2015-10-122-0/+6
| | | | | | | | | that caused aborts. This was because of the characters of the ‘Size’ field in the archive header did not contain decimal characters. rdar://22983603 llvm-svn: 250117
* Move llvm-objdump malformed Mach-O tests to X86 test directory.Kevin Enderby2015-10-108-0/+0
| | | | | | rdar://22983603 llvm-svn: 249927
* Fix a bugs in the Mach-O disassembler when disassembling from aKevin Enderby2015-10-102-0/+6
| | | | | | | | | | malformed Mach-O file that caused a crash. This was because of an assert where the code was incorrectly attempting to parse relocation entries off of the sections and the filetype was not an MH_OBJECT. rdar://22983603 llvm-svn: 249921
* Fixed two bugs in llvm-objdump’s printing of Objective-C meta dataKevin Enderby2015-10-093-0/+9
| | | | | | | | | | | from malformed Mach-O files that caused crashes. The first because the offset in a dyld bind table entry was out of range. The second because their was no image info section and the routine printing it did not have the need check to see the section did not exist. rdar://22983603 llvm-svn: 249845
* Fix a bug in llvm-objdump’s printing of Objective-C meta dataKevin Enderby2015-10-082-0/+6
| | | | | | | | | from malformed Mach-O files that caused a crash because of a section header had a size that extended past the end of the file. rdar://22983603 llvm-svn: 249768
* Fix a bug in llvm-objdump’s printing of Objective-C meta dataKevin Enderby2015-10-082-0/+6
| | | | | | | from malformed Mach-O files that caused a crash because of loops in the class meta data. llvm-svn: 249700
* Fix two bugs in llvm-objdump’s printing of Objective-C meta dataKevin Enderby2015-10-063-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | from malformed Mach-O files that caused crashes. We recently got about 700 malformed Mach-O files which we have been using the improve the robustness of tools that deal with reading data from object files. These resulted in about 20 small bug fixes to the darwin based tools. The goal here is to also improve the robustness of llvm-objdump and this is the first two fixes. In talking with Tim Northover the approach we thought might be best is to: 1) Only include tests for the malformed Mach-O files that cause crashes (not all 700+ tests). 2) The test should only contain the command line option that caused the crash and not all the others that don’t matter. 3) There should be only one line for the FileCheck that is past the point of the crash if possible and if possible indicates the malformation. Again the goal is to fix crashes and not so much care about how the printing of malformed data comes out. Tim also suggested if we really wanted to add test cases for all 700+ malformed Mach-O files putting them in the regression tests might be an option. But many of these do not cause crashes. llvm-svn: 249479
* [PATCH] D13360: [llvm-objdump] Teach -d about AArch64 mapping symbolsDavide Italiano2015-10-011-0/+30
| | | | | | | | | | AArch64 uses $d* and $x* to interleave between text and data. llvm-objdump didn't know about this so it ended up printing garbage. This patch is a first step towards a solution of the problem. Differential Revision: http://reviews.llvm.org/D13360 llvm-svn: 249083
* COFF: Assign the correct symbol type to internal functions.Peter Collingbourne2015-08-062-0/+3
| | | | | | | | | | | The COFFSymbolRef::isFunctionDefinition() function tests for several conditions that are not related to whether a symbol is a function, but rather whether the symbol meets the requirements for a function definition auxiliary record, which excludes certain symbols such as internal functions and undefined references. The test we need to determine the symbol type is much simpler: we only need to compare the complex type against IMAGE_SYM_DTYPE_FUNCTION. llvm-svn: 244195
* [llvm-objdump] Merging MachO DumpSections in to FilterSections. Simplifying ↵Colin LeMahieu2015-07-291-1/+1
| | | | | | some predicate logic. llvm-svn: 243556
* [llvm-objdump] Added -j flag to filter sections that are operated on.Colin LeMahieu2015-07-292-0/+7
| | | | llvm-svn: 243526
* Moving tests in to X86 directory.Colin LeMahieu2015-07-232-0/+0
| | | | llvm-svn: 243049
* Using an input object file instead of trying to generate an object file.Colin LeMahieu2015-07-232-5/+2
| | | | llvm-svn: 243044
OpenPOWER on IntegriCloud