summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2wasm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-071-658/+0
| | | | | | | | | | | | | | Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath Reviewed By: rupprecht Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65255 llvm-svn: 368119
* Revert "[yaml2obj] Move core yaml2obj code into lib and include for use in ↵Dmitri Gribenko2019-08-061-0/+658
| | | | | | | | unit tests" This reverts commit r368021, it broke tests. llvm-svn: 368035
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-061-658/+0
| | | | | | | | | | | | | | Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath Reviewed By: rupprecht Subscribers: seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65255 llvm-svn: 368021
* [WebAssembly] Add more test coverage for reloctions against section symbolsSam Clegg2019-05-071-5/+0
| | | | | | | | | | | | | The only known user of this relocation type and symbol type is the debug info sections, but we were not testing the `--relocatable` output path. This change adds a minimal test case to cover relocations against section symbols includes `--relocatable` output. Differential Revision: https://reviews.llvm.org/D61623 llvm-svn: 360110
* [WebAssembly] Add DataCount section to object filesThomas Lively2019-04-121-0/+10
| | | | | | | | | | | | | | | | | | | Summary: This ensures that object files will continue to validate as WebAssembly modules in the presence of bulk memory operations. Engines that don't support bulk memory operations will not recognize the DataCount section and will report validation errors, but that's ok because object files aren't supposed to be run directly anyway. Reviewers: aheejin, dschuff, sbc100 Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60623 llvm-svn: 358315
* [WebAssembly] Target features sectionThomas Lively2019-03-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implements a new target features section in assembly and object files that records what features are used, required, and disallowed in WebAssembly objects. The linker uses this information to ensure that all objects participating in a link are feature-compatible and records the set of used features in the output binary for use by optimizers and other tools later in the toolchain. The "atomics" feature is always required or disallowed to prevent linking code with stripped atomics into multithreaded binaries. Other features are marked used if they are enabled globally or on any function in a module. Future CLs will add linker flags for ignoring feature compatibility checks and for specifying the set of allowed features, implement using the presence of the "atomics" feature to control the type of memory and segments in the linked binary, and add front-end flags for relaxing the linkage policy for atomics. Reviewers: aheejin, sbc100, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59173 llvm-svn: 356610
* [WebAssembly] Update MC for bulk memoryThomas Lively2019-02-191-2/+5
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* [WebAssembly] Fix imported function symbol names that differ from their ↵Dan Gohman2019-02-071-1/+2
| | | | | | | | | | | | | | import names in the .o format Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. This is the MC/Object portion of the patch. Differential Revision: https://reviews.llvm.org/D57632 llvm-svn: 353474
* [WebAssembly] clang-tidy (NFC)Heejin Ahn2019-02-041-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes clang-tidy warnings on wasm-only files. The list of checks used is: `-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*` (LLVM's default .clang-tidy list is the same except it does not have `modernize-*`. But I've seen in multiple CLs in LLVM the modernize style was recommended and code was fixed based on the style, so I added it as well.) The common fixes are: - Variable names start with an uppercase letter - Function names start with a lowercase letter - Use `auto` when you use casts so the type is evident - Use inline initialization for class member variables - Use `= default` for empty constructors / destructors - Use `using` in place of `typedef` Reviewers: sbc100, tlively, aardappel Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D57500 llvm-svn: 353075
* [WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_Sam Clegg2019-02-041-5/+5
| | | | | | | | | | | | | | | | See https://github.com/WebAssembly/tool-conventions/pull/95. This is less typing and IMHO more readable, and it also fits with our naming around the binary format which tends to use the short name. e.g. include/llvm/BinaryFormat/Wasm.h tools/llvm-objdump/WasmDump.cpp etc.. Differential Revision: https://reviews.llvm.org/D57611 llvm-svn: 353062
* 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
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-171-0/+27
| | | | llvm-svn: 351413
* Revert "[WebAssembly] Parse llvm.ident into producers section"Thomas Lively2019-01-171-27/+0
| | | | | | This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d. llvm-svn: 351410
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-161-0/+27
| | | | | | | | | | | | | | Summary: Everything before the word "version" is the tool, and everything after the word "version" is the version. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56742 llvm-svn: 351399
* [WebAssembly] Massive instruction renamingThomas Lively2019-01-081-1/+1
| | | | | | | | | | | | | | | Summary: An automated renaming of all the instructions listed at https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329 as well as some similarly-named identifiers. Reviewers: aheejin, dschuff, aardappel Subscribers: sbc100, jgravelle-google, eraman, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D56338 llvm-svn: 350609
* [WebAssembly] Check if the section order is correctHeejin Ahn2018-12-151-0/+9
| | | | | | | | | | | | | | | | | | | | Summary: This patch checks if the section order is correct when reading a wasm object file in `WasmObjectFile` and converting YAML to wasm object in yaml2wasm. (It is not possible to check when reading YAML because it is handled exclusively by the YAML reader.) This checks the ordering of all known sections (core sections + known custom sections). This also adds section ID DataCount section that will be scheduled to be added in near future. Reviewers: sbc100 Subscribers: dschuff, mgorny, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54924 llvm-svn: 349221
* [WebAssembly] Update dylink section parsingSam Clegg2018-12-121-0/+4
| | | | | | | | | | This updates the format of the dylink section in accordance with recent "spec" change: https://github.com/WebAssembly/tool-conventions/pull/77 Differential Revision: https://reviews.llvm.org/D55609 llvm-svn: 348989
* [WebAssembly] Add support for dylink section in object formatSam Clegg2018-11-141-1/+15
| | | | | | | | See https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md. Differential Revision: https://reviews.llvm.org/D54490 llvm-svn: 346880
* [WebAssembly] Add support for the event sectionHeejin Ahn2018-11-141-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds support for the 'event section' specified in the exception handling proposal. (This was named 'exception section' first, but later renamed to 'event section' to take possibilities of other kinds of events into consideration. But currently we only store exception info in this section.) The event section is added between the global section and the export section. This is for ease of validation per request of the V8 team. This patch: - Creates the event symbol type, which is a weak symbol - Makes 'throw' instruction take the event symbol '__cpp_exception' - Adds relocation support for events - Adds WasmObjectWriter / WasmObjectFile (Reader) support - Adds obj2yaml / yaml2obj support - Adds '.eventtype' printing support Reviewers: dschuff, sbc100, aardappel Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54096 llvm-svn: 346825
* [WebAssembly] clang-format (NFC)Heejin Ahn2018-09-051-32/+31
| | | | | | | | | | | | Summary: This patch runs clang-format on all wasm-only files. Reviewers: aardappel, dschuff, sunfish, tlively Subscribers: MatzeB, sbc100, jgravelle-google, llvm-commits Differential Revision: https://reviews.llvm.org/D51447 llvm-svn: 341439
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | 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
* [WebAssembly] Write DWARF data into wasm object fileSam Clegg2018-04-261-4/+17
| | | | | | | | | | | - Writes ".debug_XXX" into corresponding custom sections. - Writes relocation records into "reloc.debug_XXX" sections. Patch by Yury Delendik! Differential Revision: https://reviews.llvm.org/D44184 llvm-svn: 330982
* [WebAssembly] Add version to object file metadataSam Clegg2018-04-261-0/+1
| | | | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/issues/54 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46069 llvm-svn: 330969
* [WebAssembly] Use section index in relocation section headerSam Clegg2018-04-241-6/+10
| | | | | | | | | | | Rather than referring to sections my their code, use the absolute index of the target section within the module. See https://github.com/WebAssembly/tool-conventions/issues/52 Differential Revision: https://reviews.llvm.org/D45980 llvm-svn: 330749
* [WebAssembly] libObject: Don't include the name the size of custom sectionsSam Clegg2018-04-121-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D45579 llvm-svn: 329947
* [WebAssembly] Use uint8_t for single byte values to match the specSam Clegg2018-03-011-22/+22
| | | | | | | | | | | | | The original BinaryEncoding.md document used to specify that these values were `varint7`, but the official spec lists them explicitly as single byte values and not LEB. A similar change for wabt is in flight: https://github.com/WebAssembly/wabt/pull/782 Differential Revision: https://reviews.llvm.org/D43921 llvm-svn: 326454
* [WebAssembly] Remove DataSize from linking metadata sectionSam Clegg2018-02-271-5/+0
| | | | | | | | | | | Neither the linker nor the runtime need this information anymore. We were originally using this to model BSS size but the plan is now to use the segment metadata to allow for BSS segments. Differential Revision: https://reviews.llvm.org/D41366 llvm-svn: 326267
* [WebAssembly] NDEBUG is spelled without a leading underscore.Benjamin Kramer2018-02-231-1/+1
| | | | llvm-svn: 325893
* [WebAssembly] Add first claass symbol table to wasm objectsSam Clegg2018-02-231-8/+31
| | | | | | | | | | | | | | | | | | | | This is combination of two patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41954 2. https://reviews.llvm.org/D42495 Along with a few local modifications: - One change I made was to add the UNDEFINED bit to the binary format to avoid the extra byte used when writing data symbols. Although this bit is redundant for other symbols types (i.e. undefined can be implied if a function or global is a wasm import) - I prefer to be explicit and consistent and not have derived flags. - Some field renaming. - Some reverting of unrelated minor changes. - No test output differences. Differential Revision: https://reviews.llvm.org/D43147 llvm-svn: 325860
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-091-0/+17
| | | | | | | | | | | | | | This adds COMDAT support to the Wasm object-file format. Spec: https://github.com/WebAssembly/tool-conventions/pull/31 Corresponding LLD change: https://bugs.llvm.org/show_bug.cgi?id=35533, and D40845 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40844 llvm-svn: 322135
* [WebAssembly] Explicitly specify function/global index space in YAMLSam Clegg2018-01-091-3/+34
| | | | | | | | | | | These indexes are useful because they are not always zero based and functions and globals are referenced elsewhere by their index. This matches what we already do for the type index space. Differential Revision: https://reviews.llvm.org/D41877 llvm-svn: 322121
* [WebAssembly] Add support for init functions linking metadataSam Clegg2017-12-141-0/+11
| | | | | | | | | | | | | | | Summary: This change lays the groundwork lowering of @llvm.global_ctors and @llvm.global_dtors for the wasm object format. Some parts of this patch are subset of: https://reviews.llvm.org/D40759 See https://github.com/WebAssembly/tool-conventions/issues/25 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41208 llvm-svn: 320742
* [WebAssembly] Add linking metatdata test coverage for wasm2yamlSam Clegg2017-12-131-1/+0
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41196 llvm-svn: 320639
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-2/+0
| | | | llvm-svn: 320631
* [WebAssembly] Allow each data segment to specify its own alignmentSam Clegg2017-09-291-11/+8
| | | | | | | | | 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/+11
| | | | | | | | | 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-11/+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/+11
| | | | | | | | | 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
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-011-3/+3
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
* [WebAssembly] Expose the offset of each data segmentSam Clegg2017-07-121-1/+1
| | | | | | | | | | | | | | 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
* [WebAssembly] Add data size and alignement to linking sectionSam Clegg2017-06-271-16/+44
| | | | | | | | | 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
* [WebAssembly] Add support for weak symbols in the binary formatSam Clegg2017-06-201-7/+32
| | | | | | | | | | | 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
* [WebAssembly] Fix build error in wasm YAML codeSam Clegg2017-05-101-4/+4
| | | | | | | | | | | This warning didn't show up on my local build but is causing the bots to fail. Seems like a bad idea to have types and variables with the same name anyhow. Differential Revision: https://reviews.llvm.org/D33022 llvm-svn: 302606
* [WebAssembly] Improve libObject support for wasm imports and exportsSam Clegg2017-05-091-2/+9
| | | | | | | | | | | | Previously we had only supported the importing and exporting of functions and globals. Also, add usefull overload of getWasmSymbol() and getNumberOfSymbols() in support of lld port. Differential Revision: https://reviews.llvm.org/D33011 llvm-svn: 302601
* [WebAssembly] Add ObjectYAML support for wasm name sectionSam Clegg2017-05-051-10/+36
| | | | | | Differential Revision: https://reviews.llvm.org/D32841 llvm-svn: 302266
* [WebAssembly] Improve support for WebAssembly binary formatDerek Schuff2017-03-301-0/+377
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
OpenPOWER on IntegriCloud