Path: blob/main/contrib/llvm-project/lld/MachO/OutputSegment.h
34907 views
//===- OutputSegment.h ------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLD_MACHO_OUTPUT_SEGMENT_H9#define LLD_MACHO_OUTPUT_SEGMENT_H1011#include "OutputSection.h"12#include "Symbols.h"13#include "lld/Common/LLVM.h"14#include "llvm/ADT/TinyPtrVector.h"1516#include <limits>17#include <vector>1819namespace lld::macho {2021namespace segment_names {2223constexpr const char dataConst[] = "__DATA_CONST";24constexpr const char dataDirty[] = "__DATA_DIRTY";25constexpr const char data[] = "__DATA";26constexpr const char dwarf[] = "__DWARF";27constexpr const char import[] = "__IMPORT";28constexpr const char ld[] = "__LD"; // output only with -r29constexpr const char linkEdit[] = "__LINKEDIT";30constexpr const char llvm[] = "__LLVM";31constexpr const char pageZero[] = "__PAGEZERO";32constexpr const char textExec[] = "__TEXT_EXEC";33constexpr const char text[] = "__TEXT";3435} // namespace segment_names3637class OutputSection;38class InputSection;3940class OutputSegment {41public:42void addOutputSection(OutputSection *os);43void sortOutputSections();44void assignAddressesToStartEndSymbols();4546const std::vector<OutputSection *> &getSections() const { return sections; }47size_t numNonHiddenSections() const;4849uint64_t fileOff = 0;50uint64_t fileSize = 0;51uint64_t addr = 0;52uint64_t vmSize = 0;53int inputOrder = UnspecifiedInputOrder;54StringRef name;55uint32_t maxProt = 0;56uint32_t initProt = 0;57uint32_t flags = 0;58uint8_t index;5960llvm::TinyPtrVector<Defined *> segmentStartSymbols;61llvm::TinyPtrVector<Defined *> segmentEndSymbols;6263private:64std::vector<OutputSection *> sections;65};6667extern std::vector<OutputSegment *> outputSegments;6869void sortOutputSegments();70void resetOutputSegments();7172OutputSegment *getOrCreateOutputSegment(StringRef name);7374} // namespace lld::macho7576#endif777879