blob: 650914386259504c429daf106f242b394345caf1 [file] [log] [blame]
Sam Cleggc94d3932017-11-17 18:14:09 +00001//===- InputSegment.cpp ---------------------------------------------------===//
2//
3// The LLVM Linker
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "InputSegment.h"
11#include "OutputSegment.h"
12#include "lld/Common/LLVM.h"
13
14#define DEBUG_TYPE "lld"
15
16using namespace llvm;
17using namespace lld::wasm;
18
19uint32_t InputSegment::translateVA(uint32_t Address) const {
20 assert(Address >= startVA() && Address < endVA());
21 int32_t Delta = OutputSeg->StartVA + OutputSegmentOffset - startVA();
22 DEBUG(dbgs() << "translateVA: " << getName() << " Delta=" << Delta
23 << " Address=" << Address << "\n");
24 return Address + Delta;
25}