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"
21 class OutputSectionBase;
22 template <class ELFT> class InputSectionBase;
23 template <class ELFT> class ObjectFile;
24 template <class ELFT> class SymbolTable;
25 template <class ELFT> void writeResult();
26 template <class ELFT> void markLive();
27 template <class ELFT> bool isRelroSection(const OutputSectionBase *Sec);
29 // This describes a program header entry.
30 // Each contains type, access flags and range of output sections that will be
33 PhdrEntry(unsigned Type, unsigned Flags);
34 void add(OutputSectionBase *Sec);
40 uint64_t p_filesz = 0;
41 uint64_t p_offset = 0;
45 OutputSectionBase *First = nullptr;
46 OutputSectionBase *Last = nullptr;
50 llvm::StringRef getOutputSectionName(llvm::StringRef Name);
53 void allocateHeaders(llvm::MutableArrayRef<PhdrEntry>,
54 llvm::ArrayRef<OutputSectionBase *>);
55 template <class ELFT> void reportDiscarded(InputSectionBase<ELFT> *IS);
57 template <class ELFT> uint32_t getMipsEFlags();
59 uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
60 llvm::StringRef FileName);
62 bool isMipsN32Abi(const InputFile *F);