summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* .Fangrui Song2019-04-071-17/+8
| | | | llvm-svn: 357856
* [llvm-objdump] Simplify Expected<T> handling with unwrapOrErrorFangrui Song2019-04-074-327/+170
| | | | llvm-svn: 357855
* [llvm-objdump] Simplify disassembleObjectFangrui Song2019-04-071-79/+48
| | | | | | | | * Use std::binary_search to replace some std::lower_bound * Use llvm::upper_bound to replace some std::upper_bound * Use format_hex and support::endian::read{16,32} llvm-svn: 357853
* Change some StringRef::data() reinterpret_cast to bytes_begin() or ↵Fangrui Song2019-04-072-4/+2
| | | | | | arrayRefFromStringRef() llvm-svn: 357852
* Fix typoed variable name.Eric Christopher2019-03-281-4/+4
| | | | | | NFCI. llvm-svn: 357138
* [llvm-objdump] Support arg grouping for -j and -M (e.g. llvm-objdump -sj.foo ↵Jordan Rupprecht2019-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | -dMreg-names-raw) Summary: r354375 added support for most objdump groupings, but didn't add support for -j|--sections, because that wasn't possible. r354870 added --disassembler options, but grouping still wasn't available. r355185 supported values for grouped options. This just puts the three of them together. This supports -j in modes like `-s -j .foo`, `-sj .foo`, `-sj=.foo`, or `-sj.foo`, and similar for `-M`. Reviewers: ormris, jhenderson, ikudrin Reviewed By: jhenderson, ikudrin Subscribers: javed.absar, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59618 llvm-svn: 356697
* [llvm-objdump] Should print unknown d_tag in hex formatXing GUO2019-03-021-9/+2
| | | | | | | | | | | | | | | | | | Summary: Currently, `llvm-objdump` prints "unknown" instead of d_tag value in hex format. Because getDynamicTagAsString returns "unknown" rather than empty string. Reviewers: grimar, jhenderson Reviewed By: jhenderson Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58763 llvm-svn: 355262
* [llvm-objdump] Should print strings when dumping DT_RPATH, DT_RUNPATH, ↵Xing GUO2019-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DT_SONAME, DT_AUXILIARY and DT_FILTER tags in dynamic section. Summary: Before: ``` Dynamic Section: NEEDED libpthread.so.0 ... NEEDED ld-linux-x86-64.so.2 RPATH 0x00000000001c2e61 ``` After: ``` Dynamic Section: NEEDED libpthread.so.0 ... NEEDED ld-linux-x86-64.so.2 RPATH $ORIGIN/../lib ``` Only a small problem here, I have no idea on choosing test case. I see there's a test file(test/tools/llvm-objdump/private-headers-dynamic-section.test). But it has no DT_RPATH and DT_RUNPATH tags. Shall I replace the ELF file in the Inputs dir by a new one? Reviewers: jhenderson, grimar Reviewed By: jhenderson Subscribers: srhines, rupprecht, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58707 llvm-svn: 355001
* [DebugInfo] add SectionedAddress to DebugInfo interfaces.Alexey Lapshin2019-02-272-24/+28
| | | | | | | | | | | | | | | | | That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703 "wrong line number info for obj file compiled with -ffunction-sections" bug. The problem happened with only .o files. If object file contains several .text sections then line number information showed incorrectly. The reason for this is that DwarfLineTable could not detect section which corresponds to specified address(because address is the local to the section). And as the result it could not select proper sequence in the line table. The fix is to pass SectionIndex with the address. So that it would be possible to differentiate addresses from various sections. With this fix llvm-objdump shows correct line numbers for disassembled code. Differential review: https://reviews.llvm.org/D58194 llvm-svn: 354972
* [llvm-objdump] Add `Version Definitions` dumperXing GUO2019-02-261-3/+44
| | | | | | | | | | | | | | | | Summary: `llvm-objdump` needs a `Version Definitions` dumper. Reviewers: grimar, jhenderson Reviewed By: grimar, jhenderson Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58615 llvm-svn: 354871
* [llvm-objdump] Implement -Mreg-names-raw/-std options.Igor Kudrin2019-02-261-0/+13
| | | | | | | | | | | | | | The --disassembler-options, or -M, are used to customize the disassembler and affect its output. The two implemented options allow selecting register names on ARM: * With -Mreg-names-raw, the disassembler uses rNN for all registers. * With -Mreg-names-std it prints sp, lr and pc for r13, r14 and r15, which is the default behavior of llvm-objdump. Differential Revision: https://reviews.llvm.org/D57680 llvm-svn: 354870
* [llvm-objdump] Add `Version References` dumperXing GUO2019-02-253-1/+74
| | | | | | | | | | | | | | | | Summary: Add symbol version dumper for [#30241](https://bugs.llvm.org/show_bug.cgi?id=30241) Reviewers: jhenderson, MaskRay, kristina, emaste, grimar Reviewed By: jhenderson, grimar Subscribers: grimar, rupprecht, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D54697 llvm-svn: 354782
* Revert "Revert "[llvm-objdump] Allow short options without arguments to be ↵Matthew Voss2019-02-192-19/+27
| | | | | | | | | | | | grouped"" - Tests that use multiple short switches now test them grouped and ungrouped. - Ensure the output of ungrouped and grouped variants is identical Differential Revision: https://reviews.llvm.org/D57904 llvm-svn: 354375
* [yaml2obj] - Do not skip zeroes blocks if there are relocations against them.George Rimar2019-02-191-10/+16
| | | | | | | | | | | This is for -D -reloc combination. With this patch, we do not skip the zero bytes that have a relocation against them when -reloc is used. If -reloc is not used, then the behavior will be the same. Differential revision: https://reviews.llvm.org/D58174 llvm-svn: 354319
* Revert "[llvm-objdump] Allow short options without arguments to be grouped"Matthew Voss2019-02-142-27/+19
| | | | | | | | Reverted due to failures on the llvm-hexagon-elf. This reverts commit 77e1f27476c89f65eeb496d131065177e6417f23. llvm-svn: 354002
* [llvm-objdump] Allow short options without arguments to be groupedMatthew Voss2019-02-142-19/+27
| | | | | | | | | | | | | | | | Summary: https://bugs.llvm.org/show_bug.cgi?id=31679 Reviewers: kristina, jhenderson, grimar, jakehehrlich, rupprecht Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57904 llvm-svn: 353998
* [WebAssembly] clang-tidy (NFC)Heejin Ahn2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes clang-tidy warnings on wasm-only files. The list of checks used is: `-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*` (LLVM's default .clang-tidy list is the same except it does not have `modernize-*`. But I've seen in multiple CLs in LLVM the modernize style was recommended and code was fixed based on the style, so I added it as well.) The common fixes are: - Variable names start with an uppercase letter - Function names start with a lowercase letter - Use `auto` when you use casts so the type is evident - Use inline initialization for class member variables - Use `= default` for empty constructors / destructors - Use `using` in place of `typedef` Reviewers: sbc100, tlively, aardappel Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D57500 llvm-svn: 353075
* [WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_Sam Clegg2019-02-041-1/+1
| | | | | | | | | | | | | | | | See https://github.com/WebAssembly/tool-conventions/pull/95. This is less typing and IMHO more readable, and it also fits with our naming around the binary format which tends to use the short name. e.g. include/llvm/BinaryFormat/Wasm.h tools/llvm-objdump/WasmDump.cpp etc.. Differential Revision: https://reviews.llvm.org/D57611 llvm-svn: 353062
* [llvm-objdump] - llvm-objdump can skip bytes at the end of a section.Sid Manning2019-02-011-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D57549 llvm-svn: 352900
* [ELF] Return the section name when calling getSymbolName on a section symbol.Matt Davis2019-01-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, llvm-nm would report symbols for .debug and .note sections as: '?' with an empty section name: ``` 00000000 ? 00000000 ? ... ``` With this patch the output more closely resembles GNU nm: ``` 00000000 N .debug_abbrev 00000000 n .note.GNU-stack ... ``` This patch calls `getSectionName` for sections that belong to symbols of type `ELF::STT_SECTION`, which returns the name of the section from the section string table. Reviewers: Bigcheese, davide, jhenderson Reviewed By: davide, jhenderson Subscribers: rupprecht, jhenderson, llvm-commits Differential Revision: https://reviews.llvm.org/D57105 llvm-svn: 352785
* [llvm-objdump] - Restore a piece of code removed by mistake in r352366.George Rimar2019-01-281-0/+3
| | | | | | | | | | | Seems when committed the r352366 ("[llvm-objdump] - Print LMAs when dumping section headers.") I resolved merge conflict incorrectly and removed this piece by mistake. Bots did not catch this yet, seems they are slow today, but the `X86/adjust-vma.test` test case fails locally for me without that. llvm-svn: 352383
* [llvm-objdump] - Print LMAs when dumping section headers.George Rimar2019-01-283-9/+68
| | | | | | | | | | | | When --section-headers is used, GNU objdump prints both LMA and VMA for sections. llvm-objdump does not do that what makes it's output be slightly inconsistent. Patch teaches llvm-objdump to print LMA/VMA for ELF file formats. The behavior for other formats remains unchanged. Differential revision: https://reviews.llvm.org/D57146 llvm-svn: 352366
* [llvm-objdump] - Fix comment. NFC.George Rimar2019-01-281-1/+1
| | | | | | | This was mentioned by James Henderson in review for https://reviews.llvm.org/D57051. llvm-svn: 352348
* [llvm-objdump] - Implement the --adjust-vma option.George Rimar2019-01-281-4/+38
| | | | | | | | | | | | | | | | | GNU objdump's help says: "--adjust-vma: Add OFFSET to all displayed section addresses" In real life what it does is a bit more complicated (and IMO not always reasonable. For example, GNU objdump prints not only VMA, but also LMA for sections. And with --adjust-vma it adjusts LMA, but only when a section has relocations. llvm-objsump does not seem to support printing LMAs yet, but GNU's logic anyways does not make sense for me here). This patch tries to adjust VMA. I tried to implement a reasonable approach. I am not adjusting sections that are not allocatable. As, for example, adjusting debug sections VA's and rel[a] sections VA's should not make sense. This behavior seems to be GNU compatible. Differential revision: https://reviews.llvm.org/D57051 llvm-svn: 352347
* [llvm-objdump] - Move common code to a new printRelocation() helper. NFC.George Rimar2019-01-231-23/+20
| | | | | | This extracts the common code for printing relocations into a new helper function. llvm-svn: 351951
* [llvm-objdump] - Move variable. NFC.George Rimar2019-01-231-4/+5
| | | | | | It was too far from the place where it is used. llvm-svn: 351942
* [llvm-objdump] - Split disassembleObject() into two methods. NFCI.George Rimar2019-01-231-60/+69
| | | | | | | | | | | | Currently, disassembleObject() is a ~550 lines length function. This patch splits it into two, where first do all helper objects initializations and calls the second which does all the rest job. This is a straightforward split. Differential revision: https://reviews.llvm.org/D57020 llvm-svn: 351940
* [llvm-objdump] - Introduce getRelocsMap() helper. NFCI.George Rimar2019-01-221-22/+21
| | | | | | | | | | Currently disassembleObject() is a ~550 lines length function. This patch extracts the code that creates a section->their relocation mapping into a new helper function to simplify/reduce it a bit. Differential revision: https://reviews.llvm.org/D57019 llvm-svn: 351824
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-197-28/+21
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert r351529 "[llvm-objdump][NFC] Improve readability."Clement Courbet2019-01-181-34/+29
| | | | | | msan errors in ELF/strip-all.s. llvm-svn: 351556
* Reland r351529 "[llvm-objdump][NFC] Improve readability."Clement Courbet2019-01-181-29/+34
| | | | | | | | `SectionSymbol*` is cast from `void*` to `std::tuple<uint64_t, StringRef, uint8_t>` in AMDGPUSymbolizer, so it has to *be* one, not *act like* one. llvm-svn: 351553
* [llvm-objdump] - Dump the archive headers when -all-headers is specified.George Rimar2019-01-181-2/+2
| | | | | | | | | | | When -all-headers is given it is supposed to dump all headers, but now it skips the archive headers for no reason. The patch fixes that. Differential revision: https://reviews.llvm.org/D56780 llvm-svn: 351547
* [llvm-objdump] - Move getRelocationValueString and dependenices out of the ↵George Rimar2019-01-186-433/+459
| | | | | | | | | | | | | | | | | | | | llvm-objdump.cpp getRelocationValueString is a dispatcher function that calls the corresponding ELF/COFF/Wasm/MachO implementations that currently live in the llvm-objdump.cpp file. These implementations better be moved to ELFDump.cpp, COFFDump.cpp and other corresponding files, to move platform specific implementation out from the common logic. The patch does that. Also, I had to move ToolSectionFilter helper and SectionFilterIterator, SectionFilter to a header to make them available across the objdump code. Differential revision: https://reviews.llvm.org/D56842 llvm-svn: 351545
* [llvm-objdump] - Show aliases in -help.George Rimar2019-01-181-34/+35
| | | | | | | | | | | | | | | Currently llvm-objdump is inconsistent. When -help is specified it shows no aliases except two. Aliases are shown with -help-hidden though. GNU objdump also prints them by default. This patch does a change to always show all aliases when -help is given. Differential revision: https://reviews.llvm.org/D56853 llvm-svn: 351542
* Revert r351529 "[llvm-objdump][NFC] Improve readability."Clement Courbet2019-01-181-37/+28
| | | | | | Breaks labels-branch.s llvm-svn: 351534
* [llvm-objdump][NFC] Improve readability.Clement Courbet2019-01-181-28/+37
| | | | | | | | | | | | | | Summary: Introduce a `struct SectionSymbol` instead of `tuple<uint64_t, StringRef, uint8>`. Reviewers: jhenderson, davide Subscribers: rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56858 llvm-svn: 351529
* [WebAssembly] Fixed objdump not parsing function headers.Wouter van Oortmerssen2019-01-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: objdump was interpreting the function header containing the locals declaration as instructions. To parse these without injecting target specific code in objdump, MCDisassembler::onSymbolStart was added to be implemented by the WebAssembly implemention. WasmObjectFile now returns a code offset for the "address" of a symbol, rather than the index. This is also more in-line with what other targets do. Also ensured that the AsmParser correctly puts each function in its own segment to enable this test case. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56684 llvm-svn: 351460
* Move demangling function from llvm-objdump to Demangle libraryJames Henderson2019-01-171-15/+0
| | | | | | | | | | | | | | | | This allows it to be used in an upcoming llvm-readobj change. A small change in internal behaviour of the function is to always call the microsoftDemangle function if the string does not have an itanium encoding prefix, rather than only if it starts with '?'. This is harmless because the microsoftDemangle function does the same check already. Reviewed by: grimar, erik.pilkington Differential Revision: https://reviews.llvm.org/D56721 llvm-svn: 351448
* [llvm-objdump] - Fix comment. NFC.George Rimar2019-01-171-1/+1
| | | | | | Forgot to address this one. llvm-svn: 351418
* [llvm-objdump] - Simplify the getRelocationValueString. NFCI.George Rimar2019-01-171-38/+22
| | | | | | | | | | This refactors the getRelocationValueString method. It is a bit overcomplicated and it is possible to reduce it without losing the functionality it seems. Differential revision: https://reviews.llvm.org/D56778 llvm-svn: 351417
* llvm-objdump -m -D should disassemble all text segmentsMichael Trent2019-01-151-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When running llvm-objdump with the -macho option objdump will by default disassemble only the __TEXT,__text section (or __TEXT_EXEC,__text when disassembling MH_KEXT_BUNDLE files). The -disassemble-all option is treated no diferently than -disassemble. This change upates llvm-objdump's MachO parsing code to disassemble all __text sections found in a file when -disassemble-all is specified. This is useful for disassembling files with more than one __text section, or when disassembling files whose __text section is not present in __TEXT. I added a lit test case that verifies "llvm-objdump -m -d" and "llvm-objdump -m -D" produce the expected results on a reference binary. I also updated the CommandGuide documentation for llvm-objdump.rst and verified it renders correctly as man and html. rdar://42899338 Reviewers: ab, pete, lhames Reviewed By: lhames Subscribers: rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56649 llvm-svn: 351238
* [llvm-obdump] - Fix the help lines for -stop-address and -z.George Rimar2019-01-151-4/+4
| | | | | | | It was broken by me by mistake in r350823 during addressing the review comment before committing (changed not the right text line). llvm-svn: 351192
* [llvm-objdump] - Cleanup the code. NFCI.George Rimar2019-01-154-313/+285
| | | | | | | | | | | | | | | | | This is a cosmetic cleanup for the llvm-objdump code. This patch: * Renames things to match the official LLVM code style (lower case -> upper case). * Removes few obviously excessive variables. * Moves a few lines closer to the place of use, reorders the code a bit to simplify it, to avoid doing excessive returns and to avoid using 'else` after returns. I focused only on a llvm-objdump.h/llvm-objdump.cpp files. Few changes in the MachODump.cpp and COFFDump.cpp are a result of llvm-objdump.h modification. Differential revision: https://reviews.llvm.org/D56637 llvm-svn: 351171
* [llvm-objdump] - Change the output for --all-headers.George Rimar2019-01-121-5/+5
| | | | | | | | | | | This is for https://bugs.llvm.org/show_bug.cgi?id=40008, it starts printing the file headers when --all-headers is given and do a minor cosmetic change. Differential revision: https://reviews.llvm.org/D56588 llvm-svn: 351006
* [llvm-objdump][MachO] Fix error reporting after r350848 and r350849Francis Visoiu Mistrih2019-01-101-3/+5
| | | | llvm-svn: 350851
* [llvm-objdump][MachO] Use the -dsym file name when reporting errorsFrancis Visoiu Mistrih2019-01-101-2/+2
| | | | | | Instead of using the binary filename. llvm-svn: 350849
* [llvm-objdump][MachO] Correctly handle the llvm::Error when -dsym has errorsFrancis Visoiu Mistrih2019-01-101-2/+3
| | | | | | | | | In an assert build, the Error gets destroyed and we get "Program aborted due to an unhandled Error:". In release, we get an empty message. llvm-svn: 350848
* [llvm-objdump] - Do not include reserved undefined symbol in -t output.George Rimar2019-01-101-1/+8
| | | | | | | | | | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=26892, GNU objdump hides the special symbol entry: SYMBOL TABLE: 000000000000a7e0 l F .text 00000000000003f9 bi_copymodules while llvm-objdump does not: SYMBOL TABLE: 0000000000000000 *UND* 00000000 000000000000a7e0 l F .text 000003f9 bi_copymodules Patch makes the behavior of the llvm-objdump to be consistent with the GNU objdump. Differential revision: https://reviews.llvm.org/D56076 llvm-svn: 350840
* [llvm-objdump] - Implement -z/--disassemble-zeroes.George Rimar2019-01-101-1/+41
| | | | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=37151, GNU objdump spec says that "Normally the disassembly output will skip blocks of zeroes.", but currently, llvm-objdump prints them. The patch implements the -z/--disassemble-zeroes option and switches the default to always skip blocks of zeroes. Differential revision: https://reviews.llvm.org/D56083 llvm-svn: 350823
* [llvm-objdump] - Print symbol addressed when dumping disassembly output (-d)George Rimar2019-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | When GNU objdump dumps the input with -d it prints the symbol addresses, for example: 0000000000000031 <foo>: 31: 00 00 add %al,(%rax) ... llvm-objdump currently does not do that. Patch changes the behavior to match the GNU objdump. That is useful for implementing -z/--disassemble-zeroes (D56083), it allows omitting first zero bytes and keep the information about the symbol address in the output. Differential revision: https://reviews.llvm.org/D56123 llvm-svn: 350726
OpenPOWER on IntegriCloud