summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.Zachary Turner2017-04-281-48/+23
| | | | | | | | The llvm-readobj parsing code currently exists in our CodeView library, so we use that to parse instead of re-writing the logic in the tool. llvm-svn: 301718
* [WebAssembly] Write initial memory in pages not bytesSam Clegg2017-04-281-1/+13
| | | | | | | | Subscribers: jfb, dschuff Differential Revision: https://reviews.llvm.org/D32660 llvm-svn: 301687
* [WebAssembly] Add some tests for wasm MC layerSam Clegg2017-04-281-3/+16
| | | | | | | | Subscribers: jfb, dschuff Differential Revision: https://reviews.llvm.org/D32558 llvm-svn: 301606
* [llvm-readobj] Dump COFF Resources section.Zachary Turner2017-04-273-0/+32
| | | | | | | | | | | | 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
* [CodeView] Isolate Debug Info Fragments into standalone classes.Zachary Turner2017-04-271-19/+13
| | | | | | | | | | | | | | | | | | | | | Previously parsing of these were all grouped together into a single master class that could parse any type of debug info fragment. With writing forthcoming, the complexity of each individual fragment is enough to warrant them having their own classes so that reading and writing of each fragment type can be grouped together, but isolated from the code for reading and writing other fragment types. In doing so, I found a place where parsing code was duplicated for the FileChecksums fragment, across llvm-readobj and the CodeView library, and one of the implementations had a bug. Now that the codepaths are merged, the bug is resolved. Differential Revision: https://reviews.llvm.org/D32547 llvm-svn: 301557
* Rename some PDB classes.Zachary Turner2017-04-271-22/+22
| | | | | | | | | | | | | | | | | | | We have a lot of very similarly named classes related to dealing with module debug info. This patch has NFC, it just renames some classes to be more descriptive (albeit slightly more to type). The mapping from old to new class names is as follows: Old | New ModInfo | DbiModuleDescriptor ModuleSubstream | ModuleDebugFragment ModStream | ModuleDebugStream With the corresponding Builder classes renamed accordingly. Differential Revision: https://reviews.llvm.org/D32506 llvm-svn: 301555
* [WebAssembly] Improve readobj and nm support for wasmSam Clegg2017-04-141-41/+126
| | | | | | | | | Now that the libObect support for wasm is better we can have readobj and nm produce more useful output too. Differential Revision: https://reviews.llvm.org/D31514 llvm-svn: 300365
* [llvm-readobj] Only print the real size of the notePetr Hosek2017-04-051-6/+5
| | | | | | | | | | | | | | | | | Note payloads are padded to a multiple of 4 bytes in size, but the size of the string that should be print can be smaller e.g. the n_descsz field in gold's version note is 9, so that's the whole size of the string that should be printed. The padding is part of the format of a SHT_NOTE section or PT_NOTE segment, but it's not part of the note itself. Printing the extra null bytes may confuse some tools, e.g. when the llvm-readobj is sent to grep, it treats the output as binary because it contains a null byte. Differential Revision: https://reviews.llvm.org/D30804 llvm-svn: 299576
* [codeview] Cope with unsorted streams in type mergingReid Kleckner2017-04-031-6/+4
| | | | | | | | | | | | | | | Summary: MASM can produce type streams that are not topologically sorted. It can even produce type streams with circular references, but those are not common in practice. Reviewers: inglorion, ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31629 llvm-svn: 299403
* AMDGPU/llvm-readobj: Rename RuntimeMDNoteType -> CodeObjectMetadataNoteType toKonstantin Zhuravlyov2017-03-311-2/+2
| | | | | | match the new metadata. NFC. llvm-svn: 299275
* [WebAssembly] Improve support for WebAssembly binary formatDerek Schuff2017-03-301-7/+7
| | | | | | | | | | | | | | | | | | | Mostly this change adds support converting to and from YAML which will allow us to write more test cases for the WebAssembly MC and lld ports. Better support for objdump, readelf, and nm will be in followup CLs. I had to update the two wasm test binaries because they used the old style 'name' section which is no longer supported. Differential Revision: https://reviews.llvm.org/D31099 Patch by Sam Clegg llvm-svn: 299101
* [llvm-readobj] Prefer ILT to IAT for reading COFF importsShoaib Meenai2017-03-261-6/+12
| | | | | | | | | | | | | | | | | | | | | | | We're seeing binutils ld produce binaries where the import address table's NameRVA entry is actually a VA instead (i.e. it's already base relocated), which llvm-readobj then chokes on. Both dumpbin and the Windows loader are able to handle these binaries correctly, however, and we can make llvm-readobj handle them correctly too by iterating the import lookup table (which doesn't have a relocated NameRVA) rather than the import address table. The import lookup table and the import address table are supposed to be identical on disk, and prior to r277298 the import lookup table would be used by `llvm-readobj -coff-imports` anyway, so this shouldn't have any functional change (except in the case of our malformed binaries). The import lookup table can apparently be missing when using old Borland linkers, so fall back to the import address table in that case. Resolves PR31766. Differential Revision: https://reviews.llvm.org/D31362 llvm-svn: 298812
* [PDB] Split item and type records when merging type streamsReid Kleckner2017-03-243-18/+47
| | | | | | | | | | | | 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-223-9/+10
| | | | | | | | | | | | | | | | | - 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
* [llvm-readobj] Support SHT_MIPS_DWARF section type flagSimon Atanasyan2017-03-101-0/+3
| | | | llvm-svn: 297448
* [Support] Move Stream library from MSF -> Support.Zachary Turner2017-03-021-1/+1
| | | | | | | | | | After several smaller patches to get most of the core improvements finished up, this patch is a straight move and header fixup of the source. Differential Revision: https://reviews.llvm.org/D30266 llvm-svn: 296810
* [PDB] Make streams carry their own endianness.Zachary Turner2017-02-281-8/+8
| | | | | | | | | | | | | Before the endianness was specified on each call to read or write of the StreamReader / StreamWriter, but in practice it's extremely rare for streams to have data encoded in multiple different endiannesses, so we should optimize for the 99% use case. This makes the code cleaner and more general, but otherwise has NFC. llvm-svn: 296415
* [PDB] Partial resubmit of r296215, which improved PDB Stream Library.Zachary Turner2017-02-271-12/+11
| | | | | | | | | | | | | | | | | This was reverted because it was breaking some builds, and because of incorrect error code usage. Since the CL was large and contained many different things, I'm resubmitting it in pieces. This portion is NFC, and consists of: 1) Renaming classes to follow a consistent naming convention. 2) Fixing the const-ness of the interface methods. 3) Adding detailed doxygen comments. 4) Fixing a few instances of passing `const BinaryStream& X`. These are now passed as `BinaryStreamRef X`. llvm-svn: 296394
* Revert r296215, "[PDB] General improvements to Stream library." and followings.NAKAMURA Takumi2017-02-251-17/+18
| | | | | | | | | | | | | | | | | r296215, "[PDB] General improvements to Stream library." r296217, "Disable BinaryStreamTest.StreamReaderObject temporarily." r296220, "Re-enable BinaryStreamTest.StreamReaderObject." r296244, "[PDB] Disable some tests that are breaking bots." r296249, "Add static_cast to silence -Wc++11-narrowing." std::errc::no_buffer_space should be used for OS-oriented errors for socket transmission. (Seek discussions around llvm/xray.) I could substitute s/no_buffer_space/others/g, but I revert whole them ATM. Could we define and use LLVM errors there? llvm-svn: 296258
* [PDB] General improvements to Stream library.Zachary Turner2017-02-251-18/+17
| | | | | | | | | | | | | | | This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215
* [PDB] Rename Stream related source files.Zachary Turner2017-02-251-1/+1
| | | | | | | | | | | | | | This is part of a larger effort to get the Stream code moved up to Support. I don't want to do it in one large patch, in part because the changes are so big that it will treat everything as file deletions and add, losing history in the process. Aside from that though, it's just a good idea in general to make small changes. So this change only changes the names of the Stream related source files, and applies necessary source fix ups. llvm-svn: 296211
* Don't assume little endian in StreamReader / StreamWriter.Zachary Turner2017-02-181-3/+3
| | | | | | | In an effort to generalize this so it can be used by more than just PDB code, we shouldn't assume little endian. llvm-svn: 295525
* [pdb] Add the ability to resolve TypeServer PDBs.Zachary Turner2017-02-163-2/+4
| | | | | | | | | | | | | | Some PDBs or object files can contain references to other PDBs where the real type information lives. When this happens, all type indices in the original PDB are meaningless because their records are not there. With this patch we add the ability to pull type info from those secondary PDBs. Differential Revision: https://reviews.llvm.org/D29973 llvm-svn: 295382
* llvm-readobj: process FreeBSD core notesSaleem Abdulrasool2017-02-121-0/+30
| | | | | | | core files on FreeBSD have additional notes to capture state. Process those notes when dumping the notes. llvm-svn: 294909
* llvm-readobj: fix next note entry calculation and print unknown note typesKonstantin Zhuravlyov2017-02-021-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D29131 llvm-svn: 293964
* Re-submit r293820: Return Error instead of bool from mergeTypeStreams().Rui Ueyama2017-02-021-1/+3
| | | | llvm-svn: 293847
* Fix llvm-readobj build error after r293569Vedant Kumar2017-01-301-1/+1
| | | | | | | Clang complains about an ambiguous call to printNumber() because it can't work out what size_t should convert to. I picked uint64_t. llvm-svn: 293573
* [WebAssembly] Add wasm support for llvm-readobjDerek Schuff2017-01-304-0/+99
| | | | | | | | | | | 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] Bump up n_type for metadata v2Konstantin Zhuravlyov2017-01-251-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D29115 llvm-svn: 293083
* Add LC_BUILD_VERSION load commandSteven Wu2017-01-231-1/+19
| | | | | | | | | | | | | | | | | | | Summary: Add a new load command LC_BUILD_VERSION. It is a generic version of LC_*_VERSION_MIN load_command used on Apple platforms. Instead of having a seperate load command for each platform, LC_BUILD_VERSION is recording platform info as an enum. It also records SDK version, min_os, and tools that used to build the binary. rdar://problem/29781291 Reviewers: enderby Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29044 llvm-svn: 292824
* [ARM] Create objdump subtarget from build attrsSam Parker2017-01-181-1/+1
| | | | | | | | | | | Enable an ELFObjectFile to read the its arm build attributes to produce a target triple with a specific ARM architecture. llvm-objdump now uses this functionality to automatically produce a more accurate target. Differential Revision: https://reviews.llvm.org/D28769 llvm-svn: 292366
* Revert r291903 and r291898. Reason: they break check-lld on the bots.Ivan Krasin2017-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Revert [ARM] Fix ubig32_t read in ARMAttributeParser Now using support functions to read data instead of trying to perform casts. =========================================================== Revert [ARM] Enable objdump to construct triple for ARM Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Subscribers: llvm-commits, samparker, aemerson, mgorny Differential Revision: https://reviews.llvm.org/D28683 llvm-svn: 291911
* [ARM] Enable objdump to construct triple for ARMSam Parker2017-01-131-1/+1
| | | | | | | | | | | | | Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Differential Revision: https://reviews.llvm.org/D28281 llvm-svn: 291898
* [ARM] Moved ARMAttributeParser to SupportSam Parker2017-01-134-810/+1
| | | | | | | | | Moved ARMAttributeParser out of llvm-readobj and into the support library. Differential Revision: https://reviews.llvm.org/D28227 llvm-svn: 291896
* [CodeView] Finish decoupling TypeDatabase from TypeDumper.Zachary Turner2017-01-111-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the type dumper itself was passed around to a lot of different places and manipulated in ways that were more appropriate on the type database. For example, the entire TypeDumper was passed into the symbol dumper, when all the symbol dumper wanted to do was lookup the name of a TypeIndex so it could print it. That's what the TypeDatabase is for -- mapping type indices to names. Another example is how if the user runs llvm-pdbdump with the option to dump symbols but not types, we still have to visit all types so that we can print minimal information about the type of a symbol, but just without dumping full symbol records. The way we did this before is by hacking it up so that we run everything through the type dumper with a null printer, so that the output goes to /dev/null. But really, we don't need to dump anything, all we want to do is build the type database. Since TypeDatabaseVisitor now exists independently of TypeDumper, we can do this. We just build a custom visitor callback pipeline that includes a database visitor but not a dumper. All the hackery around printers etc goes away. After this patch, we could probably even delete the entire CVTypeDumper class since really all it is at this point is a thin wrapper that hides the details of how to build a useful visitation pipeline. It's not a priority though, so CVTypeDumper remains for now. After this patch we will be able to easily plug in a different style of type dumper by only implementing the proper visitation methods to dump one-line output and then sticking it on the pipeline. Differential Revision: https://reviews.llvm.org/D28524 llvm-svn: 291724
* [CodeView/PDB] Rename a bunch of files.Zachary Turner2017-01-111-1/+1
| | | | | | | | | | | We were starting to get some name clashes between llvm-pdbdump and the common CodeView framework, so I took this opportunity to rename a bunch of files to more accurately describe their usage. This also helps in llvm-pdbdump to distinguish between different files and whether they are used for pretty dump mode or raw dump mode. llvm-svn: 291627
* llvm-readobj: ELF: Make DT tags machine awareHemant Kulkarni2016-12-271-13/+24
| | | | llvm-svn: 290623
* llvm-readobj: remove leading dash in '-a' option (ARMAttributesShort)Mehdi Amini2016-12-231-1/+1
| | | | | | cl::opt does not accept such option llvm-svn: 290465
* [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-143-0/+42
| | | | | | 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
* [ELF] Convert ELF.h to Expected<T>.Davide Italiano2016-11-161-12/+13
| | | | | | | | | | | | This has two advantages: 1) We slowly move away from ErrorOr to the new handling interface, in the hope of having an uniform error handling in LLVM, eventually. 2) We're starting to have *meaningful* error messages for invalid object ELF files, rather than a generic "parse error". At some point we should include also the offset to improve the quality of the diagnostic. llvm-svn: 287081
* Make the Error class constructor protectedMehdi Amini2016-11-111-1/+1
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* [CodeView] Hook up CodeViewRecordIO to type serialization path.Zachary Turner2016-11-083-16/+14
| | | | | | | | | | | | 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
* Remove the last use of report_fatal_error from ELF.h.Rafael Espindola2016-11-032-7/+7
| | | | llvm-svn: 285955
* Add error handling to getEntry.Rafael Espindola2016-11-032-9/+13
| | | | | | 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
OpenPOWER on IntegriCloud