summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj][llvm-readelf][test] - Add a few more dynamic section tests.Georgii Rymar2020-01-141-61/+288
| | | | | | | | | | | | This adds a few more tests for dynamic section. We only had tests for simple unknown values for 64-bits target, in this patch I've added OS specific and processor specific tags. Also it tests both 32 and 64-bits targets now. It will help to fix the formatting issues we have and diagnose a possible new ones. Differential revision: https://reviews.llvm.org/D71896
* llc: Change behavior of -mcpu with existing attributeMatt Arsenault2020-01-071-1/+1
| | | | | | | | | | | Don't overwrite existing target-cpu attributes. I've often found the replacement behavior annoying, and this is inconsistent with how the fast math command line flags interact with the function attributes. Does not yet change target-features, since I think that should behave as a concatenation.
* [llvm-readobj][llvm-objdump][test] - Improve dynamic section testing.Georgii Rymar2019-12-272-105/+105
| | | | | | | This adds --strict-whitespace --match-full-lines flags to improve the testing and reveal formatting issues we have. Differential revision: https://reviews.llvm.org/D71895
* Migrate function attribute "no-frame-pointer-elim-non-leaf" to ↵Fangrui Song2019-12-241-1/+1
| | | | "frame-pointer"="non-leaf" as cleanups after D56351
* Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" ↵Fangrui Song2019-12-244-4/+4
| | | | as cleanups after D56351
* Constrain the macho-stabs test added in f72d001e099 to run on systems ↵Michael Trent2019-12-201-0/+1
| | | | | | | | | | | | | | | | configured with an x86 backend. Summary: This fixes a failure on the Builder clang-cmake-armv7-quick bot. Reviewers: lhames, jhenderson Reviewed By: lhames Subscribers: kristof.beyls, rupprecht, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71792
* llvm-objdump should ignore Mach-O stab symbols for disassembly.Michael Trent2019-12-202-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-objdump will commonly error out when disassembling a Mach-O binary with stab symbols, or when printing a Mach-O symbol table that includesstab symbols. That is because the Mach-O N_OSO symbol has been modified to include the bottom 8-bit value of the Mach-O's cpusubtype value in the section field. In general, one cannot blindly assume a stab symbol's section field is valid unless one has actually consulted the specification for the specific stab. Since objdump mostly just walks the symbol table to get mnemonics for code disassembly it's best for objdump to just ignore stab symbols. llvm-nm will do a more complete and correct job of displaying Mach-O symbol table contents. Reviewers: pete, lhames, ab, thegameg, jhenderson, MaskRay Reviewed By: thegameg, MaskRay Subscribers: MaskRay, rupprecht, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71394
* [llvm-readobj][llvm-objdump] - Cleanup testing of dynamic tags dumping.Georgii Rymar2019-12-191-65/+269
| | | | | | | | | | | | | | | | | | We have the `elf-dynamic-tags-machine-specific.yaml` input shared between the llvm-readobj and llvm-objdump test. It looks strange, because tools usually does not share inputs. Also there are following problems related: 1) `elf-dynamic-tags-machine-specific.yaml` input contains excessive YAML parts. 2) objdump's test case never test AARCH64 tags. 3) There are unknown tags in the `elf-dynamic-tags-machine-specific.yaml` and `dynamic-tags-machine-specific.test`, though we already testing unknown tags in `\llvm-readobj\ELF\dynamic-tags.test` and `llvm-objdump\elf-dynamic-section.test` tests. This patch removes the shared input and refines the test cases to resolve issues mentioned. Differential revision: https://reviews.llvm.org/D71602
* [llvm-readobj][test] - Move platform specific test cases and their inputs to ↵Georgii Rymar2019-12-101-4/+4
| | | | | | | | | | | | separate folders. This creates the next subfolders in the test directory: "COFF", "ELF", "MachO", "wasm". I've also removed platform specific prefixes, like "coff-*". One unused binary was removed as well: `Inputs/relocs.obj.elf-mips` Differential revision: https://reviews.llvm.org/D71203
* [test][tools] Add missing and improve testingJames Henderson2019-12-092-1/+3
| | | | | | | | | | | Mostly this adds testing for certain aliases in more explicit ways. There are also a few tidy-ups, and additions of missing testing, where the feature was either not tested at all, or not tested explicitly and sufficiently. Reviewed by: MaskRay, rupprecht, grimar Differential Revision: https://reviews.llvm.org/D71116
* [ELF] Support for PT_GNU_PROPERTY in header and toolsPeter Smith2019-12-041-0/+14
| | | | | | | | | | | | | The PT_GNU_PROPERTY is generated by a linker to describe the .note.gnu.property section. The Linux kernel uses this program header to locate the .note.gnu.property section. It is described in "The Linux gABI extension" Include support for llvm-readelf, llvm-readobj and the yaml reader and writers. Differential Revision: https://reviews.llvm.org/D70959
* implement printing out raw section data of xcoff objectfile for llvm-objdumpdiggerlin2019-11-192-0/+90
| | | | | | | | | | | SUMMARY: implement printing out raw section data of xcoff objectfile for llvm-objdump and option -D --disassemble-all option for llvm-objdump Reviewers: Sean Fertile Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D70255
* [llvm-objdump] Print relocation addends in hexadecimalDavid Bozier2019-11-195-10/+116
| | | | | | | | | | | | | | Summary: Matches GNU objdump. Makes debugging easier for me as I'm working out addresses from symbol+addend, so it would be good to be calculating in a single format. Reviewers: MaskRay, grimar, jhenderson, bd1976llvm Reviewed By: jhenderson Subscribers: sdardis, jrtc27, atanasyan, rupprecht, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69997
* Revert "implement printing out raw section data of xcoff objectfile for ↵Leonard Chan2019-11-182-90/+0
| | | | | | | | llvm-objdump" This reverts commit 8f8a9f3437d4517f674395da30edb59d5514f7bc. Reverting since this patch seems to break a lot of llvm buildbots.
* implement printing out raw section data of xcoff objectfile for llvm-objdumpdiggerlin2019-11-182-0/+90
| | | | | | | | | | | SUMMARY: implement printing out raw section data of xcoff objectfile for llvm-objdump and option -D --disassemble-all option for llvm-objdump Reviewers: Sean Fertile Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D70255
* [llvm-objdump] Fix spurious "The end of the file was unexpectedly ↵Sid Manning2019-11-051-0/+37
| | | | | | | | | | | | | | | | | | | | | encountered" if a SHT_NOBITS sh_offset is larger than the file size llvm-objdump -D this file: int a[100000]; int main() { return 0; } Will produce an error: "The end of the file was unexpectedly encountered". This happens because of a check in Binary.h checkOffset. (Addr + Size > M.getBufferEnd()). The sh_offset and sh_size fields can be ignored for SHT_NOBITS sections. Fix the error by changing ELFObjectFile<ELFT>::getSectionContents to use the file base for SHT_NOBITS sections. Reviewed By: grimar, MaskRay Differential Revision: https://reviews.llvm.org/D69192
* [llvm/Object] - Make ELFObjectFile::getRelocatedSection return ↵George Rimar2019-10-212-5/+26
| | | | | | | | | | | | | Expected<section_iterator> It returns just a section_iterator currently and have a report_fatal_error call inside. This change adds a way to return errors and handle them on caller sides. The patch also changes/improves current users and adds test cases. Differential revision: https://reviews.llvm.org/D69167 llvm-svn: 375408
* [yaml2obj][obj2yaml] - Do not create a symbol table by default.George Rimar2019-10-202-1/+1
| | | | | | | | | | | | | | | | | | This patch tries to resolve problems faced in D68943 and uses some of the code written by Konrad Wilhelm Kleine in that patch. Previously, yaml2obj tool always created a .symtab section. This patch changes that. With it we only create it when have a "Symbols:" tag in the YAML document or when we need to create it because it is used by another section(s). obj2yaml follows the new behavior and does not print "Symbols:" anymore when there is no symbol table. Differential revision: https://reviews.llvm.org/D69041 llvm-svn: 375361
* Reland [llvm-objdump] Use a counter for llvm-objdump -h instead of the ↵Jordan Rupprecht2019-10-171-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | section index. This relands r374931 (reverted in r375088). It fixes 32-bit builds by using the right format string specifier for uint64_t (PRIu64) instead of `%d`. Original description: When listing the index in `llvm-objdump -h`, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF). While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in `test/tools/llvm-objdump/X86/section-index.s` already covers the case of incrementing the section index counter when sections are skipped. Reviewers: grimar, jhenderson, espindola Reviewed By: grimar Subscribers: emaste, sbc100, arichardson, aheejin, arphaman, seiya, llvm-commits, MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D68848 llvm-svn: 375178
* Revert r374931 "[llvm-objdump] Use a counter for llvm-objdump -h instead of ↵Hans Wennborg2019-10-171-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | the section index." This broke llvm-objdump in 32-bit builds, see e.g. http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10925 > Summary: > When listing the index in `llvm-objdump -h`, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF). > > While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in `test/tools/llvm-objdump/X86/section-index.s` already covers the case of incrementing the section index counter when sections are skipped. > > Reviewers: grimar, jhenderson, espindola > > Reviewed By: grimar > > Subscribers: emaste, sbc100, arichardson, aheejin, arphaman, seiya, llvm-commits, MaskRay > > Tags: #llvm > > Differential Revision: https://reviews.llvm.org/D68848 llvm-svn: 375088
* [llvm-objdump] Use a counter for llvm-objdump -h instead of the section index.Jordan Rupprecht2019-10-151-9/+9
| | | | | | | | | | | | | | | | | | | Summary: When listing the index in `llvm-objdump -h`, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF). While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in `test/tools/llvm-objdump/X86/section-index.s` already covers the case of incrementing the section index counter when sections are skipped. Reviewers: grimar, jhenderson, espindola Reviewed By: grimar Subscribers: emaste, sbc100, arichardson, aheejin, arphaman, seiya, llvm-commits, MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D68848 llvm-svn: 374931
* [llvm-objdump] Adjust spacing and field width for --section-headersJordan Rupprecht2019-10-143-18/+173
| | | | | | | | | | | | | | | | | | | Summary: - Expand the "Name" column past 13 characters when any of the section names are longer. Current behavior is a staggard output instead of a nice table if a single name is longer. - Only print the required number of hex chars for addresses (i.e. 8 characters for 32-bit, 16 characters for 64-bit) - Fix trailing spaces Reviewers: grimar, jhenderson, espindola Reviewed By: grimar Subscribers: emaste, sbc100, arichardson, aheejin, seiya, llvm-commits, MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D68730 llvm-svn: 374795
* Fix test to avoid check-not matching the temp file absolute pathReid Kleckner2019-10-101-0/+3
| | | | | | Fix for PR43636 llvm-svn: 374404
* [llvm-objdump][test] Move test to X86 dir to avoid errors disassembling on ↵Jordan Rupprecht2019-10-031-0/+0
| | | | | | non-x86 llvm-svn: 373676
* [llvm-objdump] Further rearrange llvm-objdump sections for compatabilityJordan Rupprecht2019-10-035-42/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: rL371826 rearranged some output from llvm-objdump for GNU objdump compatability, but there still seem to be some more. I think this rearrangement is a little closer. Overview of the ordering which matches GNU objdump: * Archive headers * File headers * Section headers * Symbol table * Dwarf debugging * Relocations (if `--disassemble` is not used) * Section contents * Disassembly Reviewers: jhenderson, justice_adams, grimar, ychen, espindola Reviewed By: jhenderson Subscribers: aprantl, emaste, arichardson, jrtc27, atanasyan, seiya, llvm-commits, MaskRay Tags: #llvm Differential Revision: https://reviews.llvm.org/D68066 llvm-svn: 373671
* [llvm-objdump] Fix llvm-objdump --all-headers output orderGeorge Rimar2019-09-131-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Justice Adams! Made llvm-objdump --all-headers output match the order of GNU objdump for compatibility reasons. Old order of the headers output: * file header * section header table * symbol table * program header table * dynamic section New order of the headers output (GNU compatible): * file header information * program header table * dynamic section * section header table * symbol table (Relevant BugZilla Bug: https://bugs.llvm.org/show_bug.cgi?id=41830) Differential revision: https://reviews.llvm.org/D67357 llvm-svn: 371826
* [X86] Print register names in .seh_* directivesReid Kleckner2019-08-301-1/+1
| | | | | | | | | | Also improve assembler parser register validation for .seh_ directives. This requires moving X86-specific seh directive handling into the x86 backend, which addresses some assembler FIXMEs. Differential Revision: https://reviews.llvm.org/D66625 llvm-svn: 370533
* [yaml2obj][obj2yaml] - Use a single "Other" field instead of "Other", ↵George Rimar2019-08-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Visibility" and "StOther". Currenly we can encode the 'st_other' field of symbol using 3 fields. 'Visibility' is used to encode STV_* values. 'Other' is used to encode everything except the visibility, but it can't handle arbitrary values. 'StOther' is used to encode arbitrary values when 'Visibility'/'Other' are not helpfull enough. 'st_other' field is used to encode symbol visibility and platform-dependent flags and values. Problem to encode it is that it consists of Visibility part (STV_* values) which are enumeration values and the Other part, which is different and inconsistent. For MIPS the Other part contains flags for all STO_MIPS_* values except STO_MIPS_MIPS16. (Like comment in ELFDumper says: "Someones in their infinite wisdom decided to make STO_MIPS_MIPS16 flag overlapped with other ST_MIPS_xxx flags."...) And for PPC64 the Other part might actually encode any value. This patch implements custom logic for handling the st_other and removes 'Visibility' and 'StOther' fields. Here is an example of a new YAML style this patch allows: - Name: foo Other: [ 0x4 ] - Name: bar Other: [ STV_PROTECTED, 4 ] - Name: zed Other: [ STV_PROTECTED, STO_MIPS_OPTIONAL, 0xf8 ] Differential revision: https://reviews.llvm.org/D66886 llvm-svn: 370472
* [llvm-objdump] Add the missing ARMv8 subarch detectionYi Kong2019-08-282-0/+21
| | | | | | Differential Revision: https://reviews.llvm.org/D66849 llvm-svn: 370163
* [llvm-objdump] - Remove an outdated "FIXME". NFC.George Rimar2019-08-221-2/+0
| | | | | | | The bug mentioned in this test case was fixed in D63779 (r364955), which also provides a test case. llvm-svn: 369634
* [llvm-objdump] - Cleanup the error reporting.George Rimar2019-08-217-13/+13
| | | | | | | | | | | | | | | | | | | The error reporting function are not consistent. Before this change: * They had inconsistent naming (e.g. 'error' vs 'report_error'). * Some of them reported the object name, others - dont. * Some of them accepted the case when there was no error. (i.e. error code or Error had a success value). This patch tries to cleanup it a bit. It also renames report_error -> reportError, report_warning -> reportWarning and removes a full stop from messages. Differential revision: https://reviews.llvm.org/D66418 llvm-svn: 369515
* [llvm-objdump] - Remove one of `report_error` functions and improve the ↵George Rimar2019-08-201-3/+3
| | | | | | | | | | | | error reporting. One of the report_error functions was taking object::Archive::Child as an argument. It feels excessive, this patch removes it and introduce a helper function instead. Also I fixed a "TODO" in this patch what improved the message printed. Differential revision: https://reviews.llvm.org/D66468 llvm-svn: 369382
* [test/Object] - Move/rewrite 2 more test cases.George Rimar2019-08-201-0/+58
| | | | | | | | | | | | | | | This patch makes a change for test/Object tests responsible for relocations. * 2 tests were moved to llvm-readobj/llvm-objdump folders: Object/elf-reloc-no-sym.test -> tools/llvm-readobj/elf-reloc-no-sym.test Object/objdump-reloc-shared.test -> tools/llvm-objdump/relocations-in-nonreloc.test * A prerecompiled binary was removed and these tests were refactored. Differential revision: https://reviews.llvm.org/D66291 llvm-svn: 369342
* [test] - Remove precomiled openbsd-phdrs.elf-x86-64 objects.George Rimar2019-08-173-20/+22
| | | | | | | | | | | There are 2 similar openbsd-phdrs.elf-x86-64 objects committed and used in test/Object and test/tools/llvm-objdump test cases. There is no reason to have them, we can use YAML instead. Patch does that. Differential revision: https://reviews.llvm.org/D66342 llvm-svn: 369189
* [lib/Object] - Remove objdump-file-header.testGeorge Rimar2019-08-152-7/+25
| | | | | | | | | | objdump-file-header.test is placed in the wrong folder. I removed it and updated the existent llvm-objdump test cases with the updated content of the file removed. Differential revision: https://reviews.llvm.org/D66288 llvm-svn: 369004
* [llvm-objdump] Add warning messages if disassembly + source for problematic ↵Michael Pozulp2019-08-153-6/+12
| | | | | | | | | | | | | | | | | | inputs Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905 Reviewers: jhenderson, rupprecht, grimar Reviewed By: jhenderson, grimar Subscribers: RKSimon, MaskRay, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62462 llvm-svn: 368963
* [llvm-objdump] - Add a relocation-xindex-symbol.test test case.George Rimar2019-08-141-0/+36
| | | | | | | | | This rewrites the exitent test case to use YAML instead of the precompiled object and moves it from test/Object to an appropriate llvm-objdump tests folder. Differential revision: https://reviews.llvm.org/D66140 llvm-svn: 368811
* Revert "[llvm-objdump] Re-commit r367284."Michael Pozulp2019-08-053-12/+6
| | | | | | | | This reverts r367776 (git commit d34099926e909390cb0254bebb4b7f5cf15467c7). My changes to llvm-objdump tests caused them to fail on windows: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/27368 llvm-svn: 367816
* [llvm-objdump] Re-commit r367284.Michael Pozulp2019-08-043-6/+12
| | | | | | | | | | | | | | | | | | Add warning messages if disassembly + source for problematic inputs Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905 Reviewers: jhenderson, rupprecht, grimar Reviewed By: jhenderson, grimar Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62462 llvm-svn: 367776
* Move macho-data-in-code.ll to X86/macho-data-in-code.ll (to only run when ↵Kuba Mracek2019-08-011-0/+0
| | | | | | x86 is a valid target). llvm-svn: 367583
* [llvm-objdump] Fix jumptable detection when disassembling Mach-O binariesKuba Mracek2019-08-011-0/+45
| | | | | | | | | | | - Add LC_SEGMENT_64 handling in getSectionsAndSymbols to be able to find the base segment address from 64-bit Mach-O binaries. - Add "data in code" detection into the !symbolTableWorked case, extract it into a separate function. - Fix uninitialized variable usage on BaseSegmentAddress (initialize to 0). - Add test. Differential Revision: https://reviews.llvm.org/D65491 llvm-svn: 367578
* Revert "[llvm-objdump] Add warning messages if disassembly + source for ↵Michael Pozulp2019-07-303-12/+6
| | | | | | | | | | problematic inputs" This reverts r367284 (git commit b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772). My changes to LLVMSymbolizer caused a test to fail: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29488 llvm-svn: 367286
* [llvm-objdump] Add warning messages if disassembly + source for problematic ↵Michael Pozulp2019-07-303-6/+12
| | | | | | | | | | | | | | | | | | inputs Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905 Reviewers: jhenderson, rupprecht, grimar Reviewed By: jhenderson, grimar Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62462 llvm-svn: 367284
* [llvm-objdump] Emit warning if --start-address/--stop-address specify range ↵Yuanfang Chen2019-07-241-0/+200
| | | | | | | | | | | | | | | | | outside file's address range. NB: the warning is about the input file itself regardless of the options used such as `-r`, `-s` etc.. https://bugs.llvm.org/show_bug.cgi?id=41911 Reviewers: jhenderson, grimar, MaskRay, rupprecht Reviewed by: MaskRay, jhenderson Differential Revision: https://reviews.llvm.org/D64779 llvm-svn: 366923
* [llvm-objdump] - Import the test/Object/X86/no-start-symbol.test test case ↵George Rimar2019-07-241-0/+28
| | | | | | | | | | | | | | and rewrite it to use YAML. This patch removes test/Object/X86/no-start-symbol.test (rewrites it to use YAML and moves it to llvm-objdump tests folder). (This test was initially introduced in rL239039, but now there is no reason to keep the precompiled binary it seems). DIfferential revision: https://reviews.llvm.org/D65136 llvm-svn: 366896
* [llvm-objdump] Keep warning for --disassemble-functions in correct order.Yuanfang Chen2019-07-091-1/+11
| | | | | | | | | | | | | | relative to normal output when dumping archive files. prepare for PR35351. Reviewers: jhenderson, grimar, MaskRay, rupprecht Reviewed by: MaskRay, jhenderson Differential Revision: https://reviews.llvm.org/D64165 llvm-svn: 365564
* Add lit.local.cfg to llvm-objdump testsSteven Wu2019-07-092-1/+2
| | | | | | | Add configuration file to llvm-objdump tests to treat files with .yaml extension as tests. llvm-svn: 365519
* Teach the symbolizer lib symbolize objects directly.Yuanfang Chen2019-07-081-0/+49
| | | | | | | | | | | | | | Currently, the symbolizer lib can only symbolize a file on disk. This patch teaches the symbolizer lib to symbolize objects. llvm-objdump needs this to support archive disassembly with source info. https://bugs.llvm.org/show_bug.cgi?id=41871 Reviewed by: jhenderson, grimar, MaskRay Differential Revision: https://reviews.llvm.org/D63521 llvm-svn: 365376
* [macCatalyst] Print out macCatalyst in llvm-objdump for the platformAlex Lorenz2019-07-031-1/+1
| | | | | | 'macCatalyst' is more readable than 'maccatalyst'. llvm-svn: 365064
* Add support for the 'macCatalyst' MachO platformAlex Lorenz2019-07-021-0/+54
| | | | | | | | | Mac Catalyst is a new MachO platform in macOS Catalina. It always uses the build_version MachO load command. Differential Revision: https://reviews.llvm.org/D64107 llvm-svn: 364981
OpenPOWER on IntegriCloud