1 //===- Writer.h -------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_ELF_WRITER_H
10 #define LLD_ELF_WRITER_H
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
22 class InputSectionBase;
23 void copySectionsIntoPartitions();
24 template <class ELFT> void createSyntheticSections();
25 void combineEhSections();
26 template <class ELFT> void writeResult();
28 // This describes a program header entry.
29 // Each contains type, access flags and range of output sections that will be
32 PhdrEntry(unsigned type, unsigned flags)
33 : p_align(type == llvm::ELF::PT_LOAD ? config->maxPageSize : 0),
34 p_type(type), p_flags(flags) {}
35 void add(OutputSection *sec);
40 uint64_t p_filesz = 0;
41 uint64_t p_offset = 0;
46 OutputSection *firstSec = nullptr;
47 OutputSection *lastSec = nullptr;
50 uint64_t lmaOffset = 0;
53 void addReservedSymbols();
54 llvm::StringRef getOutputSectionName(const InputSectionBase *s);
56 template <class ELFT> uint32_t calcMipsEFlags();
58 uint8_t getMipsFpAbiFlag(uint8_t oldFlag, uint8_t newFlag,
59 llvm::StringRef fileName);
61 bool isMipsN32Abi(const InputFile *f);