Sam Clegg | c94d393 | 2017-11-17 18:14:09 +0000 | [diff] [blame^] | 1 | //===- 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 | |
| 16 | using namespace llvm; |
| 17 | using namespace lld::wasm; |
| 18 | |
| 19 | uint32_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 | } |