diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:21 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:21 +0000 |
commit | eb1ff93d02b5f17b6b409e83c6d9be585f4a04b3 (patch) | |
tree | 7490b4a8943293f251ad733465936e6ec302b3e9 /wasm/InputSegment.cpp | |
parent | bafea25f368c63f0b39789906adfed6e39219e64 (diff) |
Notes
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; +} |