StringRef getName() const override { return Function->SymbolName; }
StringRef getDebugName() const override { return Function->DebugName; }
uint32_t getComdat() const override { return Function->Comdat; }
- const ArrayRef<uint8_t> getFunctionBody() const { return Function->Body; }
uint32_t getFunctionInputOffset() const { return getInputSectionOffset(); }
+ uint32_t getFunctionCodeOffset() const { return Function->CodeOffset; }
uint32_t getFunctionIndex() const { return FunctionIndex.getValue(); }
bool hasFunctionIndex() const { return FunctionIndex.hasValue(); }
void setFunctionIndex(uint32_t Index);
#include "lld/Common/Memory.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Wasm.h"
-#include "llvm/Support/LEB128.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "lld"
return MBRef;
}
-static size_t getFunctionCodeOffset(ArrayRef<uint8_t> FunctionBody) {
- unsigned Count;
- llvm::decodeULEB128(FunctionBody.data(), &Count);
- return Count;
-}
-
void ObjFile::dumpInfo() const {
log("info for: " + getName() +
"\n Symbols : " + Twine(Symbols.size()) +
}
case R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
if (auto *Sym = dyn_cast<DefinedFunction>(getFunctionSymbol(Reloc.Index))) {
- size_t FunctionCodeOffset =
- getFunctionCodeOffset(Sym->Function->getFunctionBody());
- return Sym->Function->getFunctionInputOffset() + FunctionCodeOffset +
- Reloc.Addend;
+ return Sym->Function->getFunctionInputOffset() +
+ Sym->Function->getFunctionCodeOffset() + Reloc.Addend;
}
return 0;
case R_WEBASSEMBLY_SECTION_OFFSET_I32:
return getGlobalSymbol(Reloc.Index)->getGlobalIndex();
case R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
if (auto *Sym = dyn_cast<DefinedFunction>(getFunctionSymbol(Reloc.Index))) {
- size_t FunctionCodeOffset =
- getFunctionCodeOffset(Sym->Function->getFunctionBody());
- return Sym->Function->OutputOffset + FunctionCodeOffset + Reloc.Addend;
+ return Sym->Function->OutputOffset +
+ Sym->Function->getFunctionCodeOffset() + Reloc.Addend;
}
return 0;
case R_WEBASSEMBLY_SECTION_OFFSET_I32: