mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
c94d393ad5
This linker backend is still a work in progress but is enough to link simple programs including linking against library archives. Differential Revision: https://reviews.llvm.org/D34851 llvm-svn: 318539
64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
//===- WriterUtils.h --------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Linker
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_WASM_WRITERUTILS_H
|
|
#define LLD_WASM_WRITERUTILS_H
|
|
|
|
#include "llvm/ADT/Twine.h"
|
|
#include "llvm/Object/Wasm.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using llvm::raw_ostream;
|
|
|
|
namespace lld {
|
|
namespace wasm {
|
|
|
|
struct OutputRelocation {
|
|
llvm::wasm::WasmRelocation Reloc;
|
|
uint32_t NewIndex;
|
|
uint32_t Value;
|
|
};
|
|
|
|
void debugWrite(uint64_t offset, llvm::Twine msg);
|
|
|
|
void writeUleb128(raw_ostream &OS, uint32_t Number, const char *msg);
|
|
|
|
void writeSleb128(raw_ostream &OS, int32_t Number, const char *msg);
|
|
|
|
void writeBytes(raw_ostream &OS, const char *bytes, size_t count,
|
|
const char *msg = nullptr);
|
|
|
|
void writeStr(raw_ostream &OS, const llvm::StringRef String,
|
|
const char *msg = nullptr);
|
|
|
|
void writeU8(raw_ostream &OS, uint8_t byte, const char *msg);
|
|
|
|
void writeU32(raw_ostream &OS, uint32_t Number, const char *msg);
|
|
|
|
void writeValueType(raw_ostream &OS, int32_t Type, const char *msg);
|
|
|
|
void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
|
|
|
|
void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
|
|
|
|
void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
|
|
|
|
void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
|
|
|
|
void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
|
|
|
|
void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
|
|
|
|
void writeReloc(raw_ostream &OS, const OutputRelocation &Reloc);
|
|
|
|
} // namespace wasm
|
|
} // namespace lld
|
|
|
|
#endif // LLD_WASM_WRITERUTILS_H
|