summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-objdump] Fix Bugzilla ID 41862 to support checking addresses of ↵Jordan Rupprecht2019-06-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | disassembled object Summary: This fixes the bugzilla id,41862 to support dealing with checking stop address against start address to support this not being a proper object to check the disasembly against like gnu objdump currently does. Reviewers: jakehehrlich, rupprecht, echristo, jhenderson, grimar Reviewed By: jhenderson Subscribers: MaskRay, smeenai, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61969 Patch by Nicholas Krause! llvm-svn: 362847
* [llvm-objdump] Add warning if --disassemble-functions specifies an unknown ↵Michael Pozulp2019-06-071-0/+12
| | | | | | | | | | | | | | | | | | | | | symbol Summary: Fixes Bug 41904 https://bugs.llvm.org/show_bug.cgi?id=41904 Re-land r362768 after it was reverted in r362826. Reviewers: jhenderson, rupprecht, grimar, MaskRay Reviewed By: jhenderson, rupprecht, MaskRay Subscribers: dexonsmith, rupprecht, kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62275 llvm-svn: 362838
* Revert "[llvm-objdump] Add warning if --disassemble-functions specifies an ↵Vlad Tsyrklevich2019-06-071-12/+0
| | | | | | | | | | unknown symbol" This reverts commit 50f61af3f304a03f10d9ecb0828829f0a72d0099, it used the function introduced in the previous revert of 0bddef79019a23ab14fcdb27028e55e484674c88. llvm-svn: 362826
* [llvm-objdump] Print source when subsequent lines in the translation unit ↵Michael Pozulp2019-06-071-2/+3
| | | | | | | | | | | | | | | | come from the same line in two different headers. Reviewers: grimar, rupprecht, jhenderson Reviewed By: grimar, jhenderson Subscribers: llvm-commits, jhenderson Tags: #llvm Differential Revision: https://reviews.llvm.org/D62461 llvm-svn: 362771
* [llvm-objdump] Add warning if --disassemble-functions specifies an unknown ↵Michael Pozulp2019-06-071-0/+12
| | | | | | | | | | | | | | | | | | symbol Summary: Fixes Bug 41904 https://bugs.llvm.org/show_bug.cgi?id=41904 Reviewers: jhenderson, rupprecht, grimar, MaskRay Reviewed By: jhenderson, rupprecht, MaskRay Subscribers: dexonsmith, rupprecht, kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62275 llvm-svn: 362768
* [llvm-objdump] - Disassemble non-executable sections if specifically requested.George Rimar2019-06-051-1/+2
| | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=41897. Previously -d + -j .data had no effect, that wasn't consistent with GNU, which proccesses .data in that case. With this patch we follow this behavior. Diffeential revision: https://reviews.llvm.org/D62848 llvm-svn: 362596
* Write new tests for r362121Michael Trent2019-05-301-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The tests for r362121 ran dsymutil against a test binary every time. This caused problems on lld-x86_64-ubuntu-fast as dsymutil required a lipo tool be available to process those binaries. This change rewrites the new test cases in macho-disassemble-g-dsym to use bespoke test binaries (exe and dwarf) simplifying the test's runtime dependencies. The changes to tools/llvm-objdump/MachODump.cpp are unchanged from r362121 Reviewers: pete, lhames, JDevlieghere Reviewed By: pete Subscribers: smeenai, aprantl, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62694 llvm-svn: 362141
* Reverting change r362121 due to lld-x86_64-ubuntu-fast test failuresMichael Trent2019-05-301-57/+6
| | | | llvm-svn: 362123
* Support Universal dSYM files in llvm-objdumpMichael Trent2019-05-301-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Commonly programmers use llvm-objdump to disassemble Mach-O target binaries with Mach-O dSYMS. While llvm-objdump allows programmers to disassemble Universal binaries, it previously did not recognize Universal dSYM files. This change updates llvm-objdump to support passing in Universal files via the -dsym option. Now, when disassembling a Mach-O file either as a stand alone file or as an entry in a Universal binariy, llvm-objdump will search through a Universal dSYM for a Mach-O matching the architecture flag of the file being disassembled. Reviewers: pete, lhames Reviewed By: pete Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62642 llvm-svn: 362121
* [Object] object::ELFObjectFile::symbol_begin(): skip symbol index 0Fangrui Song2019-05-231-5/+0
| | | | | | | | | | | | | For clients iterating the symbol table, none expects to handle index 0 (STN_UNDEF). Skip it to improve consistency with other binary formats. Clients that need STN_UNDEF (e.g. lld) can use getSectionContentsAsArray(). A test will be added in D62148. Reviewed By: mtrent Differential Revision: https://reviews.llvm.org/D62296 llvm-svn: 361506
* [llvm-objdump] Dump inline relocations if the relocated section is specified ↵Fangrui Song2019-05-221-17/+17
| | | | | | | | | | | | | | with --section This fixes PR41886: llvm-objdump -d -r -j .text doesn't show inline relocations of .text While here, switch to stable_sort() because we don't want to change the order of relocations applied to the same location. gABI says consecutive relocation records are composed together and their order matters. In practise it is difficult to see relocations applied to the same location not consecutive, we just have to keep the relative order of relocations with the same offset. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D62253 llvm-svn: 361395
* Properly categorize llvm-objdump optionsSerge Guelton2019-05-222-71/+127
| | | | | | | | Filters out noise, and distinguish Mach-O related options from others. Differential Revision: https://reviews.llvm.org/D62195 llvm-svn: 361351
* [llvm-objdump] Make --disassemble-functions imply -dGeorge Rimar2019-05-211-1/+2
| | | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=41903 Patch by Mike Pozulp! Differential revision: https://reviews.llvm.org/D62054 llvm-svn: 361240
* Recommit [Object] Change object::SectionRef::getContents() to return ↵Fangrui Song2019-05-162-29/+23
| | | | | | | | | | | | Expected<StringRef> r360876 didn't fix 2 call sites in clang. Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360892
* Revert r360876 "[Object] Change object::SectionRef::getContents() to return ↵Hans Wennborg2019-05-162-23/+29
| | | | | | | | | | | | Expected<StringRef>" It broke the Clang build, see llvm-commits thread. > Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. > > Follow-up of D61781. llvm-svn: 360878
* [Object] Change object::SectionRef::getContents() to return Expected<StringRef>Fangrui Song2019-05-162-29/+23
| | | | | | | | Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360876
* AArch64: support binutils-like things on arm64_32.Tim Northover2019-05-141-2/+27
| | | | | | | | This adds support for the arm64_32 watchOS ABI to LLVM's low level tools, teaching them about the specific MachO choices and constants needed to disassemble things. llvm-svn: 360663
* [Object] Change ObjectFile::getSectionContents to return ↵Fangrui Song2019-05-141-3/+1
| | | | | | | | | | | | | | | | | | | Expected<ArrayRef<uint8_t>> Change std::error_code getSectionContents(DataRefImpl, StringRef &) const; to Expected<ArrayRef<uint8_t>> getSectionContents(DataRefImpl) const; Many object formats use ArrayRef<uint8_t> as the underlying type, which is generally better than StringRef to represent binary data, so change the type to decrease the number of type conversions. Reviewed By: ruiu, sbc100 Differential Revision: https://reviews.llvm.org/D61781 llvm-svn: 360648
* [llvm-objdump] Print st_otherFangrui Song2019-05-101-6/+24
| | | | | | | | | | | Add support for ".hidden" ".internal" ".protected" and " 0x%02x" for other st_other bits used by some architectures. Reviewed By: sfertile Differential Revision: https://reviews.llvm.org/D61718 llvm-svn: 360439
* [Object] Change SymbolicFile::printSymbolName to use ErrorFangrui Song2019-05-101-1/+1
| | | | llvm-svn: 360414
* [llvm-objdump] - Print relocation record in a GNU format.George Rimar2019-05-071-11/+23
| | | | | | | | | | | | | | | This fixes the https://bugs.llvm.org/show_bug.cgi?id=41355. Previously with -r we printed relocation section name instead of the target section name. It was like this: "RELOCATION RECORDS FOR [.rel.text]" Now it is: "RELOCATION RECORDS FOR [.text]" Also when relocation target section has more than one relocation section, we did not combine the output. Now we do. Differential revision: https://reviews.llvm.org/D61312 llvm-svn: 360143
* [Object] Change getSectionName() to return Expected<StringRef>Fangrui Song2019-05-021-14/+11
| | | | | | | | | | Summary: It currently receives an output parameter and returns std::error_code. Expected<StringRef> fits for this purpose perfectly. Differential Revision: https://reviews.llvm.org/D61421 llvm-svn: 359774
* [llvm-objdump] Print newlines before and after "Disassembly of section ...:"Fangrui Song2019-05-011-2/+2
| | | | | | | | | | | This improves readability and the behavior is consistent with GNU objdump. The new test test/tools/llvm-objdump/X86/disassemble-section-name.s checks we print newlines before and after "Disassembly of section ...:" Differential Revision: https://reviews.llvm.org/D61127 llvm-svn: 359668
* [llvm-objdump] errorToErrorCode+message -> toStringFangrui Song2019-04-251-4/+3
| | | | | | For test/Object/elf-invalid-phdr.test, the intended error message got lost due to errorToErrorCode(). llvm-svn: 359166
* Revert "[llvm-objdump] errorToErrorCode+message -> toString"JF Bastien2019-04-241-3/+4
| | | | | | | | Revert r359100 It breaks llvm/test/Object/elf-invalid-phdr.test llvm-svn: 359110
* [llvm-objdump] Delete redundant checkFangrui Song2019-04-241-4/+1
| | | | llvm-svn: 359102
* [llvm-objdump] errorToErrorCode+message -> toStringFangrui Song2019-04-241-4/+3
| | | | llvm-svn: 359100
* [CommandLine] Provide parser<unsigned long> instantiation to allow ↵Fangrui Song2019-04-241-5/+6
| | | | | | | | | | | | | cl::opt<uint64_t> on LP64 platforms Summary: And migrate opt<unsigned long long> to opt<uint64_t> Fixes PR19665 Differential Revision: https://reviews.llvm.org/D60933 llvm-svn: 359068
* [llvm-objdump] Fix End in disassemblyObject after rL358806Fangrui Song2019-04-201-3/+3
| | | | llvm-svn: 358809
* [llvm-objdump] Don't disassemble symbols before SectionAddrFangrui Song2019-04-201-4/+6
| | | | | | | | | This was caught by UBSAN tools/llvm-objdump/X86/macho-disassembly-g-dsym.test tools/llvm-objdump/X86/hex-displacement.test llvm-svn: 358806
* [llvm-objdump] Simplify --{start,stop}-addressFangrui Song2019-04-201-23/+13
| | | | llvm-svn: 358803
* Change some llvm::{lower,upper}_bound to llvm::bsearch. NFCFangrui Song2019-04-171-22/+19
| | | | llvm-svn: 358564
* [llvm-objdump] Align instructions to a tab stop in disassembly outputFangrui Song2019-04-161-5/+18
| | | | | | | | | | | | | | | | | | | | | | | This relands D60376/rL358405, with the difference: sed 'y/\t/ /' -> tr '\t' ' ' BSD sed doesn't support escape characters for the 'y' command. I didn't use it in rL358405 because it was not listed at https://llvm.org/docs/GettingStarted.html#software but it should be available. Original description: In GNU objdump, -w/--wide aligns instructions in the disassembly output. This patch does the same to llvm-objdump. However, we always use the wide format (-w/--wide is ignored), because the narrow format (instructions are misaligned) is probably not very useful. In llvm-readobj, we made a similar decision: always use the wide format, accept but ignore -W/--wide. To save some columns, we change the tab before hex bytes (controlled by --[no-]show-raw-insn) to a space. llvm-svn: 358474
* [llvm-objdump] Simplify PrintHelpMessage() logicFangrui Song2019-04-161-28/+9
| | | | | | | | This relands rL358418. It missed one test that should also use -macho Note, all the other -private-header -exports-trie tests are used together with -macho. llvm-svn: 358472
* Revert r358405: "[llvm-objdump] Align instructions to a tab stop in ↵Alex Lorenz2019-04-151-18/+5
| | | | | | | | | disassembly output" The test fails on darwin due to a sed error: sed: 1: "y/\t/ /": transform strings are not the same length llvm-svn: 358459
* Revert r358418: "[llvm-objdump] Simplify PrintHelpMessage() logic"Alex Lorenz2019-04-151-9/+28
| | | | | | | This reverts commit r358418 as it broke `test/Object/objdump-export-list` on Darwin. llvm-svn: 358443
* [llvm-objdump] Simplify PrintHelpMessage() logicFangrui Song2019-04-151-28/+9
| | | | llvm-svn: 358418
* [llvm-objdump] Wrap things in namespace llvmFangrui Song2019-04-155-115/+109
| | | | llvm-svn: 358417
* [llvm-objdump] Delete unused forward declarationsFangrui Song2019-04-151-2/+0
| | | | llvm-svn: 358416
* [llvm-objdump] Reorganize cl::opt variables and move Mach-O specifics to ↵Fangrui Song2019-04-153-294/+284
| | | | | | MachODump.cpp llvm-svn: 358415
* [llvm-objdump] Align instructions to a tab stop in disassembly outputFangrui Song2019-04-151-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In GNU objdump, -w/--wide aligns instructions in the disassembly output. This patch does the same to llvm-objdump. However, we always use the wide format (-w/--wide is ignored), because the narrow format (instructions are misaligned) is probably not very useful. In llvm-readobj, we made a similar decision: always use the wide format, accept but ignore -W/--wide. To save some columns, we change the tab before hex bytes (controlled by --[no-]show-raw-insn) to a space. Reviewers: rupprecht, jhenderson, grimar Reviewed By: jhenderson Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60376 llvm-svn: 358405
* [llvm-objdump] Don't print trailing space in dumpBytesFangrui Song2019-04-101-3/+3
| | | | | | | In disassembly output, dumpBytes prints a space, followed by a tab printed by printInstr. Remove the extra space. llvm-svn: 358045
* [llvm-objdump] Accept and ignore --wide/-wFangrui Song2019-04-101-0/+4
| | | | | | | | | This is similar to what we do for llvm-readobj (--wide/-W is for GNU readelf compatibility). The test will be added in D60376. llvm-svn: 358043
* [llvm-objdump] Migrate some functions from std::error_code to ErrorFangrui Song2019-04-094-38/+28
| | | | llvm-svn: 357965
* [BinaryFormat] Update Mach-O ARM64E CPU subtype and dumpingShoaib Meenai2019-04-081-0/+7
| | | | | | | | | The new value is taken from <mach/machine.h> in the MacOSX10.14 SDK from Xcode 10.1. Update llvm-objdump and llvm-readobj accordingly. Differential Revision: https://reviews.llvm.org/D58636 llvm-svn: 357945
* [llvm-objdump] Migrate relocation handling functions from error_code to ErrorFangrui Song2019-04-086-50/+49
| | | | llvm-svn: 357920
* [llvm-objdump] Fix MC/ARM/arm-macho-calls.sFangrui Song2019-04-081-2/+1
| | | | llvm-svn: 357880
* [llvm-objdump] Split disassembleObject and simplify --{start,stop}-address ↵Fangrui Song2019-04-071-109/+116
| | | | | | | | | | | | | handling The main disassembly loop is hard to read due to special handling of ARM ELF data & ELF data. Split off the logic into two functions dumpARMELFData and dumpELFData. Hoist some checks outside of the loop. --start-address --stop-address have redundant checks and minor off-by-1 issues. Fix them. llvm-svn: 357869
* [llvm-objdump] Fix split of source lines; don't ltrim source linesFangrui Song2019-04-071-20/+16
| | | | | | | | | If the file does not end with a newline, it may be dropped. Fix the splitting algorithm. Also delete an unnecessary SourceCache lookup. llvm-svn: 357858
* [llvm-objdump] Simplify some ELF typename: ELFFile<ELFT>::Elf_xxx -> ELFT::xxxFangrui Song2019-04-071-11/+4
| | | | llvm-svn: 357857
OpenPOWER on IntegriCloud