summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/ObjDumper.h
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj] - Implement --dependent-libraries flag.Georgii Rymar2019-12-061-0/+1
| | | | | | | | | | There is no way to dump SHT_LLVM_DEPENDENT_LIBRARIES sections currently. This patch implements this. The section is described here: https://llvm.org/docs/Extensions.html#sht-llvm-dependent-libraries-section-dependent-libraries Differential revision: https://reviews.llvm.org/D70665
* [llvm-readobj] Replace arch-specific ObjDumper methods by the single ↵Simon Atanasyan2019-10-041-9/+1
| | | | | | | | | | | | | | | `printArchSpecificInfo` Initially llvm-readobj supports multiple command line options like `--arm-attributes` and `--mips-plt-got` for display ELF arch-specific information. Now all these options are superseded by the `--arch-specific` one. It makes sense to have a single `printArchSpecificInfo` method in the base `ObjDumper`, and hide all ELF/target specific details in the `ELFDumper::printArchSpecificInfo` override. Differential Revision: https://reviews.llvm.org/D68385 llvm-svn: 373731
* [llvm-readelf] Support dumping of stack sizes sections with readelf ↵Wolfgang Pieb2019-08-051-0/+1
| | | | | | | | | | --stack-sizes Reviewers: jhenderson, grimar, rupprecht Differential Revision: https://reviews.llvm.org/D65313 llvm-svn: 367942
* [llvm-readobj] Allow --hex-dump/--string-dump to dump multiple sectionsFangrui Song2019-06-181-2/+4
| | | | | | | | | | | | | | | | | | 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
* [Object][XCOFF] Add an XCOFF dumper for llvm-readobj.Sean Fertile2019-05-031-0/+4
| | | | | | | | | | | 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
* [CodeView] Fix cycles in debug info when merging Types with global hashes Alexandre Ganea2019-02-071-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | When type streams with forward references were merged using GHashes, cycles were introduced in the debug info. This was caused by GlobalTypeTableBuilder::insertRecordAs() not inserting the record on the second pass, thus yielding an empty ArrayRef at that record slot. Later on, upon PDB emission, TpiStreamBuilder::commit() would skip that empty record, thus offseting all indices that came after in the stream. This solution comes in two steps: 1. Fix the hash calculation, by doing a multiple-step resolution, iff there are forward references in the input stream. 2. Fix merge by resolving with multiple passes, therefore moving records with forward references at the end of the stream. This patch also adds support for llvm-readoj --codeview-ghash. Finally, fix dumpCodeViewMergedTypes() which previously could reference deleted memory. Fixes PR40221 Differential Revision: https://reviews.llvm.org/D57790 llvm-svn: 353412
* [llvm-readobj] Add a flag to dump just the section-to-segment mapping.Matt Davis2019-02-011-3/+13
| | | | | | | | | | | | | | | | | | Summary: The following patch introduces a new function `printSectionMapping` which is responsible for dumping just the section-to-segment mapping. This patch also introduces a n option `-section-mapping` that outputs that mapping without the program headers. Previously, this functionality was controlled by `printProgramHeaders`, and the output from `-program-headers` has not been changed. I am happy to change the option name, I copied the name that was displayed when outputting the mapping table. Reviewers: khemant, jhenderson, grimar, rupprecht Reviewed By: jhenderson, grimar, rupprecht Subscribers: rupprecht, jhenderson, llvm-commits Differential Revision: https://reviews.llvm.org/D57365 llvm-svn: 352896
* [llvm-readelf] Don't suppress static symbol table with --dyn-symbols + --symbolsJames Henderson2019-01-231-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | In r287786, a bug was introduced into llvm-readelf where it didn't print the static symbol table if both --symbols and --dyn-symbols were specified, even if there was no dynamic symbol table. This is obviously incorrect. This patch fixes this issue, by delegating the decision of which symbol tables should be printed to the final dumper, rather than trying to decide in the command-line option handling layer. The decision was made to follow the approach taken in this patch because the LLVM style dumper uses a different order to the original GNU style behaviour (and GNU readelf) for ELF output. Other approaches resulted in behaviour changes for other dumpers which felt wrong. In particular, I wanted to avoid changing the order of the output for --symbols --dyn-symbols for LLVM style, keep what is emitted by --symbols unchanged for all dumpers, and avoid having different orders of .dynsym and .symtab dumping for GNU "--symbols" and "--symbols --dyn-symbols". Reviewed by: grimar, rupprecht Differential Revision: https://reviews.llvm.org/D57016 llvm-svn: 351960
* [llvm-readelf]Revert --dyn-symbols behaviour to make it GNU compatible, and ↵James Henderson2019-01-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add new --hash-symbols switch for old behaviour In r287786, the behaviour of --dyn-symbols in llvm-readelf (but not llvm-readobj) was changed to print the dynamic symbols as derived from the hash table, rather than to print the dynamic symbol table contents directly. The original change was initially submitted without review, and some comments were made on the commit mailing list implying that the new behavious is GNU compatible. I argue that it is not: 1) It does not include a null symbol. 2) It prints the symbols based on an order derived from the hash table. 3) It prints an extra column indicating which bucket it came from. This could break parsers that expect a fixed number of columns, with the first column being the symbol index. 4) If the input happens to have both .hash and .gnu.hash section, it prints interpretations of them both, resulting in most symbols being printed twice. 5) There is no way of just printing the raw dynamic symbol table, because --symbols also prints the static symbol table. This patch reverts the --dyn-symbols behaviour back to its old behaviour of just printing the contents of the dynamic symbol table, similar to what is printed by --symbols. As the hashed interpretation is still desirable to validate the hash table, it puts it under a new switch "--hash-symbols". This is a no-op on all output forms except for GNU output style for ELF. If there is no hash table, it does nothing, unlike the previous behaviour which printed the raw dynamic symbol table, since the raw dynsym is available under --dyn-symbols. The yaml input for the test is based on that in test/tools/llvm-readobj/demangle.test, but stripped down to the bare minimum to provide a valid dynamic symbol. Note: some LLD tests needed updating. I will commit a separate patch for those. Reviewed by: grimar, rupprecht Differential Revision: https://reviews.llvm.org/D56910 llvm-svn: 351789
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [llvm-readelf] Make llvm-readelf more compatible with GNU readelf.Jordan Rupprecht2018-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds a bunch of options that GNU readelf supports. There is one breaking change when invoked as `llvm-readobj`, and three breaking changes when invoked as `llvm-readelf`: - Add --all (implies --file-header, --program-headers, etc.) - [Breaking] -a is --all instead of --arm-attributes - Add --file-header as an alias for --file-headers - Replace --sections with --sections-headers, keeping --sections as an alias for it - Add --relocs as an alias for --relocations - Add --dynamic as an alias for --dynamic-table - Add --segments as an alias for --program-headers - Add --section-groups as an alias for --elf-section-groups - Add --dyn-syms as an alias for --dyn-symbols - Add --syms as an alias for --symbols - Add --histogram as an alias for --elf-hash-histogram - [Breaking] When invoked as `llvm-readelf`, -s is --symbols instead of --sections - [Breaking] When invoked as `llvm-readelf`, -t is no longer an alias for --symbols Reviewers: MaskRay, phosek, mcgrathr, jhenderson Reviewed By: MaskRay, jhenderson Subscribers: sbc100, aheejin, edd, jhenderson, silvas, echristo, compnerd, kristina, javed.absar, kristof.beyls, llvm-commits, Bigcheese Differential Revision: https://reviews.llvm.org/D54124 llvm-svn: 346685
* [llvm-readobj] Generic hex-dump optionPaul Semel2018-07-251-1/+1
| | | | | | | | | | Helpers are available to make this option file format independant. This patch adds the feature for Wasm file format. It doesn't change the behavior of the other file format handling. Differential Revision: https://reviews.llvm.org/D49545 llvm-svn: 337896
* [llvm-readobj] Generic -string-dump optionPaul Semel2018-07-181-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D49470 llvm-svn: 337408
* MC: Implement support for new .addrsig and .addrsig_sym directives.Peter Collingbourne2018-07-171-0/+1
| | | | | | | | | Part of the address-significance tables proposal: http://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html Differential Revision: https://reviews.llvm.org/D47744 llvm-svn: 337328
* [llvm-readobj] Add -hex-dump (-x) optionPaul Semel2018-07-111-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D48281 llvm-svn: 336782
* [llvm-readobj] Add -string-dump (-p) optionPaul Semel2018-06-151-0/+3
| | | | | | | | This option prints the section content as a string. Differential Revision: https://reviews.llvm.org/D47989 llvm-svn: 334834
* [MC] Add assembler support for .cg_profile.Michael J. Spencer2018-06-021-0/+1
| | | | | | | | | | | | | | | Object FIle Representation At codegen time this is emitted into the ELF file a pair of symbol indices and a weight. In assembly it looks like: .cg_profile a, b, 32 .cg_profile freq, a, 11 .cg_profile freq, b, 20 When writing an ELF file these are put into a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight). Differential Revision: https://reviews.llvm.org/D44965 llvm-svn: 333823
* CodeGen: support an extension to pass linker options on ELFSaleem Abdulrasool2018-01-301-0/+1
| | | | | | | | | | | | | | | | | | Introduce an extension to support passing linker options to the linker. These would be ignored by older linkers, but newer linkers which support this feature would be able to process the linker. Emit a special discarded section `.linker-option`. The content of this section is a pair of strings (key, value). The key is a type identifier for the parameter. This allows for an argument free parameter that will be processed by the linker with the value being the parameter. As an example, `lib` identifies a library to be linked against, traditionally the `-l` argument for Unix-based linkers with the parameter being the library name. Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva for the valuable discussion on the design of this feature. llvm-svn: 323783
* [llvm-readobj] Consistent use of ScopedPrinterSam Clegg2018-01-101-1/+2
| | | | | | | | | There were a few places where outs() was being used directly rather than the ScopedPrinter object. Differential Revision: https://reviews.llvm.org/D41370 llvm-svn: 322141
* Split TypeTableBuilder into two classes.Zachary Turner2017-11-301-6/+7
| | | | llvm-svn: 319456
* llvm-readobj: Print AMDGPU note contentsKonstantin Zhuravlyov2017-10-141-3/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D38752 llvm-svn: 315819
* [llvm-readobj] Dump the COFF image load configReid Kleckner2017-06-221-0/+1
| | | | | | | | This includes the safe SEH tables and the control flow guard function table. LLD will emit the guard table soon, and I need a tool that dumps them for testing. llvm-svn: 305979
* [llvm-readobj] Dump COFF Resources section.Zachary Turner2017-04-271-0/+1
| | | | | | | | | | | | This patch dumps the raw bytes of the .rsrc sections that are present in COFF object and executable files. Subsequent patches will parse this information and dump in a more human readable format. Differential Revision: https://reviews.llvm.org/D32463 Patch By: Eric Beckmann llvm-svn: 301578
* [PDB] Split item and type records when merging type streamsReid Kleckner2017-03-241-2/+4
| | | | | | | | | | | | Summary: MSVC does this when producing a PDB. Reviewers: ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31316 llvm-svn: 298717
* [AMDGPU] Restructure code object metadata creationKonstantin Zhuravlyov2017-03-221-1/+1
| | | | | | | | | | | | | | | | | - Rename runtime metadata -> code object metadata - Make metadata not flow - Switch enums to use ScalarEnumerationTraits - Cleanup and move AMDGPUCodeObjectMetadata.h to AMDGPU/MCTargetDesc - Introduce in-memory representation for attributes - Code object metadata streamer - Create metadata for isa and printf during EmitStartOfAsmFile - Create metadata for kernel during EmitFunctionBodyStart - Finalize and emit metadata to .note during EmitEndOfAsmFile - Other minor improvements/bug fixes Differential Revision: https://reviews.llvm.org/D29948 llvm-svn: 298552
* [WebAssembly] Add wasm support for llvm-readobjDerek Schuff2017-01-301-0/+4
| | | | | | | | | | | Create a WasmDumper subclass of ObjDumper to support Webassembly binary files. Patch by Sam Clegg Differential Revision: https://reviews.llvm.org/D27355 llvm-svn: 293569
* AMDGPU: Emit runtime metadata version 2 as YAMLYaxun Liu2016-12-141-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D25046 llvm-svn: 289674
* [CodeView] Hook up CodeViewRecordIO to type serialization path.Zachary Turner2016-11-081-4/+3
| | | | | | | | | | | | Previously support had been added for using CodeViewRecordIO to read (deserialize) CodeView type records. This patch adds support for writing those same records. With this patch, reading and writing of CodeView type records finally uses a single codepath. Differential Revision: https://reviews.llvm.org/D26253 llvm-svn: 286304
* llvm-readobj: add support for printing GNU NotesSaleem Abdulrasool2016-08-301-0/+1
| | | | | | | | | Add support for printing the GNU Notes. This allows an easy way to view the build id for a binary built with the build id. Currently, this only handles the GNU notes, though it would be easy to extend for other note types (default, FreeBSD, NetBSD, etc). Only the GNU style is supported currently. llvm-svn: 280131
* [COFF] Expose the PE debug data directory and dump itReid Kleckner2016-06-021-0/+1
| | | | | | | | | | | | This directory is used to find if there is a PDB associated with an executable. I plan to use this functionality to teach llvm-symbolizer whether it should use DIA or DWARF to symbolize a given DLL. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D20885 llvm-svn: 271539
* Remove extra semicolon to fix warning. NFC.Michael Kuperstein2016-05-161-1/+1
| | | | llvm-svn: 269722
* [codeview] Add type stream merging prototypeReid Kleckner2016-05-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This code is intended to be used as part of LLD's PDB writing. Until that exists, this is exposed via llvm-readobj for testing purposes. Type stream merging uses the following algorithm: - Begin with a new empty stream, and a new empty hash table that maps from type record contents to new type index. - For each new type stream, maintain a map from source type index to destination type index. - For each record, copy it and rewrite its type indices to be valid in the destination type stream. - If the new type record is not already present in the destination stream hash table, append it to the destination type stream, assign it the next type index, and update the two hash tables. - If the type record already exists in the destination stream, discard it and update the type index map to forward the source type index to the existing destination type index. Reviewers: zturner, ruiu Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20122 llvm-svn: 269521
* [llvm-readobj] Print MIPS .MIPS.options section contentSimon Atanasyan2016-05-041-0/+1
| | | | | | | | | .MIPS.options section specifies miscellaneous options to be applied to an object file. LLVM as well as modern versions of GNU tools emit the only type of the options - ODK_REGINFO. The patch teaches llvm-readobj to print details of the ODK_REGINFO and skip contents of other options. llvm-svn: 268478
* Move llvm-readobj/StreamWriter to Support.Zachary Turner2016-05-031-6/+6
| | | | | | | | | We wish to re-use this from llvm-pdbdump, and it provides a nice way to print structured data in scoped format that could prove useful for many other dumping tools as well. Moving to support and changing name to ScopedPrinter to better reflect its purpose. llvm-svn: 268342
* [llvm-readobj] Add ELF hash histogram printingHemant Kulkarni2016-04-111-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D18907 llvm-svn: 265967
* [llvm-readobj] Add -elf-section-groups optionHemant Kulkarni2016-01-261-0/+1
| | | | | | | | | Adds a way to inspect SHT_GROUP sections in ELF objects. Displays signature, member sections of these sections. Differential revision: http://reviews.llvm.org/D16555 llvm-svn: 258845
* Reland "[llvm-readobj] Simplify usage of -codeview flag"Reid Kleckner2015-12-161-0/+1
| | | | | | Relands r255790 with fixed tests. llvm-svn: 255793
* Revert "[llvm-readobj] Simplify usage of -codeview flag"Reid Kleckner2015-12-161-1/+0
| | | | | | This reverts commit r255790. llvm-svn: 255791
* [llvm-readobj] Simplify usage of -codeview flagReid Kleckner2015-12-161-0/+1
| | | | llvm-svn: 255790
* [llvm-readobj] Teach ELFDumper about symbol versioning.Davide Italiano2015-10-161-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D13824 llvm-svn: 250575
* [llvm-readobj/ELF] Print GNU Hash sectionIgor Kudrin2015-10-141-0/+1
| | | | | | | | Add a new command line switch, -gnu-hash-table, to print the content of that section. Differential Revision: http://reviews.llvm.org/D13696 llvm-svn: 250291
* [llvm-readobj] MachO -- dump LinkerOptions load command.Davide Italiano2015-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | Example output: Linker Options { Size: 32 Count: 2 Strings [ Value: -framework Value: Cocoa ] } There were only two tests using this -- so I converted them as part of this commit rather than separately. Differential Revision: http://reviews.llvm.org/D12702 llvm-svn: 247106
* [llvm-readobj] Dump MachO indirect symbols.Davide Italiano2015-09-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example output: File: <stdin> Format: Mach-O 32-bit i386 Arch: i386 AddressSize: 32bit Indirect Symbols { Number: 3 Symbols [ Entry { Entry Index: 0 Symbol Index: 0x4 } Entry { Entry Index: 1 Symbol Index: 0x0 } Entry { Entry Index: 2 Symbol Index: 0x1 } ] } Differential Revision: http://reviews.llvm.org/D12570 llvm-svn: 246789
* [llvm-readobj] MachO: Dump segment command.Davide Italiano2015-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Example output: File: <stdin> Format: Mach-O arm Arch: arm AddressSize: 32bit Segment { Cmd: LC_SEGMENT Name: Size: 260 vmaddr: 0x0 vmsize: 0x10 fileoff: 408 filesize: 408 maxprot: rwx initprot: rwx nsects: 3 flags: 0x0 } Differential Revision: http://reviews.llvm.org/D12542 llvm-svn: 246665
* [llvm-readobj] Dump MachO Dysymtab command.Davide Italiano2015-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example output: File: <stdin> Format: Mach-O 64-bit x86-64 Arch: x86_64 AddressSize: 64bit Dysymtab { ilocalsym: 0 nlocalsym: 6 iextdefsym: 6 nextdefsym: 2 iundefsym: 8 nundefsym: 0 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 } Differential Revision: http://reviews.llvm.org/D12496 llvm-svn: 246474
* llvm-readobj: Dump more info for COFF import libraries.Rui Ueyama2015-08-281-1/+4
| | | | | | This patch teaches llvm-readobj to print out COFF import file header fields. llvm-svn: 246291
* [llvm-readobj] Add support for dumping MachO min version load command.Davide Italiano2015-08-271-0/+1
| | | | | | | | | | | | | | | | | | Example output: File: <stdin> Format: Mach-O arm Arch: arm AddressSize: 32bit MinVersion { Cmd: LC_VERSION_MIN_IPHONEOS Size: 16 Version: 99.8.7 SDK: n/a } Differential Revision: http://reviews.llvm.org/D12373 llvm-svn: 246151
* [llvm-readobj] Add support for MachO DataInCodeDataCommand.Davide Italiano2015-08-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example output: File: <stdin> Format: Mach-O arm Arch: arm AddressSize: 32bit DataInCode { Data offset: 300 Data size: 32 Data Regions [ DICE { Index: 0 Offset: 0 Length: 4 Kind: 1 } DICE { Index: 1 Offset: 4 Length: 4 Kind: 4 } DICE { Index: 2 Offset: 8 Length: 2 Kind: 3 } DICE { Index: 3 Offset: 10 Length: 1 Kind: 2 } ] } Differential Revision: http://reviews.llvm.org/D12084 llvm-svn: 245732
* Simplify printing the soname. NFC.Rafael Espindola2015-07-211-0/+1
| | | | llvm-svn: 242786
* Add missing c++ marker to .h file.Rafael Espindola2015-07-211-1/+1
| | | | llvm-svn: 242784
OpenPOWER on IntegriCloud