diff options
Diffstat (limited to 'wasm/InputSegment.cpp')
-rw-r--r-- | wasm/InputSegment.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/wasm/InputSegment.cpp b/wasm/InputSegment.cpp new file mode 100644 index 000000000000..650914386259 --- /dev/null +++ b/wasm/InputSegment.cpp @@ -0,0 +1,25 @@ +//===- InputSegment.cpp ---------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "InputSegment.h" +#include "OutputSegment.h" +#include "lld/Common/LLVM.h" + +#define DEBUG_TYPE "lld" + +using namespace llvm; +using namespace lld::wasm; + +uint32_t InputSegment::translateVA(uint32_t Address) const { + assert(Address >= startVA() && Address < endVA()); + int32_t Delta = OutputSeg->StartVA + OutputSegmentOffset - startVA(); + DEBUG(dbgs() << "translateVA: " << getName() << " Delta=" << Delta + << " Address=" << Address << "\n"); + return Address + Delta; +} |