1 //===- Writer.h -------------------------------------------------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_ELF_WRITER_H
11 #define LLD_ELF_WRITER_H
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
22 class InputSectionBase;
23 template <class ELFT> class ObjFile;
25 template <class ELFT> void writeResult();
26 template <class ELFT> void markLive();
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) : p_type(Type), p_flags(Flags) {}
33 void add(OutputSection *Sec);
38 uint64_t p_filesz = 0;
39 uint64_t p_offset = 0;
44 OutputSection *FirstSec = nullptr;
45 OutputSection *LastSec = nullptr;
48 // True if one of the sections in this program header has a LMA specified via
49 // linker script: AT(addr). We never allow 2 or more sections with LMA in the
50 // same program header.
51 bool ASectionHasLMA = false;
53 uint64_t LMAOffset = 0;
56 void addReservedSymbols();
57 llvm::StringRef getOutputSectionName(InputSectionBase *S);
59 template <class ELFT> uint32_t calcMipsEFlags();
61 uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
62 llvm::StringRef FileName);
64 bool isMipsN32Abi(const InputFile *F);