summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-readobj
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj/llvm-readelf] - Eliminate the elf-groups.x86_64 precompiled ↵George Rimar2019-06-243-62/+80
| | | | | | | | | | | | | | | | binary from the inputs. We do not need the elf-groups.x86_64. In one of the tests, it was used for no solid reason, and for the second test case we can use YAML input with SHT_GROUP sections. The patch performs a cleanup of one of the test cases, removes another one completely (since during the review was found out it actually duplicates one of the existent tests) and removes the precompiled binary. Differential revision: https://reviews.llvm.org/D63647 llvm-svn: 364167
* [llvm-readobj] - Inline a few yaml inputs into test cases.George Rimar2019-06-216-294/+293
| | | | | | | | | There are some test that are splitted into main part + input yaml for no visible reason. This patch inines the yaml part for the 3 test cases I found. Differential revision: https://reviews.llvm.org/D63644 llvm-svn: 364049
* [binutils] Add response file option to help and docsJames Henderson2019-06-211-4/+10
| | | | | | | | | | | | | | | | | | | | | Many LLVM-based tools already support response files (i.e. files containing a list of options, specified with '@'). This change simply updates the documentation and help text for some of these tools to include it. I haven't attempted to fix all tools, just a selection that I am interested in. I've taken the opportunity to add some tests for --help behaviour, where they were missing. We could expand these tests, but I don't think that's within scope of this patch. This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and https://bugs.llvm.org/show_bug.cgi?id=42236. Reviewed by: grimar, MaskRay, jkorous Differential Revision: https://reviews.llvm.org/D63597 llvm-svn: 364036
* [llvm-readobj] Match GNU output for DT_RPATH and DT_RUNPATH when dumping ↵Yuanfang Chen2019-06-193-9/+9
| | | | | | | | | | | | | | dynamic symbol table. Reviewers: jhenderson, grimar, MaskRay, rupprecht, espindola Subscribers: emaste, nemanjai, arichardson, kbarton, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63347 llvm-svn: 363868
* [llvm-readobj] Allow --hex-dump/--string-dump to dump multiple sectionsFangrui Song2019-06-186-66/+110
| | | | | | | | | | | | | | | | | | 1) `-x foo` currently dumps one `foo`. This change makes it dump all `foo`. 2) `-x foo -x foo` currently dumps `foo` twice. This change makes it dump `foo` once. In addition, if foo has section index 9, `-x foo -x 9` dumps `foo` once. 3) Give a warning instead of an error if `foo` does not exist. The new behaviors match GNU readelf. Also, print a new line as a separator between two section dumps. GNU readelf uses two lines, but one seems good enough. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D63475 llvm-svn: 363683
* [lit] Delete empty lines at the end of lit.local.cfg NFCFangrui Song2019-06-172-2/+0
| | | | llvm-svn: 363538
* Revert "Revert r363377: [yaml2obj] - Allow setting custom section types for ↵George Rimar2019-06-142-5/+16
| | | | | | | | | | | | | | | | | | | | implicit sections." LLD test case will be fixed in a following commit. Original commit message: [yaml2obj] - Allow setting custom section types for implicit sections. We were hardcoding the final section type for sections that are usually implicit. The patch fixes that. This also fixes a few issues in existent test cases and removes one precompiled object. Differential revision: https://reviews.llvm.org/D63267 llvm-svn: 363401
* Revert r363377: [yaml2obj] - Allow setting custom section types for implicit ↵Rui Ueyama2019-06-142-16/+5
| | | | | | | | | sections. This reverts commit r363377 because lld's ELF/invalid/undefined-local-symbol-in-dso.test test started failing after this commit. llvm-svn: 363394
* [yaml2obj] - Allow setting custom section types for implicit sections.George Rimar2019-06-142-5/+16
| | | | | | | | | | | | We were hardcoding the final section type for sections that are usually implicit. The patch fixes that. This also fixes a few issues in existent test cases and removes one precompiled object. Differential revision: https://reviews.llvm.org/D63267 llvm-svn: 363377
* [llvm-readobj] Don't abort printing of dynamic table if string reference is ↵James Henderson2019-06-141-9/+44
| | | | | | | | | | | | | | | | | invalid If dynamic table is missing, output "dynamic strtab not found'. If the index is out of range, output "Invalid Offset<..>". https://bugs.llvm.org/show_bug.cgi?id=40807 Reviewed by: jhenderson, grimar, MaskRay Differential Revision: https://reviews.llvm.org/D63084 Patch by Yuanfang Chen. llvm-svn: 363374
* [llvm-readobj] - Do not fail to dump the object which has wrong type of ↵George Rimar2019-06-142-0/+11
| | | | | | | | | | | | | | | | | | | | | | .shstrtab. Imagine we have object that has .shstrtab with type != SHT_STRTAB. In this case, we fail to dump the object, though GNU readelf dumps it without any issues and warnings. This patch fixes that. It adds a code to ELFDumper.cpp which is based on the implementation of getSectionName from the ELF.h: https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L608 https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L431 https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Object/ELF.h#L539 The difference is that all non critical errors are ommitted what allows us to improve the dumping on a tool side. Also, this opens a road for a follow-up that should allow us to dump the section headers, but drop the section names in case if .shstrtab is completely absent and/or broken. Differential revision: https://reviews.llvm.org/D63266 llvm-svn: 363371
* [llvm-readobj] Fix output interleaving issue caused by using multiple ↵Jordan Rupprecht2019-06-121-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | streams at the same time. Summary: Use llvm::fouts() as the default stream for outputing. No new stream should be constructed to output at the same time. https://bugs.llvm.org/show_bug.cgi?id=42140 Reviewers: jhenderson, grimar, MaskRay, phosek, rupprecht Reviewed By: rupprecht Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63115 Patch by Yuanfang Chen! llvm-svn: 363198
* [llvm-readobj] - Do not use precompiled binary in elf-broken-dynsym-link.testGeorge Rimar2019-06-112-10/+18
| | | | | | | Now we can remove the "TODO" since https://bugs.llvm.org/show_bug.cgi?id=42216 was fixed. llvm-svn: 363045
* [llvm-readobj/llvm-readelf] - Don't fail to dump the object if .dynsym has ↵George Rimar2019-06-102-0/+60
| | | | | | | | | | | | | | | broken sh_link field. This is https://bugs.llvm.org/show_bug.cgi?id=42215. GNU readelf allows to dump the objects in that case, but llvm-readobj/llvm-readelf reports an error and stops. The patch fixes that. Differential revision: https://reviews.llvm.org/D63074 llvm-svn: 362938
* [llvm-readobj] - Remove TODOs from gnu-hash-symbols.test and demangle.test ↵George Rimar2019-06-052-22/+6
| | | | | | | | | | test cases. We can remove this TODOs now. Differential revision: https://reviews.llvm.org/D62846 llvm-svn: 362614
* [llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support DT_PPC_GOT and DT_PPC_OPTFangrui Song2019-06-052-13/+70
| | | | | | | | | | | | | | In glibc, DT_PPC_GOT indicates that PowerPC32 Secure PLT ABI is used. I plan to use it in D62464. DT_PPC_OPT currently indicates if a TLSDESC inspired TLS optimization is enabled. Reviewed By: grimar, jhenderson, rupprecht Differential Revision: https://reviews.llvm.org/D62851 llvm-svn: 362569
* [AArch64][ELF][llvm-readobj] Add support for BTI and PAC dynamic tagsPeter Smith2019-06-042-0/+60
| | | | | | | | | | | | | | | | | | | | | | | ELF for the 64-bit Arm Architecture defines two processor-specific dynamic tags: DT_AARCH64_BTI_PLT 0x70000001, d_val DT_AARCH64_PAC_PLT 0x70000003, d_val These presence of these tags indicate that PLT sequences have been protected using Branch Target Identification and Pointer Authentication respectively. The presence of both indicates that the PLT sequences have been protected with both Branch Target Identification and Pointer Authentication. This patch adds the tags and tests for llvm-readobj and yaml2obj. As some of the processor specific dynamic tags overlap, this patch splits them up, keeping their original default value if they were not previously mentioned explicitly in a switch case. Differential Revision: https://reviews.llvm.org/D62596 llvm-svn: 362493
* [AARCH64][ELF][llvm-readobj] Support for AArch64 .note.gnu.propertyPeter Smith2019-06-041-0/+38
| | | | | | | | | | | | | | | | | | ELF for the 64-bit Arm Architecture defines a processor specific property type GNU_PROPERTY_AARCH64_FEATURE_1_AND as GNU_PROPERTY_LOPROC. This property works in a similar way to the existing X86 processor specific property GNU_PROPERTY_GNU_X86_FEATURE_1_AND. Two feature bits are defined for GNU_PROPERTY_AARCH64_FEATURE_1_AND: - GNU_PROPERTY_AARCH64_FEATURE_1_BTI 0x1 - GNU_PROPERTY_AARCH64_FEATURE_1_PAC 0x2 This patch defines the property, feature bits and implements support for printing in llvm-readobj. Differential Revision: https://reviews.llvm.org/D62595 llvm-svn: 362490
* [llvm-ar] Reapply Fix relative thin archive path handlingOwen Reynolds2019-06-041-3/+3
| | | | | | | | | | Includes a fix for an introduced build failure due to a post c++11 use of std::mismatch. This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362484
* Revert "[llvm-ar] Fix relative thin archive path handling"Dmitri Gribenko2019-06-031-3/+3
| | | | | | | | | | This reverts commit r362407. It broke compilation of llvm/lib/Object/ArchiveWriter.cpp: error: type 'llvm::sys::path::const_iterator' does not provide a call operator llvm-svn: 362413
* [llvm-ar] Fix relative thin archive path handlingOwen Reynolds2019-06-031-3/+3
| | | | | | | | This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362407
* [llvm-readobj] - Convert gnu-sections.test to use YAML.George Rimar2019-06-032-41/+113
| | | | | | | | | | | | | | | | | gnu-sections.test currently use relocs.obj.elf-x86_64 and relocs.obj.elf-i386 precompiled objects as an inputs. These inputs actually initially were introduced to test the dump of relocations and have almost nothing common with dumping sections. Patch converts the test to use yaml2obj. That allows to remove relocs.obj.elf-i386 binary. (relocs.obj.elf-x86_64 is still used by another test and can't be removed atm). Differential revision: https://reviews.llvm.org/D62659 llvm-svn: 362377
* [llvm-readobj/llvm-readelf] - Remove gnu-relocations.test completely.George Rimar2019-06-033-111/+259
| | | | | | | | | | | | | | | | | | | | | | rL362089 introduced a set of yaml based reloc-types-*.test test cases (instead of huge reloc-types.test that used a lot of precompiled binaries) These test cases checks LLVM-styled dumping of the relocations. gnu-relocations.test was a test case to check GNU styled relocations dumping. It did that only for elf-x86 and elf-x86_64 targets. It did not test all of the relocations though. Now, after rL362089, it does not make sence to keep it. This patch updates reloc-types-elf-i386.test and reloc-types-elf-x64.test tests with llvm-readelf calls to check GNU styled output in one place. It removes gnu-relocations.test completely. One of intentions of doing this is also to get rid of relocs.obj.elf-i386 and relocs.obj.elf-x86_64 precompiled objects completely (they are used in other tests still). Differential revision: https://reviews.llvm.org/D62655 llvm-svn: 362374
* [llvm-readobj] - Remove excessive `dynamic.test`George Rimar2019-05-313-248/+0
| | | | | | | | | | | | | | | | | | | | | | | | | dynamic.test is a test that checks dumping of dynamic tags. It uses precompiled objects as inputs and it is completely excessive nowadays: Now we have elf-dynamic-tags-machine-specific.test and elf-dynamic-tags.test. (https://github.com/llvm-mirror/llvm/blob/master/test/tools/llvm-readobj/elf-dynamic-tags-machine-specific.test) (https://github.com/llvm-mirror/llvm/blob/master/test/tools/llvm-readobj/elf-dynamic-tags.test) First is used to check target specific tags and second tests the common flags. These tests use YAML, which is much better than using precompiled binaries. Note that new reviews tend to update the YAML based tests to add new tags, e.g. see D62596. With this patch it became possible to remove dynamic-table-so.aarch64 binary from the inputs folder. (other binaries are still used in other tests). Differential revision: https://reviews.llvm.org/D62728 llvm-svn: 362224
* [llvm-readobj] - Rewrite reloc-types.test to use YAML. NFCI.George Rimar2019-05-3021-699/+1843
| | | | | | | | | | | | | | | | | | | | | | This change rewrites and splits reloc-types.test to use yaml2obj instead of precompiled binaries. That allowed to remove 7 precompiled objects from the inputs. I took the existent objects, used obj2yaml on them, simplified the result and used yaml2obj in the test case with the result. Notes: * I converted, but did not remove relocs.obj.elf-i386, relocs.obj.elf-x86_64 or relocs.obj.elf-mips objects because found they are used in other tests. * I was unable to convert relocs.obj.elf-ppc64, because obj2yaml hangs on this file for me. * I was unable to convert relocs.obj.macho-arm, relocs.obj.macho-i386 and relocs.obj.macho-x86_64 because the output produced by obj2yaml does not seem to be correct. * Because of the above I did not remove the script for creating all of those objects: test\tools\llvm-readobj\Inputs\relocs.py Differential revision: https://reviews.llvm.org/D62594 llvm-svn: 362089
* [llvm-readobj/llvm-readelf] - Implement GNU style dumper of the ↵George Rimar2019-05-301-3/+9
| | | | | | | | | | | SHT_GNU_verdef section. It was not implemented yet, we had only LLVM style dumper implemented. Section description is here: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html Differential revision: https://reviews.llvm.org/D62520 llvm-svn: 362082
* [llvm-readobj/llvm-readelf] - Implement GNU style dumper of the ↵George Rimar2019-05-302-3/+117
| | | | | | | | | | | SHT_GNU_verneed section. It was not implemented yet, we had only LLVM style dumper implemented. Section description is here: https://refspecs.linuxfoundation.org/LSB_2.0.1/LSB-Core/LSB-Core/symverrqmts.html Differential revision: https://reviews.llvm.org/D62516 llvm-svn: 362080
* [llvm-readobj] - Repair the test case.George Rimar2019-05-291-2/+2
| | | | | | | I forgot to change the test tag in r361932. Now it is fixed. llvm-svn: 361945
* [llvm-readelf] - Allow dumping of the .dynamic section even if there is no ↵George Rimar2019-05-292-8/+24
| | | | | | | | | | | | | PT_DYNAMIC header. It is now possible after D61937 was landed and was discussed in it's review comments. It is not consistent with GNU, which does not output .dynamic section content in this case for no visible reason. Differential revision: https://reviews.llvm.org/D62179 llvm-svn: 361943
* [llvm-readobj/llvm-readelf] - Simplify the elf-versioninfo.test test case.George Rimar2019-05-293-125/+173
| | | | | | | | | | This removes 2 precompiled objects from the test case and replaces them with a single YAML. That allowed to simplify and clean up the test, remove excessive checks. Differential revision: https://reviews.llvm.org/D62529 llvm-svn: 361932
* [llvm-readobj] -u: don't crash when dumping SHT_ARM_EXIDX if .symtab doesn't ↵Fangrui Song2019-05-291-80/+83
| | | | | | | | | | exist Reviewed By: kongyi Differential Revision: https://reviews.llvm.org/D62567 llvm-svn: 361929
* Fix some llvm-readelf tests after r361633Hans Wennborg2019-05-282-2/+2
| | | | | | | | They were failing on 32-bit Windows. In the cases where I've changed test expectations, I've checked that they match the output of GNU readelf. llvm-svn: 361807
* [llvm-readobj] Implement GNU-style output for dynamic tableSimon Atanasyan2019-05-248-166/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | GNU readelf tool prints slightly different dynamic table "header" and surrounds dynamic tag names by brackets. This patch implements the same formatting for GNU-style output of the `llvm-readobj`. LLVM ``` DynamicSection [ (13 entries) Tag Type Name/Value 0x00000006 SYMTAB 0x168 ... ] ``` GNU ``` Dynamic section at offset 0x1d0 contains 13 entries: Tag Type Name/Value 0x00000006 (SYMTAB) 0x168 ... ``` Differential Revision: https://reviews.llvm.org/D62256 llvm-svn: 361633
* Revert r361630 "[llvm-readelf] - Allow dumping of the .dynamic section even ↵George Rimar2019-05-241-11/+4
| | | | | | | | | if there is no PT_DYNAMIC header." It broke BB: http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/3748 llvm-svn: 361631
* [llvm-readelf] - Allow dumping of the .dynamic section even if there is no ↵George Rimar2019-05-241-4/+11
| | | | | | | | | | | | | PT_DYNAMIC header. It is now possible after D61937 was landed and was discussed in it's review comments. It is not consistent with GNU, which does not output .dynamic section content in this case for no visible reason. Differential revision: https://reviews.llvm.org/D62179 llvm-svn: 361630
* [llvm-readobj][mips] Align GOT columns headers properly in 64-bit caseSimon Atanasyan2019-05-241-5/+5
| | | | llvm-svn: 361626
* [llvm-readelf] - Rework how we parse the .dynamic section.George Rimar2019-05-203-3/+141
| | | | | | | | | | | | | This is a result of what I found during my work on https://bugs.llvm.org/show_bug.cgi?id=41679. Previously LLVM readelf took the information about .dynamic section from its PT_DYNAMIC segment only. GNU tools have a bit different logic. They also use the information from the .dynamic section header if it is available. This patch changes the code to improve the compatibility with the GNU Binutils. Differential revision: https://reviews.llvm.org/D61937 llvm-svn: 361165
* [CommandLine] Enable Grouping for short options by default. Part 4 of 5Don Hinton2019-05-031-1/+1
| | | | | | | | | | | | | | | | | | | Summary: This change enables `cl::Grouping` for short options -- options with names of a single character. This is consistent with GNU getopt behavior. Reviewers: rnk, MaskRay Reviewed By: MaskRay Subscribers: thopre, cfe-commits, MaskRay, rupprecht, hiraditya, llvm-commits Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D61270 llvm-svn: 359917
* [Object][XCOFF] Add an XCOFF dumper for llvm-readobj.Sean Fertile2019-05-034-0/+66
| | | | | | | | | | | Patch adds support for dumping of file headers with llvm-readobj. XCOFF object files are added to test dumping a well formed file, and dumping both negative timestamps and negative symbol counts, both of which are allowed in the XCOFF definition. Differential Revision: https://reviews.llvm.org/D60878 llvm-svn: 359878
* [llvm-readobj] Change -t to --symbols in tests. NFCFangrui Song2019-05-015-5/+5
| | | | | | | | | | -t is --symbols in llvm-readobj but --section-details (unimplemented) in readelf. The confusing option should not be used since we aim for improving compatibility. Keep just one llvm-readobj -t use case in test/tools/llvm-readobj/symbols.test llvm-svn: 359661
* Fix test/tools/llvm-readobj/mips-plt.testFangrui Song2019-05-011-1/+1
| | | | llvm-svn: 359657
* [llvm-readobj] llvm-readobj --elf-output-style=GNU => llvm-readelf. NFCFangrui Song2019-05-0111-44/+36
| | | | | | | | | The latter is much more common. A dedicated --elf-output-style=GNU test demonstrating it is the same as llvm-readelf is sufficient. llvm-svn: 359652
* [llvm-readobj] Change -long-option to --long-option in tests. NFCFangrui Song2019-05-0196-194/+196
| | | | | | | | | | We use both -long-option and --long-option in tests. Switch to --long-option for consistency. In the "llvm-readelf" mode, -long-option is discouraged as it conflicts with grouped short options and it is not accepted by GNU readelf. While updating the tests, change llvm-readobj -s to llvm-readobj -S to reduce confusion ("s" is --section-headers in llvm-readobj but --symbols in llvm-readelf). llvm-svn: 359649
* [WebAssembly] Support EXPLICIT_NAME symbols in llvm-readobjDan Gohman2019-04-301-0/+135
| | | | | | | | | Teach llvm-readobj about WASM_SYMBOL_EXPLICIT_NAME. Differential Revision: https://reviews.llvm.org/D61323 Reviewer: sbc100 llvm-svn: 359602
* [llvm-nm][llvm-readelf] Avoid single-dash -long-option in testsFangrui Song2019-04-272-4/+4
| | | | llvm-svn: 359383
* llvm-cvtres: Make new dupe resource error a bit friendlierNico Weber2019-04-241-5/+5
| | | | | | | | | | | | For well-known type IDs, include the name of the type. To not duplicate the ID->name map, make llvm-readobj call this new function as well. It has slightly different output, so this also requires updating a few tests. Differential Revision: https://reviews.llvm.org/D61086 llvm-svn: 359153
* [llvm-readelf] Correctly dump symbols whose section id is SHN_XINDEXEugene Leviant2019-04-151-0/+24
| | | | | | Differential revision: https://reviews.llvm.org/D60614 llvm-svn: 358396
* [llvm-readobj] Reapply: Improve error message for --string-dumpStephen Tozer2019-04-1514-22/+23
| | | | | | | | | | | | | | | | | This is a resubmission of a previous patch that caused test failures, with the fixes for the relevant tests included. Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630 This patch changes the error message when the section specified by --string-dump cannot be found by including the name of the section in the error message and changing the prefix text to not imply that the file itself was invalid. As part of this change some uses of std::error_code have been replaced with the llvm Error class to better encapsulate the error info (rather than passing File strings around), and the WithColor class replaces string literal error prefixes. llvm-svn: 358395
* [llvm-readobj] Should declare `ListScope` for `verneed` entries.Xing GUO2019-04-101-18/+22
| | | | | | | | | | | | | | | | Summary: YAML mappings require keys to be unique. See: https://yaml.org/spec/1.2/spec.html#id2764652 Reviewers: jhenderson, grimar, rupprecht, espindola, ruiu Reviewed By: ruiu Subscribers: ruiu, emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60438 llvm-svn: 358078
* Revert "[llvm-readobj] Improve error message for --string-dump"Stephen Tozer2019-04-0514-23/+22
| | | | | | | | This reverts commit 681b0798dbbc6b3500c9930977ec8a274b142acb. Reverted due to causing build failures: llvm-svn: 357772 llvm-svn: 357774
OpenPOWER on IntegriCloud