summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a crash in llvm-objdump when printing a bad x86_64 relocation in a Mach-OKevin Enderby2017-11-032-0/+3
| | | | | | | | file with a bad section number. rdar://35207539 llvm-svn: 317373
* [wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)Vedant Kumar2017-10-232-0/+2
| | | | | | | | | | | | | A wasm file crafted with a bogus section size can trigger an ASan issue in the DWARFObjInMemory constructor. Nip the problem in the bud when we read the wasm section. Found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3219 Differential Revision: https://reviews.llvm.org/D38777 llvm-svn: 316357
* [Hexagon] New HVX target features.Sumanth Gundapaneni2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | This patch lets the llvm tools handle the new HVX target features that are added by frontend (clang). The target-features are of the form "hvx-length64b" for 64 Byte HVX mode, "hvx-length128b" for 128 Byte mode HVX. "hvx-double" is an alias to "hvx-length128b" and is soon will be deprecated. The hvx version target feature is upgated form "+hvx" to "+hvxv{version_number}. Eg: "+hvxv62" For the correct HVX code generation, the user must use the following target features. For 64B mode: "+hvxv62" "+hvx-length64b" For 128B mode: "+hvxv62" "+hvx-length128b" Clang picks a default length if none is specified. If for some reason, no hvx-length is specified to llvm, the compilation will bail out. There is a corresponding clang patch. Differential Revision: https://reviews.llvm.org/D38851 llvm-svn: 316101
* [llvm-objdump] Disable leak checking on an llvm-objdump testFrancis Ricci2017-10-101-1/+1
| | | | | | | | | | | | | | | | Summary: This leak doesn't reproduce locally on macOS 10.12, but is causing buildbot failures. Disable leak checking until it can be fixed. Reviewers: sqlbyme, qcolombet, enderby, bruno Reviewed By: bruno Subscribers: bruno, llvm-commits Differential Revision: https://reviews.llvm.org/D38699 llvm-svn: 315337
* Fix a bug in llvm-objdump when disassembling using the wrong default CPUKevin Enderby2017-09-212-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | in the second slice of a Mach-O universal file. The code in llvm-objdump in in DisassembleMachO() was getting the default CPU then incorrectly setting into the global variable used for the -mcpu option if that was not set. This caused a second call to DisassembleMachO() to use the wrong default CPU when disassembling the next slice in a Mach-O universal file. And would result in bad disassembly and an error message about an recognized processor for the target: % llvm-objdump -d -m -arch all fat.macho-armv7s-arm64 fat.macho-armv7s-arm64 (architecture armv7s): (__TEXT,__text) section armv7: 0: 60 47 bx r12 fat.macho-armv7s-arm64 (architecture arm64): 'cortex-a7' is not a recognized processor for this target (ignoring processor) 'cortex-a7' is not a recognized processor for this target (ignoring processor) (__TEXT,__text) section ___multc3: 0: .long 0x1e620810 rdar://34439149 llvm-svn: 313921
* [WebAssembly] Add support for local symbol bindingsSam Clegg2017-09-201-5/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D38096 llvm-svn: 313817
* [WebAssembly] Use a separate wasm data segment for each global symbolSam Clegg2017-09-141-1/+1
| | | | | | | | | | This is stepping stone towards honoring -fdata-sections and letting the assembler decide how many wasm data segments to create. Differential Revision: https://reviews.llvm.org/D37834 llvm-svn: 313313
* [WebAssembly] Only treat imports/exports as symbols when reading relocatable ↵Sam Clegg2017-09-061-3/+3
| | | | | | | | | | | | | | | | | | | object files This change only treats imported and exports functions and globals as symbol table entries the object has a "linking" section (i.e. it is relocatable object file). In this case all globals must be of type I32 and initialized with i32.const. This was previously being assumed but not checked for and was causing a failure on big endian machines due to using the wrong value of then union. See: https://bugs.llvm.org/show_bug.cgi?id=34487 Differential Revision: https://reviews.llvm.org/D37497 llvm-svn: 312674
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-011-1/+1
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
* [WebAssembly] Fix getSymbolValue() for data symbolsSam Clegg2017-08-311-1/+1
| | | | | | | | | | This is mostly a fix for the output of `llvm-nm` See Bug 34392: https://bugs.llvm.org//show_bug.cgi?id=34392 Differential Revision: https://reviews.llvm.org/D37359 llvm-svn: 312294
* Update test:Konstantin Zhuravlyov2017-08-311-1/+1
| | | | | | | | - REQUIRES: x86_64-linux -> REQUIRES: shell Differential Revision: https://reviews.llvm.org/D37316 llvm-svn: 312245
* Fix test after rL312144Konstantin Zhuravlyov2017-08-301-1/+1
| | | | llvm-svn: 312176
* Canonicalize the representation of empty an expression in ↵Adrian Prantl2017-08-301-1/+1
| | | | | | | | | | | | | | | | DIGlobalVariableExpression This change simplifies code that has to deal with DIGlobalVariableExpression and mirrors how we treat DIExpressions in debug info intrinsics. Before this change there were two ways of representing empty expressions on globals, a nullptr and an empty !DIExpression(). If someone needs to upgrade out-of-tree testcases: perl -pi -e 's/(!DIGlobalVariableExpression\(var: ![0-9]*)\)/\1, expr: !DIExpression())/g' <MYTEST.ll> will catch 95%. llvm-svn: 312144
* [MachO] Use Twines more efficiently.Benjamin Kramer2017-08-202-8/+8
| | | | llvm-svn: 311291
* Add error handling to the dyld compact export entries in libObject.Kevin Enderby2017-07-2013-0/+35
| | | | | | | | | | | | | | | | | | | | | lld needs a matching change for this will be my next commit. Expect it to fail build until that matching commit is picked up by the bots. Like the changes in r296527 for dyld bind entires and the changes in r298883 for lazy bind, weak bind and rebase entries the export entries are the last of the dyld compact info to have error handling added. This follows the model of iterators that can fail that Lang Hanes designed when fixing the problem for bad archives r275316 (or r275361). So that iterating through the exports now terminates if there is an error and returns an llvm::Error with an error message in all cases for malformed input. This change provides the plumbing for the error handling, all the needed testing of error conditions and test cases for all of the unique error messages. llvm-svn: 308690
* [llvm-objdump] Properly print MachO aarch64 addend relocationsMartin Storsjo2017-07-132-0/+6
| | | | | | | | | | Previously such relocations fell into the last case for local symbols, using the relocation addend as symbol index, leading to a crash. Differential Revision: https://reviews.llvm.org/D35239 llvm-svn: 307927
* [llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocationsMartin Storsjo2017-07-132-0/+4
| | | | | | | | | | All other code in MachODump.cpp uses the same comparison, ((r_length & 0x1) == 1), for distinguishing between the two, while the code in llvm-objdump.cpp seemed to be incorrect. Differential Revision: https://reviews.llvm.org/D35240 llvm-svn: 307882
* [WebAssembly] Be consistent in generating trivial test input filesSam Clegg2017-07-105-23/+48
| | | | | | | | | | | | | For each checked-in wasm file, make sure the there is corresponding .ll file that can be used to regenerate it if needed. Add test/Object/Inputs/trivial-object-test.wasm to match other formats and add some new wasm tests in test/Object. Differential Revision: https://reviews.llvm.org/D35213 llvm-svn: 307585
* [llvm-objdump] Handle invalid instruction gracefully on ARMEugene Leviant2017-06-291-0/+9
| | | | | | Differential revision: https://reviews.llvm.org/D34813 llvm-svn: 306687
* [WebAssembly] Only run WebAssembly objdump tests if it is enabled as a targetSam Clegg2017-06-271-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D34712 llvm-svn: 306464
* [WebAssembly] Add support for printing relocations with llvm-objdumpSam Clegg2017-06-271-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D34658 llvm-svn: 306461
* Updated llvm-objdump for arm64 Mach-O MH_KEXT_BUNDLE file types soKevin Enderby2017-06-222-0/+9
| | | | | | | | | it symbolically disassembles the __text section from the __TEXT_EXEC segment not the usual __TEXT segment by default. rdar://30590208 llvm-svn: 306046
* Updated llvm-objdump symbolic disassembly with x86_64 Mach-O MH_KEXT_BUNDLEKevin Enderby2017-06-222-0/+9
| | | | | | | | | file types so it symbolically disassembles operands using the external relocation entries. rdar://31521343 llvm-svn: 306037
* Updated llvm-objdump with Mach-O files and the -objc-meta-data option soKevin Enderby2017-06-201-2/+2
| | | | | | | | that it symbolically prints the superclass when it has dyld bind info for it. rdar://7638823 llvm-svn: 305866
* Change llvm-objdump with Mach-O files and the -info-plist option with theKevin Enderby2017-06-201-0/+4
| | | | | | | | -no-leading-headers option so that it does not print the leading header. rdar://27378808 llvm-svn: 305849
* Fix a FIXME in llvm-objdump for the -exports-trie option that was not addingKevin Enderby2017-06-191-0/+10
| | | | | | | | | | in the base address. Without this Mach-O files, like 64-bit executables, don’t have the correct addresses printed for their exports. As the default is to link at address 0x100000000 not zero. llvm-svn: 305744
* [WebAssembly] Add wasm symbol table support to llvm-objdumpSam Clegg2017-05-041-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D32760 llvm-svn: 302185
* [llvm-objdump] Don't attempt to print lines beyond the end of filePetr Hosek2017-04-252-0/+27
| | | | | | | | | | | | | This may trigger a segfault in llvm-objdump when the line number stored in debug infromation points beyond the end of file; lines in LineBuffer are stored in std::vector which is allocated in chunks, so even if the debug info points beyond the end of the file, this doesn't necessarily trigger the segfault unless the line number points beyond the allocated space. Differential Revision: https://reviews.llvm.org/D32466 llvm-svn: 301347
* [Object] Remove check for BIND_OPCODE_DONE/REBASE_OPCODE_DONE.Juergen Ributzka2017-03-303-6/+0
| | | | | | | | | | BIND_OPCODE_DONE/REBASE_OPCODE_DONE may appear at the end of the opcode array, but they are not required to. The linker only adds them as padding to align the opcodes to pointer size. This fixes rdar://problem/31285560. llvm-svn: 299104
* [WebAssembly] Improve support for WebAssembly binary formatDerek Schuff2017-03-302-1/+1
| | | | | | | | | | | | | | | | | | | Mostly this change adds support converting to and from YAML which will allow us to write more test cases for the WebAssembly MC and lld ports. Better support for objdump, readelf, and nm will be in followup CLs. I had to update the two wasm test binaries because they used the old style 'name' section which is no longer supported. Differential Revision: https://reviews.llvm.org/D31099 Patch by Sam Clegg llvm-svn: 299101
* Add the error handling for Mach-O dyld compact lazy bind, weak bind andKevin Enderby2017-03-2720-1/+58
| | | | | | | | | | | | | | | | | | | | | rebase entry errors and test cases for each of the error checks. Also verified with Nick Kledzik that a BIND_OPCODE_SET_ADDEND_SLEB opcode is legal in a lazy bind table, so code that had that as an error check was removed. With MachORebaseEntry and MachOBindEntry classes now returning an llvm::Error in all cases for malformed input the variables Malformed and logic to set use them is no longer needed and has been removed from those classes. Also in a few places, removed the redundant Done assignment to true when also calling moveToEnd() as it does that assignment. This only leaves the dyld compact export entries left to have error handling yet to be added for the dyld compact info. llvm-svn: 298883
* Add the rest of the error checking for Mach-O dyld compact bind entry errorsKevin Enderby2017-03-2019-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | and test cases for each of the error checks. To do this more plumbing was needed so that the segment indexes and segment offsets can be checked. Basically what was done was the SegInfo from llvm-objdump’s MachODump.cpp was moved into libObject for Mach-O objects as BindRebaseSegInfo and it is only created when an iterator for bind or rebase entries are created. This commit really only adds the error checking and test cases for the bind table entires and the checking for the lazy bind and weak bind entries are still to be fully done as well as the rebase entires. Though some of the plumbing for those are added with this commit. Those other error checks and test cases will be added in follow on commits. Note, the two llvm_unreachable() calls should now actually be unreachable with the error checks in place and would take a logic bug in the error checking code to be reached if the segment indexes and segment offsets are used from a checked bind entry. Comments have been added to the methods that require the arguments to have been checked prior to calling. llvm-svn: 298292
* Fix source-lines test on Windows.Zachary Turner2017-03-071-7/+7
| | | | llvm-svn: 297233
* llvm-objdump: handle line numbers and source options for amdgpu objectsKonstantin Zhuravlyov2017-03-073-0/+117
| | | | | | Differential Revision: https://reviews.llvm.org/D30679 llvm-svn: 297193
* [mips] Drop unneeded REQUIRES line in test. NFCISimon Dardis2017-03-011-1/+0
| | | | | | rL296111 provides the proper fix. llvm-svn: 296622
* Actually add error handling to unpacking the dyld compact bind andKevin Enderby2017-02-281-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | other tables. Providing a helpful error message to what the error is and where the error occurred based on which opcode it was associated with. There have been handful of bug fixes dealing with bad bind info in object files, r294021 and r249845, which only put a band aid on the problem after a bad bind table was created after unpacking from its compact info. In these cases a bind table should have never been created and an error should have simply been generated. This change puts in place the plumbing to allow checking and returning of an error when the compact info is unpacked. This follows the model of iterators that can fail that Lang Hanes designed when fixing the problem for bad archives r275316 (or r275361). This change uses one of the existing test cases that now causes an error instead of printing <<bad library ordinal>> after a bad bind table is created. The error uses the offset into the opcode table as shown with the macOS dyldinfo(1) tool to indicate where the error is and which opcode and which parameter is in error. For example the exiting test case has this lazy binding opcode table: % dyldinfo -opcodes test/tools/llvm-objdump/Inputs/bad-ordinal.macho-x86_64 … lazy binding opcodes: 0x0000 BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB(0x02, 0x00000010) 0x0002 BIND_OPCODE_SET_DYLIB_ORDINAL_IMM(2) In the test case the binary only has one library so setting the library ordinal to the value of 2 in the BIND_OPCODE_SET_DYLIB_ORDINAL_IMM opcode at 0x0002 above is an error. This now produces this error message: % llvm-objdump -lazy-bind bad-ordinal.macho-x86_64 … llvm-objdump: 'bad-ordinal.macho-x86_64': truncated or malformed object (for BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB bad library ordinal: 2 (max 1) for opcode at: 0x2) This change provides the plumbing for the error handling and one example of an error message. Other error checks and test cases will be added in follow on commits. llvm-svn: 296527
* [mips][mc] Fix a crash when disassembling odd sized sectionsSimon Dardis2017-02-241-0/+1
| | | | | | Attempt to fix failing test. llvm-svn: 296112
* Fixup r296105 - only run tests on MipsDiana Picus2017-02-241-0/+3
| | | | llvm-svn: 296111
* [mips][mc] Fix a crash when disassembling odd sized sectionsSimon Dardis2017-02-241-0/+16
| | | | | | Corresponding test. llvm-svn: 296106
* [WebAssembly] Update llvm-objdump tests for the new wasm version number.Dan Gohman2017-02-222-1/+1
| | | | llvm-svn: 295869
* Yet another fix llvm-objdump so it picks a good CPU based for Mach-O files,Kevin Enderby2017-02-103-1/+4
| | | | | | | | | | | in this case for CPU_SUBTYPE_ARM64_ALL. For this cpusubtype it should default to a cyclone CPU to give proper disassembly without a -mcpu= flag. rdar://27767188 llvm-svn: 294771
* Tweak the implementation of llvm-objdump’s -objc-meta-data option soKevin Enderby2017-02-092-0/+62
| | | | | | | | | that it works when the ObjC metadata sections end up in the __DATA_CONST or __DATA_DIRTY segments. rdar://26315238 llvm-svn: 294599
* Move test from r294430 to target-specific directoryDiana Picus2017-02-082-0/+0
| | | | | | | The test is X86-specific, and it broke on the ARM bots because they don't build the X86 target. llvm-svn: 294446
* Use dynamic symbols for ELF disassemblySam Parker2017-02-082-0/+10
| | | | | | | | | | | Disassembly currently begins from addresses obtained from the objects symbol table. For ELF, add the dynamic symbols to the list if no static symbols are available so that we can more successfully disassemble stripped binaries. Differential Revision: https://reviews.llvm.org/D29632 llvm-svn: 294430
* Fix a bug in llvm-obdump(1) with the -macho and -info-plist optionsKevin Enderby2017-02-061-0/+10
| | | | | | | | | which caused it to print more than the (__TEXT,__info_plist) if that section did not end with a null. rdar://27378808 llvm-svn: 294236
* Fix a bug in llvm-obdump(1) with the -macho and -disassemble optionsKevin Enderby2017-02-062-0/+8
| | | | | | | | | | which caused it to not disassemble the bytes a the start of the section if the section had symbols and the first symbol was not at the start of the section. rdar://30143243 llvm-svn: 294212
* Fix a bug in llvm-obdump(1) with the -objc-meta-data flag with -machoKevin Enderby2017-02-032-0/+3
| | | | | | | | which caused a hang on a malformed binary with bad bind info. rdar://29672108 llvm-svn: 294021
* Fix a bug in llvm-obdump(1) with the -macho flag disassembling an objectKevin Enderby2017-01-312-0/+3
| | | | | | | | | | | | | without symbols that makes calls through a symbol stub which were not correctly being annotated with “## symbol stub for: _foo”. Just adds the same parameters for getting the annotations from DisAsm->getInstruction() and passing them to IP->printInst() from the code above when boolean variable symbolTableWorked was true. rdar://29791952 llvm-svn: 293662
* Change the llvm-obdump(1) behavior with the -macho flag and inappropriate ↵Kevin Enderby2017-01-301-2/+3
| | | | | | | | | | | | | | | | | | file types. To better match the old darwin otool(1) behavior, when llvm-obdump(1) is used with the -macho option and the input file is not an object file simply print the file name and this message: foo: is not an object file and continue on to process other input files. Also in this case don’t exit non-zero. This should help in some OSS projects' with autoconf scripts that are expecting the old darwin otool(1) behavior. rdar://26828015 llvm-svn: 293547
* Fix llvm-objdump so it picks a good CPU based for Mach-O filesKevin Enderby2017-01-242-0/+3
| | | | | | | | | | | for CPU_SUBTYPE_ARM_V7S and CPU_SUBTYPE_ARM_V7K. For these two cpusubtypes they should default to a cortex-a7 CPU to give proper disassembly without a -mcpu= flag. rdar://27431703 llvm-svn: 292993
OpenPOWER on IntegriCloud