llvm-capstone/lld/wasm/InputSegment.cpp
Sam Clegg c94d393ad5 [WebAssembly] Initial wasm linker implementation
This linker backend is still a work in progress but is
enough to link simple programs including linking against
library archives.

Differential Revision: https://reviews.llvm.org/D34851

llvm-svn: 318539
2017-11-17 18:14:09 +00:00

26 lines
826 B
C++

//===- 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;
}