diff options
author | Dan Gohman <dan433584@gmail.com> | 2017-02-22 18:50:20 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2017-02-22 18:50:20 +0000 |
commit | 7ea5adfff4c73c76d52fe5aad3106244b0b0e301 (patch) | |
tree | 70625b23dcc784cfa6dfb69d1762906b06b1c9bb /llvm/lib/MC/WasmObjectWriter.cpp | |
parent | f1141285eb1f8bd857bb646ff54b2cacf75b28fc (diff) | |
download | bcm5719-llvm-7ea5adfff4c73c76d52fe5aad3106244b0b0e301.tar.gz bcm5719-llvm-7ea5adfff4c73c76d52fe5aad3106244b0b0e301.zip |
[WebAssembly] Implement the wasm binary container header.
Also, update the version number to 0x1, which is what engines are now
expecting.
llvm-svn: 295860
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index cb11bab01eb..3a6114ad285 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/Endian.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/StringSaver.h" +#include "llvm/Support/Wasm.h" #include <vector> using namespace llvm; @@ -90,7 +91,8 @@ WasmObjectWriter::~WasmObjectWriter() {} // Emit the Wasm header. void WasmObjectWriter::writeHeader(const MCAssembler &Asm) { - // TODO: write the magic cookie and the version. + writeBytes(StringRef(wasm::WasmMagic, sizeof(wasm::WasmMagic))); + writeLE32(wasm::WasmVersion); } void WasmObjectWriter::executePostLayoutBinding(MCAssembler &Asm, |