summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
Commit message (Collapse)AuthorAgeFilesLines
...
* Reapply: Allow yaml2obj to order implicit sections for ELFDave Lee2017-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows yaml input to control the order of implicitly added sections (`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a placeholder section of the given name to the Sections field. This change is to support changes in D39582, where it is desirable to control the location of the `.dynsym` section. This reapplied version fixes: 1. use of a function call within an assert 2. failing lld test which has an unnamed section Additionally, one more test to cover the unnamed section failure. Reviewers: compnerd, jakehehrlich Reviewed By: jakehehrlich Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39749 llvm-svn: 317646
* Revert "Allow yaml2obj to order implicit sections for ELF"Dave Lee2017-11-071-1/+1
| | | | | | | | Also, revert "Fix build bots after r317622" This reverts commit r317622, r317626. llvm-svn: 317630
* Allow yaml2obj to order implicit sections for ELFDave Lee2017-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: This change allows yaml input to control the order of implicitly added sections (`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a placeholder section of the given name to the Sections field. This change is to support changes in D39582, where it is desirable to control the location of the `.dynsym` section. Reviewers: compnerd, jakehehrlich Reviewed By: jakehehrlich Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39749 llvm-svn: 317622
* [ObjectYAML] Map relocation types for COFF ARMNT and ARM64Martin Storsjo2017-11-061-0/+48
| | | | | | Differential Revision: https://reviews.llvm.org/D39668 llvm-svn: 317459
* [yaml2obj][ELF] Add support for setting alignment in program headersJake Ehrlich2017-11-011-0/+1
| | | | | | | | | | | | | | Sometimes program headers have larger alignments than any of the sections they contain. Currently yaml2obj can't produce such files. A bug recently appeared in llvm-objcopy that failed in such a case. I'd like to be able to add tests to llvm-objcopy for such cases. This change adds an optional alignment parameter to program headers that will be used instead of calculating the alignment. Differential Revision: https://reviews.llvm.org/D39130 llvm-svn: 317139
* llvm-readobj: Add support for reading relocations in the Android packed format.Peter Collingbourne2017-10-251-0/+2
| | | | | | | | | | | This is in preparation for testing lld's upcoming relocation packing feature (D39152). I have verified that this implementation correctly unpacks the relocations from a Chromium DSO built with gold and the Android relocation packer for ARM32 and ARM64. Differential Revision: https://reviews.llvm.org/D39272 llvm-svn: 316543
* AMDGPU: Add and set AMDGPU-specific e_flagsKonstantin Zhuravlyov2017-10-051-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D38556 llvm-svn: 314987
* AMDGPU: Add ELFOSABI_AMDGPU_MESA3DKonstantin Zhuravlyov2017-10-031-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D38387 llvm-svn: 314846
* AMDGPU: Add ELFOSABI_AMDGPU_PALKonstantin Zhuravlyov2017-10-031-2/+3
| | | | llvm-svn: 314843
* [RISCV] Parse RISC-V eflags in ObjectYAMLAlex Bradbury2017-10-031-0/+8
| | | | | | | Differential Revision: https://reviews.llvm.org/D38311 Patch by Chih-Mao Chen. llvm-svn: 314770
* [ObjectYAML] Handle SHF_COMPRESSEDShoaib Meenai2017-10-031-0/+1
| | | | | | | | | This was previously being silently dropped by obj2yaml and caused parsing errors with yaml2obj. Differential Revision: https://reviews.llvm.org/D38490 llvm-svn: 314768
* [WebAssembly] Allow each data segment to specify its own alignmentSam Clegg2017-09-291-2/+9
| | | | | | | | | Also, add a flags field as we will almost certainly be needing that soon too. Differential Revision: https://reviews.llvm.org/D38296 llvm-svn: 314534
* Reland "[WebAssembly] Add support for naming wasm data segments"Sam Clegg2017-09-201-0/+1
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313795
* Reverting due to Green Dragon bot failure.Mike Edwards2017-09-201-1/+0
| | | | | | http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42594/ llvm-svn: 313706
* [WebAssembly] Add support for naming wasm data segmentsSam Clegg2017-09-191-0/+1
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313692
* llvm-dwarfdump: support dumping UUIDs of Mach-O binaries.Adrian Prantl2017-09-131-5/+1
| | | | | | | This is a feature supported by Darwin dwarfdump. UUIDs are used to associate executables with their .dSYM bundles. llvm-svn: 313165
* [ARC] Prepare the implementation of relocation for LLDLeslie Zhai2017-09-131-0/+3
| | | | | | | | | | | | Reviewers: ruiu, kparzysz, petecoup, rafael Reviewed By: kparzysz Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37556 llvm-svn: 313109
* [yaml2obj][ELF] Add support for symbol indexes greater than SHN_LORESERVEPetr Hosek2017-09-071-0/+37
| | | | | | | | | | | | | Right now Symbols must be either undefined or defined in a specific section. Some symbols have section indexes like SHN_ABS however. This change adds support for outputting symbols that have such section indexes. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D37391 llvm-svn: 312745
* [WebAssembly] Only treat imports/exports as symbols when reading relocatable ↵Sam Clegg2017-09-061-1/+1
| | | | | | | | | | | | | | | | | | | object files This change only treats imported and exports functions and globals as symbol table entries the object has a "linking" section (i.e. it is relocatable object file). In this case all globals must be of type I32 and initialized with i32.const. This was previously being assumed but not checked for and was causing a failure on big endian machines due to using the wrong value of then union. See: https://bugs.llvm.org/show_bug.cgi?id=34487 Differential Revision: https://reviews.llvm.org/D37497 llvm-svn: 312674
* [yaml2obj][ELF] Make symbols optional for relocationsPetr Hosek2017-08-301-1/+1
| | | | | | | | | | | | | | | | Some kinds of relocations do not have symbols, like R_X86_64_RELATIVE for instance. I would like to test this case in D36554 but currently can't because symbols are required by yaml2obj. The other option is using the empty symbol but that doesn't seem quite right to me. This change makes the Symbol field of Relocation optional and in the case where the user does not specify a symbol name the Symbol index is 0. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D37276 llvm-svn: 312192
* Move helper classes into anonymous namespaces.Benjamin Kramer2017-08-202-4/+6
| | | | | | No functionality change intended. llvm-svn: 311288
* [yaml2obj][ELF] Add support for program headersPetr Hosek2017-07-191-0/+38
| | | | | | | | | | | | | | | This change adds basic support for program headers. I need to do some testing which requires generating program headers but I can't use ld.lld or clang to produce programs that have headers. I'd also like to test some strange things that those programs may never produce. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D35276 llvm-svn: 308520
* [codeview] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueIdReid Kleckner2017-07-171-0/+27
| | | | | | | | | | | | | | | | | | Summary: We were treating the GUIDs in TypeServer2Record as strings, and the non-ASCII bytes in the GUID would not round-trip through YAML. We already had the PDB_UniqueId type portably represent a Windows GUID, but we need to hoist that up to the DebugInfo/CodeView library so that we can use it in the TypeServer2Record as well as in PDB parsing code. Reviewers: inglorion, amccarth Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35495 llvm-svn: 308234
* [WebAssembly] Expose the offset of each data segmentSam Clegg2017-07-121-1/+2
| | | | | | | | | | | | | | Summary: This allows tools like lld that process relocations to apply data relocation correctly. This information is required because relocation are stored as section offset. Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D35234 llvm-svn: 307741
* [ObjectYAML] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-07-0111-132/+227
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 306925
* Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTORRichard Smith2017-06-303-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | This is a short-term fix for PR33650 aimed to get the modules build bots green again. Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR macros to try to locally specialize a global template for a global type. That's not how C++ works. Instead, we now centrally define how to format vectors of fundamental types and of string (std::string and StringRef). We use flow formatting for the former cases, since that's the obvious right thing to do; in the latter case, it's less clear what the right choice is, but flow formatting is really bad for some cases (due to very long strings), so we pick block formatting. (Many of the cases that were using flow formatting for strings are improved by this change.) Other than the flow -> block formatting change for some vectors of strings, this should result in no functionality change. Differential Revision: https://reviews.llvm.org/D34907 Corresponding updates to clang, clang-tools-extra, and lld to follow. llvm-svn: 306878
* [YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values.George Rimar2017-06-301-0/+1
| | | | | | | | | | | | | That may be useful if we want to produce or parse object containing broken relocation values using yaml2obj/obj2yaml. Previously that was impossible because only enum values were parsed correctly, this patch allows to put any numeric value as a relocation type. Differential revision: https://reviews.llvm.org/D34758 llvm-svn: 306814
* [WebAssembly] Add data size and alignement to linking sectionSam Clegg2017-06-271-0/+2
| | | | | | | | | The overal size of the data section (including BSS) is otherwise not included in the wasm binary. Differential Revision: https://reviews.llvm.org/D34657 llvm-svn: 306459
* [codeview] respect signedness of APSInts when printing to YAMLBob Haarman2017-06-211-1/+1
| | | | | | | | | | | | | | | | | | Summary: This fixes a bug where we always treat APSInts in Codeview as signed when writing them to YAML. One symptom of this problem is that llvm-pdbdump raw would show Enumerator Values that differ between the original PDB and a PDB that has been round-tripped through YAML. Reviewers: zturner Reviewed By: zturner Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34013 llvm-svn: 305965
* [codeview] YAMLize all section offsets and indices in symbol recordsReid Kleckner2017-06-201-24/+22
| | | | | | | | | | | | We forgot to serialize these because llvm-readobj didn't dump them. They are typically all zeros in an object file. The linker fills them in with relocations before adding them to the PDB. Now we can properly round trip these symbols through pdb2yaml -> yaml2pdb. I made these fields optional with a zero default so that we can elide them from our test cases. llvm-svn: 305857
* [codeview] Fully initialize DataSym when mapping from YAMLReid Kleckner2017-06-201-0/+2
| | | | | | | | | | In the object file, the section index and relative offset are typically zero, so make these YAML fields optional with a default. It looks like there may be more partially initialized symbol records, but this should fix the msan bot. llvm-svn: 305842
* [WebAssembly] Add support for weak symbols in the binary formatSam Clegg2017-06-201-9/+41
| | | | | | | | | | | This also introduces the updated format for the "linking" section which can represent extra symbol information. See: https://github.com/WebAssembly/tool-conventions/pull/10 Differential Revision: https://reviews.llvm.org/D34019 llvm-svn: 305769
* [CodeView] Fix dumping of public symbol record flagsReid Kleckner2017-06-191-1/+10
| | | | | | | I noticed nonsensical type information while dumping PDBs produced by MSVC. llvm-svn: 305708
* Resubmit "[llvm-pdbutil] rewrite the "raw" output style."Zachary Turner2017-06-151-0/+10
| | | | | | | | | This resubmits commit c0c249e9f2ef83e1d1e5f166b50673d92f3579d7. It was broken due to some weird template issues, which have since been fixed. llvm-svn: 305517
* Revert "[llvm-pdbutil] rewrite the "raw" output style."Zachary Turner2017-06-151-10/+0
| | | | | | | | | This reverts commit 83ea17ebf2106859a51fbc2a86031b44d33696ad. This is failing due to some strange template problems, so reverting until it can be straightened out. llvm-svn: 305505
* [llvm-pdbutil] rewrite the "raw" output style.Zachary Turner2017-06-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After some internal discussions, we agreed that the raw output style had outlived its usefulness. It was originally created before we had even thought of dumping to YAML, and it was intended to give us some insight into the internals of a PDB file. Now we have YAML mode which does almost exactly this but is more powerful in that it can round-trip back to a PDB, which the raw mode could not do. So the raw mode had become purely a maintenance burden. One option was to just delete it. However, its original goal was to be as readable as possible while staying close to the "metal" - i.e. presenting the output in a way that maps directly to the underlying file format. We don't actually need that last requirement anymore since it's covered by the yaml mode, so we could repurpose "raw" mode to actually just be as readable as possible. This patch implements about 80% of the functionality previously in raw mode, but in a completely different style that is more akin to what cvdump outputs. Records are very compressed, often times appearing on just one line. One nice thing about this is that it makes full record matching easier, because you can grep for indices, names, and leaf types on a single line often. See the tests for some examples of what the new output looks like. Note that this patch actually regresses the functionality of raw mode in a few areas, but only because the patch was already unreasonably large and going 100% would have been even worse. Specifically, this patch is missing: The ability to dump module debug subsections (checksums, lines, etc) The ability to dump section headers Aside from that everything is here. While goign through the tests fixing them all up, I found many duplicate tests. They've been deleted. In subsequent patches I will go through and re-add the missing functionality. Differential Revision: https://reviews.llvm.org/D34191 llvm-svn: 305495
* MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.Peter Collingbourne2017-06-141-0/+1
| | | | | | | | | | | | | | This is part of the ODR checker proposal: http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html Per discussion on the gnu-gabi mailing list [1] the section type range 0x6fff4c00..0x6fff4cff is reserved for LLVM. [1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html Differential Revision: https://reviews.llvm.org/D33978 llvm-svn: 305407
* Resubmit "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-143-179/+210
| | | | | | | | | This was originally reverted because of some non-deterministic failures on certain buildbots. Luckily ASAN eventually caught this as a stack-use-after-scope, so the fix is included in this patch. llvm-svn: 305393
* Revert "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-143-210/+168
| | | | | | | | This is causing failures on linux bots with an invalid stream read. It doesn't repro in any configuration on Windows, so reverting until I have a chance to investigate on Linux. llvm-svn: 305371
* Use make_shared instead of make_unique.Zachary Turner2017-06-141-2/+2
| | | | llvm-svn: 305369
* Fix some more errors.Zachary Turner2017-06-142-11/+11
| | | | llvm-svn: 305368
* [codeview] Make obj2yaml/yaml2obj support .debug$S/T sections.Zachary Turner2017-06-143-161/+203
| | | | | | | | | | | | | | | This allows us to use yaml2obj and obj2yaml to round-trip CodeView symbol and type information without having to manually specify the bytes of the section. This makes for much easier to maintain tests. See the tests under lld/COFF in this patch for example. Before they just said SectionData: <blob> whereas now we can use meaningful record descriptions. Note that it still supports the SectionData yaml field, which could be useful for initializing a section to invalid bytes for testing, for example. Differential Revision: https://reviews.llvm.org/D34127 llvm-svn: 305366
* [pdb] Don't choke on unknown symbol types.Zachary Turner2017-06-121-6/+48
| | | | | | | | | When we get an unknown symbol type, we might as well at least dump it. Same goes for round-tripping through YAML, we can dump the record contents as raw bytes even if we don't know how to interpret it semantically. llvm-svn: 305248
* [pdb] Support CoffSymbolRVA debug subsection.Zachary Turner2017-06-091-0/+54
| | | | llvm-svn: 305108
* [CodeView] Support remaining debug subsection typesZachary Turner2017-06-092-28/+311
| | | | | | | | | | | | | | | | This adds support for Symbols, StringTable, and FrameData subsection types. Even though these subsections rarely if ever appear in a PDB file (they are usually in object files), there's no theoretical reason why they *couldn't* appear in a PDB. The real issue though is that in order to add support for dumping and writing them (which will be useful for object files), we need a way to test them. And since there is no support for reading and writing them to / from object files yet, making PDB support them is the best way to both add support for the underlying format and add support for tests at the same time. Later, when we go to add support for reading / writing them from object files, we'll need only minimal changes in the underlying read/write code. llvm-svn: 305037
* [llvm-pdbdump] Support native ordering of subsections in raw mode.Zachary Turner2017-06-081-28/+29
| | | | | | | | | | | | | This is the same change for the YAML Output style applied to the raw output style. Previously we would queue up all subsections until every one had been read, and then output them in a pre- determined order. This was because some subsections need to be read first in order to properly dump later subsections. This patch allows them to be dumped in the order they appear. Differential Revision: https://reviews.llvm.org/D34015 llvm-svn: 305034
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-074-14/+14
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [CodeView] Handle Cross Module Imports and Exports.Zachary Turner2017-06-052-9/+159
| | | | | | | | | | | | | | | While it's not entirely clear why a compiler or linker might put this information into an object or PDB file, one has been spotted in the wild which was causing llvm-pdbdump to crash. This patch adds support for reading-writing these sections. Since I don't know how to get one of the native tools to generate this kind of debug info, the only test here is one in which we feed YAML into the tool to produce a PDB and then spit out YAML from the resulting PDB and make sure that it matches. llvm-svn: 304738
* AMDGPU: Remove deprecated and unused elf definitionsKonstantin Zhuravlyov2017-06-051-6/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D33689 llvm-svn: 304737
OpenPOWER on IntegriCloud