Index: llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h =================================================================== --- llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h +++ llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h @@ -28,27 +28,6 @@ class MCValue; class raw_pwrite_stream; -// Information about a single relocation. -struct WasmRelocationEntry { - uint64_t Offset; // Where is the relocation. - const MCSymbolWasm *Symbol; // The symbol to relocate with. - int64_t Addend; // A value to add to the symbol. - unsigned Type; // The type of the relocation. - MCSectionWasm *FixupSection;// The section the relocation is targeting. - - WasmRelocationEntry(uint64_t Offset, const MCSymbolWasm *Symbol, - int64_t Addend, unsigned Type, - MCSectionWasm *FixupSection) - : Offset(Offset), Symbol(Symbol), Addend(Addend), Type(Type), - FixupSection(FixupSection) {} - - void print(raw_ostream &Out) const { - Out << "Off=" << Offset << ", Sym=" << Symbol << ", Addend=" << Addend - << ", Type=" << Type << ", FixupSection=" << FixupSection; - } - void dump() const { print(errs()); } -}; - class MCWasmObjectTargetWriter { const unsigned Is64Bit : 1; @@ -56,17 +35,11 @@ explicit MCWasmObjectTargetWriter(bool Is64Bit_); public: - virtual ~MCWasmObjectTargetWriter() {} + virtual ~MCWasmObjectTargetWriter(); virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const = 0; - virtual bool needsRelocateWithSymbol(const MCSymbol &Sym, - unsigned Type) const; - - virtual void sortRelocs(const MCAssembler &Asm, - std::vector &Relocs); - /// \name Accessors /// @{ bool is64Bit() const { return Is64Bit; } Index: llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp =================================================================== --- llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp +++ llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp @@ -17,11 +17,5 @@ MCWasmObjectTargetWriter::MCWasmObjectTargetWriter(bool Is64Bit_) : Is64Bit(Is64Bit_) {} -bool MCWasmObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym, - unsigned Type) const { - return false; -} - -void MCWasmObjectTargetWriter::sortRelocs( - const MCAssembler &Asm, std::vector &Relocs) { -} +// Pin the vtable to this object file +MCWasmObjectTargetWriter::~MCWasmObjectTargetWriter() = default; Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp =================================================================== --- llvm/trunk/lib/MC/WasmObjectWriter.cpp +++ llvm/trunk/lib/MC/WasmObjectWriter.cpp @@ -127,6 +127,27 @@ uint32_t ImportIndex; }; +// Information about a single relocation. +struct WasmRelocationEntry { + uint64_t Offset; // Where is the relocation. + const MCSymbolWasm *Symbol; // The symbol to relocate with. + int64_t Addend; // A value to add to the symbol. + unsigned Type; // The type of the relocation. + MCSectionWasm *FixupSection;// The section the relocation is targeting. + + WasmRelocationEntry(uint64_t Offset, const MCSymbolWasm *Symbol, + int64_t Addend, unsigned Type, + MCSectionWasm *FixupSection) + : Offset(Offset), Symbol(Symbol), Addend(Addend), Type(Type), + FixupSection(FixupSection) {} + + void print(raw_ostream &Out) const { + Out << "Off=" << Offset << ", Sym=" << Symbol << ", Addend=" << Addend + << ", Type=" << Type << ", FixupSection=" << FixupSection; + } + void dump() const { print(errs()); } +}; + class WasmObjectWriter : public MCObjectWriter { /// Helper struct for containing some precomputed information on symbols. struct WasmSymbolData {