forked from OSchip/llvm-project
[llvm-objdump][Wasm][NFC] Create WasmDump.h
Summary: Continuing from D77285, the external interfaces implemented by `WasmDump.cpp` are now declared in `WasmDump.h` and moved into the `llvm::objdump` namespace. Reviewers: jhenderson, MaskRay, DiggerLin, jasonliu, daltenty Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D77990
This commit is contained in:
parent
fe06e231ff
commit
5ea28196f1
|
@ -11,13 +11,15 @@
|
||||||
///
|
///
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "WasmDump.h"
|
||||||
|
|
||||||
#include "llvm-objdump.h"
|
#include "llvm-objdump.h"
|
||||||
#include "llvm/Object/Wasm.h"
|
#include "llvm/Object/Wasm.h"
|
||||||
|
|
||||||
|
using namespace llvm;
|
||||||
using namespace llvm::object;
|
using namespace llvm::object;
|
||||||
|
|
||||||
namespace llvm {
|
void objdump::printWasmFileHeader(const object::ObjectFile *Obj) {
|
||||||
void printWasmFileHeader(const object::ObjectFile *Obj) {
|
|
||||||
const auto *File = dyn_cast<const WasmObjectFile>(Obj);
|
const auto *File = dyn_cast<const WasmObjectFile>(Obj);
|
||||||
|
|
||||||
outs() << "Program Header:\n";
|
outs() << "Program Header:\n";
|
||||||
|
@ -26,7 +28,7 @@ void printWasmFileHeader(const object::ObjectFile *Obj) {
|
||||||
outs() << "\n";
|
outs() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Error getWasmRelocationValueString(const WasmObjectFile *Obj,
|
Error objdump::getWasmRelocationValueString(const WasmObjectFile *Obj,
|
||||||
const RelocationRef &RelRef,
|
const RelocationRef &RelRef,
|
||||||
SmallVectorImpl<char> &Result) {
|
SmallVectorImpl<char> &Result) {
|
||||||
const wasm::WasmRelocation &Rel = Obj->getWasmRelocation(RelRef);
|
const wasm::WasmRelocation &Rel = Obj->getWasmRelocation(RelRef);
|
||||||
|
@ -49,4 +51,3 @@ Error getWasmRelocationValueString(const WasmObjectFile *Obj,
|
||||||
Result.append(FmtBuf.begin(), FmtBuf.end());
|
Result.append(FmtBuf.begin(), FmtBuf.end());
|
||||||
return Error::success();
|
return Error::success();
|
||||||
}
|
}
|
||||||
} // namespace llvm
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
//===-- WasmDump.h - wasm-specific dumper -----------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_TOOLS_LLVM_OBJDUMP_WASMDUMP_H
|
||||||
|
#define LLVM_TOOLS_LLVM_OBJDUMP_WASMDUMP_H
|
||||||
|
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
|
||||||
|
class Error;
|
||||||
|
|
||||||
|
namespace object {
|
||||||
|
class WasmObjectFile;
|
||||||
|
class ObjectFile;
|
||||||
|
class RelocationRef;
|
||||||
|
} // namespace object
|
||||||
|
|
||||||
|
namespace objdump {
|
||||||
|
|
||||||
|
Error getWasmRelocationValueString(const object::WasmObjectFile *Obj,
|
||||||
|
const object::RelocationRef &RelRef,
|
||||||
|
llvm::SmallVectorImpl<char> &Result);
|
||||||
|
|
||||||
|
void printWasmFileHeader(const object::ObjectFile *O);
|
||||||
|
|
||||||
|
} // namespace objdump
|
||||||
|
} // namespace llvm
|
||||||
|
|
||||||
|
#endif
|
|
@ -18,6 +18,7 @@
|
||||||
#include "llvm-objdump.h"
|
#include "llvm-objdump.h"
|
||||||
#include "COFFDump.h"
|
#include "COFFDump.h"
|
||||||
#include "MachODump.h"
|
#include "MachODump.h"
|
||||||
|
#include "WasmDump.h"
|
||||||
#include "XCOFFDump.h"
|
#include "XCOFFDump.h"
|
||||||
#include "llvm/ADT/Optional.h"
|
#include "llvm/ADT/Optional.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
|
|
@ -118,9 +118,6 @@ SectionFilter ToolSectionFilter(llvm::object::ObjectFile const &O,
|
||||||
Error getELFRelocationValueString(const object::ELFObjectFileBase *Obj,
|
Error getELFRelocationValueString(const object::ELFObjectFileBase *Obj,
|
||||||
const object::RelocationRef &Rel,
|
const object::RelocationRef &Rel,
|
||||||
llvm::SmallVectorImpl<char> &Result);
|
llvm::SmallVectorImpl<char> &Result);
|
||||||
Error getWasmRelocationValueString(const object::WasmObjectFile *Obj,
|
|
||||||
const object::RelocationRef &RelRef,
|
|
||||||
llvm::SmallVectorImpl<char> &Result);
|
|
||||||
|
|
||||||
uint64_t getELFSectionLMA(const object::ELFSectionRef& Sec);
|
uint64_t getELFSectionLMA(const object::ELFSectionRef& Sec);
|
||||||
|
|
||||||
|
@ -128,7 +125,6 @@ bool isRelocAddressLess(object::RelocationRef A, object::RelocationRef B);
|
||||||
void printELFFileHeader(const object::ObjectFile *O);
|
void printELFFileHeader(const object::ObjectFile *O);
|
||||||
void printELFDynamicSection(const object::ObjectFile *Obj);
|
void printELFDynamicSection(const object::ObjectFile *Obj);
|
||||||
void printELFSymbolVersionInfo(const object::ObjectFile *Obj);
|
void printELFSymbolVersionInfo(const object::ObjectFile *Obj);
|
||||||
void printWasmFileHeader(const object::ObjectFile *O);
|
|
||||||
void printRawClangAST(const object::ObjectFile *O);
|
void printRawClangAST(const object::ObjectFile *O);
|
||||||
void printRelocations(const object::ObjectFile *O);
|
void printRelocations(const object::ObjectFile *O);
|
||||||
void printDynamicRelocations(const object::ObjectFile *O);
|
void printDynamicRelocations(const object::ObjectFile *O);
|
||||||
|
|
Loading…
Reference in New Issue