summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/ELFDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r343341Luke Cheeseman2018-11-231-35/+49
| | | | | | | - Cannot reproduce the build failure locally and the build logs have been deleted. llvm-svn: 347490
* [libObject] Fix getDesc for Elf_Note_ImplJake Ehrlich2018-11-131-31/+30
| | | | | | | This change fixes a bug in Elf_Note_Impl in which Elf_Word was used where uint8_t should have been used. llvm-svn: 346724
* [llvm-readelf] Make llvm-readelf more compatible with GNU readelf.Jordan Rupprecht2018-11-121-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Implement LLVM style printer for --notesJordan Rupprecht2018-11-071-90/+222
| | | | | | | | | | | | | | | | | Summary: Port the GNU style printNotes method to the LLVMStyle subclass. This is basically just a heavy refactor so that the note parsing/formatting logic from the GNUStyle::printNotes can be shared with LLVMStyle::printNotes. Reviewers: MaskRay Reviewed By: MaskRay Subscribers: dschuff, fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D54220 llvm-svn: 346371
* AMDGPU: Add sram-ecc featureKonstantin Zhuravlyov2018-11-051-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D53222 llvm-svn: 346177
* [llvm-readobj] Fix bugs with unrecognized types in switch statementsRyan Prichard2018-10-261-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add missing breaks. Several functions used nested switch statements, where the outer switch branches based on the architecture, and the inner switch handles architecture-specific types. If the type isn't architecture-specific, break out to the generic types rather than fall through. getElfPtType: For GNU-style output, llvm-readobj prints "<unknown>: 0xnnnnnnnn" for an unrecognized segment type, unless the architecture is EM_ARM, EM_MIPS, or EM_MIPS_RS3_LE, in which case it prints "". This behavior appears accidental, so instead, always print the "<unknown>: 0xnnnnnnnn" string. Reviewers: pcc, grimar Reviewed By: grimar Subscribers: sdardis, javed.absar, arichardson, kristof.beyls, atanasyan, llvm-commits Differential Revision: https://reviews.llvm.org/D53730 llvm-svn: 345436
* [llvm-readobj] Print ELF header flags names in GNU outputSimon Atanasyan2018-10-251-48/+85
| | | | | | | | | | | | | | GNU readelf tool prints hex value of the ELF header flags field and the flags names. This change adds the same functionality to llvm-readobj. Now llvm-readobj can print MIPS and RISCV flags. New GNUStyle::printFlags() method is a copy of ScopedPrinter::printFlags() routine. Probably we can escape code duplication and / or simplify the printFlags() method. But it's a task for separate commit. Differential revision: https://reviews.llvm.org/D52027 llvm-svn: 345238
* [AMDGPU] Defined gfx909 Raven Ridge 2Tim Renouf2018-10-241-0/+1
| | | | | | | Differential Revision: https://reviews.llvm.org/D53418 Change-Id: Ie3d054f2e956c2768988c0f4c0ffd29a47294eef llvm-svn: 345120
* [llvm-readobj] Fix an error message about .llvm.call-graph-profileFangrui Song2018-10-121-1/+1
| | | | | | .note.llvm.cgprofile was an obvious typo in rL333823 llvm-svn: 344430
* Revert r343317Luke Cheeseman2018-09-281-47/+34
| | | | | | - asan buildbots are breaking and I need to investigate the issue llvm-svn: 343341
* Reapply changes reverted by r343235Luke Cheeseman2018-09-281-34/+47
| | | | | | | | - Add fix so that all code paths that create DWARFContext with an ObjectFile initialise the target architecture in the context - Add an assert that the Arch is known in the Dwarf CallFrameString method llvm-svn: 343317
* Revert r343192 as an ubsan build is currently failingLuke Cheeseman2018-09-271-47/+34
| | | | llvm-svn: 343235
* Reapply changes reverted in r343114, lldb patch to follow shortlyLuke Cheeseman2018-09-271-34/+47
| | | | llvm-svn: 343192
* Revert r343112 as CallFrameString API change has broken lldb buildsLuke Cheeseman2018-09-261-47/+34
| | | | llvm-svn: 343114
* [AArch64] - Return address signing dwarf supportLuke Cheeseman2018-09-261-34/+47
| | | | | | - Reapply r343089 with a fix for DebugInfo/Sparc/gnu-window-save.ll llvm-svn: 343112
* Revert r343089 "[AArch64] - Return address signing dwarf support"Hans Wennborg2018-09-261-47/+34
| | | | | | | | | | | | | | | | | | | This caused the DebugInfo/Sparc/gnu-window-save.ll test to fail. > Functions that have signed return addresses need additional dwarf support: > - After signing the LR, and before authenticating it, the LR register is in a > state the is unusable by a debugger or unwinder > - To account for this a new directive, .cfi_negate_ra_state, is added > - This directive says the signed state of the LR register has now changed, > i.e. unsigned -> signed or signed -> unsigned > - This directive has the same CFA code as the SPARC directive GNU_window_save > (0x2d), adding a macro to account for multiply defined codes > - This patch matches the gcc implementation of this support: > https://patchwork.ozlabs.org/patch/800271/ > > Differential Revision: https://reviews.llvm.org/D50136 llvm-svn: 343103
* [AArch64] - Return address signing dwarf supportLuke Cheeseman2018-09-261-34/+47
| | | | | | | | | | | | | | | | | Functions that have signed return addresses need additional dwarf support: - After signing the LR, and before authenticating it, the LR register is in a state the is unusable by a debugger or unwinder - To account for this a new directive, .cfi_negate_ra_state, is added - This directive says the signed state of the LR register has now changed, i.e. unsigned -> signed or signed -> unsigned - This directive has the same CFA code as the SPARC directive GNU_window_save (0x2d), adding a macro to account for multiply defined codes - This patch matches the gcc implementation of this support: https://patchwork.ozlabs.org/patch/800271/ Differential Revision: https://reviews.llvm.org/D50136 llvm-svn: 343089
* llvm-readobj: Simplify. NFCI.Peter Collingbourne2018-08-211-1/+1
| | | | llvm-svn: 340305
* [llvm-readobj] Generic hex-dump optionPaul Semel2018-07-251-18/+0
| | | | | | | | | | 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] - Do not report invalid amount of sections.George Rimar2018-07-191-2/+4
| | | | | | | | | | | When output style is GNU and amount of sections is >= SHN_LORESERVE, llvm-readobj reports zero number of sections instead of actual value. The patch fixes that. Differential revision: https://reviews.llvm.org/D49544 llvm-svn: 337462
* [llvm-readobj] Generic -string-dump optionPaul Semel2018-07-181-72/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D49470 llvm-svn: 337408
* [llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.George Rimar2018-07-181-4/+28
| | | | | | | | | | | | | | | | | | http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html says that e_shnum and/or e_shstrndx may have special values if "the number of sections is greater than or equal to SHN_LORESERVE" or "the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00)" Previously llvm-readobj was unable to dump such files, patch changes that. I had to add a precompiled test case because it does not seem possible to prepare a test using yaml2obj or llvm-mc (not clear how to make .shstrtab to have index >= SHN_LORESERVE). Differential revision: https://reviews.llvm.org/D49369 llvm-svn: 337360
* MC: Implement support for new .addrsig and .addrsig_sym directives.Peter Collingbourne2018-07-171-0/+45
| | | | | | | | | 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
* [WebAssembly] Remove ELF file support.Sam Clegg2018-07-161-1/+0
| | | | | | | | | This support was partial and temporary. Now that we have wasm object file support its no longer needed. Differential Revision: https://reviews.llvm.org/D48744 llvm-svn: 337222
* [llvm-readobj] Add -hex-dump (-x) optionPaul Semel2018-07-111-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D48281 llvm-svn: 336782
* Revert "[llvm-readobj] Fix printing format"Paul Semel2018-07-011-11/+4
| | | | | | | There is a problem with the formatting on windows build. I need to investigate on this. llvm-svn: 336061
* [llvm-readobj] Fix printing formatPaul Semel2018-07-011-4/+11
| | | | | | | | | | | | We were printing every character, even those that weren't printable. It doesn't really make sense for this option. The string content was sticked to its address, added two spaces in between. Differential Revision: https://reviews.llvm.org/D48271 llvm-svn: 336058
* [llvm-readobj] Add experimental support for SHT_RELR sectionsJake Ehrlich2018-06-281-18/+109
| | | | | | | | | | | | | | | This change adds experimental support for SHT_RELR sections, proposed here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg Definitions for the new ELF section type and dynamic array tags, as well as the encoding used in the new section are all under discussion and are subject to change. Use with caution! Author: rahulchaudhry Differential Revision: https://reviews.llvm.org/D47919 llvm-svn: 335922
* [llvm-readobj] Add -string-dump (-p) optionPaul Semel2018-06-151-0/+72
| | | | | | | | This option prints the section content as a string. Differential Revision: https://reviews.llvm.org/D47989 llvm-svn: 334834
* llvm-readobj: fix printing number of relocations in Android packed format.Peter Collingbourne2018-06-071-1/+9
| | | | | | | | | | | | | With '-elf-output-style=GNU -relocations', a header containing the number of entries is printed before all the relocation entries in the section. For Android packed format, we need to perform the unpacking first before we can get the actual number of relocations in the section. Patch by Rahul Chaudhry! Differential Revision: https://reviews.llvm.org/D47800 llvm-svn: 334147
* [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in ↵Alexander Ivchenko2018-06-041-1/+31
| | | | | | | | | | | | | | | | | .note.gnu.property Resubmit of r333424. This version contains the fix for fails found by buildbots on some targets. This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property sections. These notes indicate that the object file is built to support Intel CET. patch by mike.dvoretsky Differential Revision: https://reviews.llvm.org/D47473 llvm-svn: 333908
* [MC] Add assembler support for .cg_profile.Michael J. Spencer2018-06-021-0/+52
| | | | | | | | | | | | | | | 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
* Reverted r333424 as it broke multiple build bots and left unfixed for a long ↵Galina Kistanova2018-05-301-31/+1
| | | | | | time llvm-svn: 333578
* [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in ↵Alexander Ivchenko2018-05-291-1/+31
| | | | | | | | | | | | | | .note.gnu.property This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property sections. These notes indicate that the object file is built to support Intel CET. patch by mike.dvoretsky Differential Revision: https://reviews.llvm.org/D47473 llvm-svn: 333424
* [mips] Add support for Global INValidate ASEPetar Jovanovic2018-05-171-0/+1
| | | | | | | | | | | | | | | | | | This includes Instructions: ginvi, ginvt, Assembler directives: .set ginv, .set noginv, .module ginv, .module noginv Attribute: ginv .MIPS.abiflags: GINV (0x20000) Patch by Vladimir Stefanovic. Differential Revision: https://reviews.llvm.org/D46268 llvm-svn: 332624
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-4/+4
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* AMDGPU: Add Vega12 and Vega20Matt Arsenault2018-04-301-0/+2
| | | | | | | | Changes by Matt Arsenault Konstantin Zhuravlyov llvm-svn: 331215
* Add PPC64_GLINK dynamic tag.Sean Fertile2018-04-131-0/+12
| | | | | | | | Add support for the PPC64_GLINK dynamic tag which is used in the ElfV2 abi. Differential Revision: https://reviews.llvm.org/D45574 llvm-svn: 330038
* Change DT_* value definitions to macros in a separate fileAlexander Richardson2018-03-211-69/+25
| | | | | | | | | | | | | | | | | | | | Summary: I recently added a new dynamic tag to our fork of LLVM and when adding it to llvm-readobj I noticed that not all DT_ values were being handled there. Using macros in a .def file that can be included by both ELFDumper.cpp and the ELF.h header ensures that the two don't get out of sync when new values are added. Reviewers: grimar, pcc, davide, espindola Reviewed By: grimar, espindola Subscribers: srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D44558 llvm-svn: 328099
* [llvm-readobj] - Teach llvm-readobj to dump .note.gnu.property sections.George Rimar2018-03-211-1/+52
| | | | | | | | | | | | NT_GNU_PROPERTY_TYPE_0 is a recently added type of .note.gnu.property section specified in Linux Extensions to gABI. (https://github.com/hjl-tools/linux-abi/wiki/Linux-Extensions-to-gABI) Patch teach tool to print such notes properly. Differential revision: https://reviews.llvm.org/D44469 llvm-svn: 328078
* [mips] Add support for CRC ASEPetar Jovanovic2018-03-141-1/+2
| | | | | | | | | | | | | | | | | | | This includes Instructions: crc32b, crc32h, crc32w, crc32d, crc32cb, crc32ch, crc32cw, crc32cd Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc Attribute: crc .MIPS.abiflags: CRC (0x8000) Patch by Vladimir Stefanovic. Differential Revision: https://reviews.llvm.org/D44176 llvm-svn: 327511
* [llvm-readobj] Extend the output of -elf-section-groupsAlexander Shaposhnikov2018-03-121-1/+12
| | | | | | | | | | | | | | This diff extends the output of -elf-section-groups (llvm style, gnu style is unchanged since it's meant to be compatible with binutils readelf) with sh_link and sh_info. This change will enable us to use llvm-readobj -elf-section-groups for testing llvm-objcopy's support for .group sections. Test plan: make check-all Differential revision: https://reviews.llvm.org/D44280 llvm-svn: 327341
* [llvm-readobj][ELF] Move ELF note parsing into libObjectScott Linder2018-03-121-47/+43
| | | | | | | | | Clean up the parsing of notes in llvm-readobj, improve bounds checking, and allow the parsing code to be reused. Differential Revision: https://reviews.llvm.org/D43958 llvm-svn: 327320
* Reland "[DebugInfo] Support DWARF expressions in eh_frame"Rafael Auler2018-03-081-0/+6
| | | | | | | | | | Summary: Original change was D43313 (r326932) and reverted by r326953 because it broke an LLD test and a windows build. The LLD test was already fixed in lld commit r326944 (thanks maskray). This is the original change with the windows build fixed. llvm-svn: 326970
* Revert r326932: [DebugInfo] Support DWARF expressions in eh_frameRui Ueyama2018-03-071-6/+0
| | | | | | This reverts commit rr326932 because it broke lld/test/ELF/eh-frame-hdr-augmentation.s. llvm-svn: 326953
* [DebugInfo] Support DWARF expressions in eh_frameRafael Auler2018-03-071-0/+6
| | | | | | | | | | | | | | | | | | This patch enhances DWARFDebugFrame with the capability of parsing and printing DWARF expressions in CFI instructions. It also makes FDEs and CIEs accessible to lib users, so they can process them in client tools that rely on LLVM. To make it self-contained with a test case, it teaches llvm-readobj to be able to dump EH frames and checks they are correct in a unit test. The llvm-readobj code is Maksim Panchenko's work (maksfb). Reviewers: JDevlieghere, espindola Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D43313 llvm-svn: 326932
* AMDGPU: Bring elf flags in sync with the specKonstantin Zhuravlyov2018-02-161-4/+32
| | | | | | | | | | | - Add MACH flags - Add XNACK flag - Add reserved flags - Minor cleanups in docs Differential Revision: https://reviews.llvm.org/D43356 llvm-svn: 325399
* CodeGen: support an extension to pass linker options on ELFSaleem Abdulrasool2018-01-301-0/+37
| | | | | | | | | | | | | | | | | | 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
* Instead of ELFFile<ELFT>::Type, use ELFT::Type. NFC.Rui Ueyama2018-01-121-33/+31
| | | | llvm-svn: 322346
* Use ELF{32,64}{LE,BE} instead of ELFType<{little,big}, {true,false}>. NFC.Rui Ueyama2018-01-121-4/+3
| | | | llvm-svn: 322342
OpenPOWER on IntegriCloud