summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/ELFDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ARM] Implement execute-only support in CodeGenPrakhar Bahuguna2016-12-151-0/+8
| | | | | | | | | | | | | | | | | | | | This implements execute-only support for ARM code generation, which prevents the compiler from generating data accesses to code sections. The following changes are involved: * Add the CodeGen option "-arm-execute-only" to the ARM code generator. * Add the clang flag "-mexecute-only" as well as the GCC-compatible alias "-mpure-code" to enable this option. * When enabled, literal pools are replaced with MOVW/MOVT instructions, with VMOV used in addition for floating-point literals. As the MOVT instruction is required, execute-only support is only available in Thumb mode for targets supporting ARMv8-M baseline or Thumb2. * Jump tables are placed in data sections when in execute-only mode. * The execute-only text section is assigned section ID 0, and is marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'. This also overrides selection of ELF sections for globals. llvm-svn: 289784
* Attempt to fix llvm-readobj crash on ppc64 due to r289674Yaxun Liu2016-12-151-1/+1
| | | | llvm-svn: 289777
* AMDGPU: Emit runtime metadata version 2 as YAMLYaxun Liu2016-12-141-0/+32
| | | | | | Differential Revision: https://reviews.llvm.org/D25046 llvm-svn: 289674
* [llvm-readobj] - Teach readobj to print PT_OPENBSD_BOOTDATA headerGeorge Rimar2016-12-061-0/+1
| | | | | | | | | | | | | These are OpenBSD specific program headers. OpenBSD commit: https://github.com/openbsd/src/commit/d39116912b9536bd77326260dc5c6e593fd4ee24 It is required for fixing PR31288. Differential revision: https://reviews.llvm.org/D27456 llvm-svn: 288831
* llvm-readobj: Use hash tables to print dynamic symbols.Hemant Kulkarni2016-11-231-1/+108
| | | | | | | -symbols prints both .symtab and .dynsym symbols for GNU style in ELF. -dyn-symbols prints symbols looking up through hash tables. This helps validate hash tables. llvm-svn: 287786
* Remove the last use of report_fatal_error from ELF.h.Rafael Espindola2016-11-031-6/+6
| | | | llvm-svn: 285955
* Add error handling to getEntry.Rafael Espindola2016-11-031-8/+11
| | | | | | Issue found by inspection. llvm-svn: 285951
* Replace a report_fatal_error with an ErrorOr.Rafael Espindola2016-11-031-5/+5
| | | | llvm-svn: 285942
* Delete some dead code and add a missing "0x" prefix to a hex string inChandler Carruth2016-11-031-2/+1
| | | | | | | | | | | llvm-readobj. Another bug caught by PVS-Studio. It'd be nice to actually have a test for this, but I found it by inspection from PVS-Studio. llvm-svn: 285937
* Move a free function out of ELFFile.Rafael Espindola2016-11-031-8/+8
| | | | llvm-svn: 285920
* replace a report_fatal_error with a ErrorOr.Rafael Espindola2016-11-031-4/+4
| | | | llvm-svn: 285910
* Replace a report_fatal_error with an ErrorOr.Rafael Espindola2016-11-031-3/+4
| | | | llvm-svn: 285905
* Avoid a report_fatal_error in sections().Rafael Espindola2016-11-021-13/+13
| | | | | | | Have it return a ErrorOr<Range> and delete section_begin and section_end. llvm-svn: 285807
* [RISCV] Add RISC-V ELF definesAlex Bradbury2016-11-011-0/+1
| | | | | | | | | | Add the necessary definitions for RISC-V ELF files, including relocs. Also make necessary trivial change to ELFYaml, llvm-objdump, and llvm-readobj in order to work with RISC-V ELFs. Differential Revision: https://reviews.llvm.org/D23557 llvm-svn: 285708
* [llvm-readobj] - Teach readobj to print ↵George Rimar2016-10-181-0/+4
| | | | | | | | | | | | | | | | | | | | PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers. These are OpenBSD specific program headers and currently we support them in LLD. Description of headers (just in case) available here: http://man.openbsd.org/OpenBSD-current/man5/elf.5 OpenBSD commits were: For PT_OPENBSD_RANDOMIZE: https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461 For PT_OPENBSD_WXNEEDED: https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad Differential revision: https://reviews.llvm.org/D25616 llvm-svn: 284471
* Refactor to use getSectionContentsAsArray.Rafael Espindola2016-10-061-1/+1
| | | | | | This centralizes quite a bit of error checking. llvm-svn: 283454
* Refactor duplicated typedefs. NFC.Rafael Espindola2016-10-061-29/+9
| | | | llvm-svn: 283453
* Use range loop. NFC.Rafael Espindola2016-10-061-8/+8
| | | | llvm-svn: 283447
* [Stackmap] Added callsite counts to emitted function information.Sanjoy Das2016-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It was previously not possible for tools to use solely the stackmap information emitted to reconstruct the return addresses of callsites in the map, which is necessary to use the information to walk a stack. This patch adds per-function callsite counts when emitting the stackmap section in order to resolve the problem. Note that this slightly alters the stackmap format, so external tools parsing these maps will need to be updated. **Problem Details:** Records only store their offset from the beginning of the function they belong to. While these records and the functions are output in program order, it is not possible to determine where the end of one function's records are without the callsite count when processing the records to compute return addresses. Patch by Kavon Farvardin! Reviewers: atrick, ributzka, sanjoy Subscribers: nemanjai Differential Revision: https://reviews.llvm.org/D23487 llvm-svn: 281532
* [llvm-readobj] - Teach readobj to print DT_AUXILIARY dynamic tag in human ↵George Rimar2016-09-021-0/+4
| | | | | | | | | | readable form. Previously DT_AUXILIARY was unknown, patch fixes that. Differential revision: https://reviews.llvm.org/D24138 llvm-svn: 280471
* Fix the MSVC 2013 build by using Elf_Word instead of making a local typedefReid Kleckner2016-08-311-6/+4
| | | | llvm-svn: 280304
* llvm-readobj: speculative fix for MSVCSaleem Abdulrasool2016-08-301-1/+1
| | | | | | Use the typedef rather than using to type alias the typename. llvm-svn: 280158
* Revert "ELFDumper: Unversioned symbols must not have trailing @"Hemant Kulkarni2016-08-301-3/+0
| | | | | | | | This reverts commit 8df7a877949e8782a3a28e3ecdb0770c1e444056. Fixing other repositories and adding changes together. llvm-svn: 280152
* ELFDumper: Unversioned symbols must not have trailing @Hemant Kulkarni2016-08-301-0/+3
| | | | llvm-svn: 280140
* llvm-readobj: add support for printing GNU NotesSaleem Abdulrasool2016-08-301-0/+138
| | | | | | | | | 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
* Replace "fallthrough" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-1/+1
| | | | | | | This is a mechanical change of comments in switches like fallthrough, fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead. llvm-svn: 278902
* BPF: Use official ELF e_machine valueAlexei Starovoitov2016-07-151-0/+1
| | | | | | | | | The same value for EM_BPF is being propagated to glibc, elfutils, and binutils. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 275633
* [llvm-readobj] - Teach llvm-readobj to print dependencies of SHT_GNU_verdef ↵George Rimar2016-06-221-18/+26
| | | | | | | | | | | | | | | and refactor dumping method. This patch changes single method of llvm-readobj. It teaches SHT_GNU_verdef dumper to print version dependencies, also it removes few fields from output that can be dumped with other keys and slightly refactors code. Testcase was also modified to match the changes. Change is required for testcases of upcoming lld patches. Differential revision: http://reviews.llvm.org/D21552 llvm-svn: 273417
* [llvm-readobj] - Teach llvm-readobj to dump .gnu.version_r sectionsGeorge Rimar2016-06-071-0/+55
| | | | | | | | | | SHT_GNU_verneed (.gnu.version_r) is a version dependency section. It was the last symbol versioning relative section that was not dumped, now it is. Differential revision: http://reviews.llvm.org/D21024 llvm-svn: 271998
* [llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.George Rimar2016-05-211-2/+10
| | | | | | | | | | | | | | | | | | | | | | | Main problem here was that SHF_COMPRESSED has the same value with XCORE_SHF_CP_SECTION, which was included as standart (common) flag. As far I understand xCore is a family of controllers and it that means it's constant should be processed separately, only if e_machine == EM_XCORE, otherwise llvm-readobj would output different constants twice for compressed section: Flags [ .. SHF_COMPRESSED (0x800) .. XCORE_SHF_CP_SECTION (0x800) .. ] what probably does not make sence if you're not working with xcore file. Differential revision: http://reviews.llvm.org/D20273 llvm-svn: 270320
* llvm-readobj: Fix GNU style entry point print widthHemant Kulkarni2016-05-121-1/+1
| | | | llvm-svn: 269376
* llvm-readobj: Change Hex output for GNU style dynamic table printHemant Kulkarni2016-05-121-3/+4
| | | | | | | Dynamic table when printed shows uppercase tag/values. This changes it to lower case when printing in GNU style llvm-svn: 269368
* llvm-readobj: Fix the GNU section header flags for SHF_MASKPROC and SHF_MASKOSHemant Kulkarni2016-05-121-2/+4
| | | | llvm-svn: 269338
* [llvm-readobj] Print MIPS .MIPS.options section contentSimon Atanasyan2016-05-041-7/+61
| | | | | | | | | .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-18/+16
| | | | | | | | | 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] Dump hash as part of -version-info.Davide Italiano2016-05-021-0/+1
| | | | llvm-svn: 268210
* [llvm-readobj] Add ELF hash histogram printingHemant Kulkarni2016-04-111-0/+121
| | | | | | Differential Revision: http://reviews.llvm.org/D18907 llvm-svn: 265967
* Use ArrayRef for contiguous areas in ELF. NFC.Rafael Espindola2016-04-051-9/+9
| | | | | | This just simplifies the code a bit. More so in lld. llvm-svn: 265403
* [llvm-readobj] NFC: Remove unneeded parenthesisHemant Kulkarni2016-03-291-6/+6
| | | | llvm-svn: 264731
* [llvm-readobj] Support GNU style dyn-relocationsHemant Kulkarni2016-03-291-20/+108
| | | | | | http://reviews.llvm.org/D18534 llvm-svn: 264693
* [llvm-readobj] NFC Replace case by macros for PT_* enumsHemant Kulkarni2016-03-281-24/+16
| | | | llvm-svn: 264595
* Fix Narrowing conversion warning introduced by r264415Hemant Kulkarni2016-03-251-1/+1
| | | | llvm-svn: 264419
* [llvm-readobj] Impl GNU style program headers printHemant Kulkarni2016-03-251-20/+226
| | | | | | | | readelf -lW Differential Revision: http://reviews.llvm.org/D18372 llvm-svn: 264415
* [llvm-readobj] Decode st_other symbol's flagsSimon Atanasyan2016-03-241-1/+41
| | | | | | | | | The patch supports common STV_xxx visibility flags and MIPS specific STO_MIPS_xxx flags. Differential Revision: http://reviews.llvm.org/D18447 llvm-svn: 264300
* [llvm-readobj] Impl GNU style symbols printingHemant Kulkarni2016-03-211-40/+174
| | | | | | | | Implements "readelf -sW and readelf -DsW" Differential Revision: http://reviews.llvm.org/D18224 llvm-svn: 263952
* [llvm-readobj] Impl GNU style printing of sections and relocationsHemant Kulkarni2016-03-151-261/+639
| | | | | | Differential Revision: http://reviews.llvm.org/D17523 llvm-svn: 263561
* [llvm-readobj] Enable GNU style section group printHemant Kulkarni2016-03-091-34/+87
| | | | | | Differential Revision: http://reviews.llvm.org/D17822 llvm-svn: 263050
* [lanai] Add ELF enum value and relocations.Jacques Pienaar2016-03-011-1/+2
| | | | | | | | | | Add ELF enum value and relocations for Lanai backed. General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend" (http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html). Differential Revision: http://reviews.llvm.org/D17008 llvm-svn: 262394
* Reverts change r261907 and r261918Hemant Kulkarni2016-02-251-674/+265
| | | | llvm-svn: 261927
* [llvm-readobj] Enable GNU style sections and relocations printingHemant Kulkarni2016-02-251-265/+674
| | | | | | http://reviews.llvm.org/D17523 llvm-svn: 261907
OpenPOWER on IntegriCloud