xref: /openbsd-src/gnu/llvm/lld/MachO/OutputSection.cpp (revision dfe94b169149f14cc1aee2cf6dad58a8d9a1860c)
1bb684c34Spatrick //===- OutputSection.cpp --------------------------------------------------===//
2bb684c34Spatrick //
3bb684c34Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4bb684c34Spatrick // See https://llvm.org/LICENSE.txt for license information.
5bb684c34Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6bb684c34Spatrick //
7bb684c34Spatrick //===----------------------------------------------------------------------===//
8bb684c34Spatrick 
9bb684c34Spatrick #include "OutputSection.h"
10bb684c34Spatrick #include "OutputSegment.h"
11bb684c34Spatrick 
12bb684c34Spatrick using namespace llvm;
13bb684c34Spatrick using namespace lld;
14bb684c34Spatrick using namespace lld::macho;
15bb684c34Spatrick 
getSegmentOffset() const16*dfe94b16Srobert uint64_t OutputSection::getSegmentOffset() const { return addr - parent->addr; }
171cf9926bSpatrick 
assignAddressesToStartEndSymbols()181cf9926bSpatrick void OutputSection::assignAddressesToStartEndSymbols() {
191cf9926bSpatrick   for (Defined *d : sectionStartSymbols)
201cf9926bSpatrick     d->value = addr;
211cf9926bSpatrick   for (Defined *d : sectionEndSymbols)
221cf9926bSpatrick     d->value = addr + getSize();
23bb684c34Spatrick }
24