blob: 3fb3e65fb910d0048e241fd0ee7855442eaaf6b1 [file] [log] [blame]
Dan Gohman18eafb62017-02-22 01:23:18 +00001//===-- WebAssemblyWasmObjectWriter.cpp - WebAssembly Wasm Writer ---------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief This file handles Wasm-specific object emission, converting LLVM's
12/// internal fixups into the appropriate relocations.
13///
14//===----------------------------------------------------------------------===//
15
16#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
17#include "llvm/MC/MCFixup.h"
18#include "llvm/MC/MCWasmObjectWriter.h"
19#include "llvm/Support/ErrorHandling.h"
20using namespace llvm;
21
22namespace {
23class WebAssemblyWasmObjectWriter final : public MCWasmObjectTargetWriter {
24public:
25 explicit WebAssemblyWasmObjectWriter(bool Is64Bit);
26
27private:
28 unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
29 const MCFixup &Fixup, bool IsPCRel) const override;
30};
31} // end anonymous namespace
32
33WebAssemblyWasmObjectWriter::WebAssemblyWasmObjectWriter(bool Is64Bit)
34 : MCWasmObjectTargetWriter(Is64Bit) {}
35
36unsigned WebAssemblyWasmObjectWriter::getRelocType(MCContext &Ctx,
37 const MCValue &Target,
38 const MCFixup &Fixup,
39 bool IsPCRel) const {
40 llvm_unreachable("Relocations not yet implemented");
41 return 0;
42}
43
44MCObjectWriter *llvm::createWebAssemblyWasmObjectWriter(raw_pwrite_stream &OS,
45 bool Is64Bit) {
46 MCWasmObjectTargetWriter *MOTW = new WebAssemblyWasmObjectWriter(Is64Bit);
47 return createWasmObjectWriter(MOTW, OS);
48}