16cb07313SKellie Medlin //===- OutputSection.cpp --------------------------------------------------===//
26cb07313SKellie Medlin //
36cb07313SKellie Medlin // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
46cb07313SKellie Medlin // See https://llvm.org/LICENSE.txt for license information.
56cb07313SKellie Medlin // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66cb07313SKellie Medlin //
76cb07313SKellie Medlin //===----------------------------------------------------------------------===//
86cb07313SKellie Medlin 
96cb07313SKellie Medlin #include "OutputSection.h"
106cb07313SKellie Medlin #include "OutputSegment.h"
116cb07313SKellie Medlin 
126cb07313SKellie Medlin using namespace llvm;
136cb07313SKellie Medlin using namespace lld;
146cb07313SKellie Medlin using namespace lld::macho;
156cb07313SKellie Medlin 
getSegmentOffset() const16*c0ec1036SVy Nguyen uint64_t OutputSection::getSegmentOffset() const { return addr - parent->addr; }
1704e8d0b6SNico Weber 
assignAddressesToStartEndSymbols()1804e8d0b6SNico Weber void OutputSection::assignAddressesToStartEndSymbols() {
1904e8d0b6SNico Weber   for (Defined *d : sectionStartSymbols)
2004e8d0b6SNico Weber     d->value = addr;
2104e8d0b6SNico Weber   for (Defined *d : sectionEndSymbols)
2204e8d0b6SNico Weber     d->value = addr + getSize();
2304e8d0b6SNico Weber }
24