diff options
author | Thomas Lively <tlively@google.com> | 2019-04-12 22:27:48 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-04-12 22:27:48 +0000 |
commit | fef8de66a6ad56d71eb8bf8a401f8cdc82dea225 (patch) | |
tree | 55b9ddd2be0fc7c1ac1ef4b1683aa44bee339bc8 /llvm/lib/ObjectYAML/WasmYAML.cpp | |
parent | bdb5e4e4ca5fbc7ef528067b65dda298e191e059 (diff) | |
download | bcm5719-llvm-fef8de66a6ad56d71eb8bf8a401f8cdc82dea225.tar.gz bcm5719-llvm-fef8de66a6ad56d71eb8bf8a401f8cdc82dea225.zip |
[WebAssembly] Add DataCount section to object files
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
Diffstat (limited to 'llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/WasmYAML.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp index 3841c5b7712..19c7f54aed9 100644 --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -153,6 +153,11 @@ static void sectionMapping(IO &IO, WasmYAML::DataSection &Section) { IO.mapRequired("Segments", Section.Segments); } +static void sectionMapping(IO &IO, WasmYAML::DataCountSection &Section) { + commonSectionMapping(IO, Section); + IO.mapRequired("Count", Section.Count); +} + void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping( IO &IO, std::unique_ptr<WasmYAML::Section> &Section) { WasmYAML::SectionType SectionType; @@ -257,6 +262,11 @@ void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping( Section.reset(new WasmYAML::DataSection()); sectionMapping(IO, *cast<WasmYAML::DataSection>(Section.get())); break; + case wasm::WASM_SEC_DATACOUNT: + if (!IO.outputting()) + Section.reset(new WasmYAML::DataCountSection()); + sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get())); + break; default: llvm_unreachable("Unknown section type"); } @@ -278,6 +288,7 @@ void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration( ECase(ELEM); ECase(CODE); ECase(DATA); + ECase(DATACOUNT); #undef ECase } |