blob: 8383a0493c293e5433bfb20fd4e6a4cafc641651 [file] [log] [blame]
Rafael Espindolabeee25e2015-08-14 14:12:54 +00001//===- Writer.h -------------------------------------------------*- C++ -*-===//
Michael J. Spencer84487f12015-07-24 21:03:07 +00002//
3// The LLVM Linker
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLD_ELF_WRITER_H
11#define LLD_ELF_WRITER_H
12
Eugene Leviantbbe38602016-07-19 09:25:43 +000013#include <cstdint>
George Rimar5d53d1f2016-07-12 08:50:42 +000014#include <memory>
15
16namespace llvm {
17 class StringRef;
18}
19
Michael J. Spencer84487f12015-07-24 21:03:07 +000020namespace lld {
Rafael Espindolae0df00b2016-02-28 00:25:54 +000021namespace elf {
Eugene Leviantbbe38602016-07-19 09:25:43 +000022template <class ELFT> class OutputSectionBase;
George Rimar5d53d1f2016-07-12 08:50:42 +000023template <class ELFT> class InputSectionBase;
24template <class ELFT> class ObjectFile;
Rui Ueyama3ce825e2015-10-09 21:07:25 +000025template <class ELFT> class SymbolTable;
Rui Ueyama84907c52016-08-09 03:38:23 +000026template <class ELFT> void writeResult();
Rui Ueyama4f8d21f2016-05-02 19:30:42 +000027template <class ELFT> void markLive();
Eugene Leviantbbe38602016-07-19 09:25:43 +000028template <class ELFT> bool isRelroSection(OutputSectionBase<ELFT> *Sec);
Eugene Leviantbbe38602016-07-19 09:25:43 +000029
30// This describes a program header entry.
31// Each contains type, access flags and range of output sections that will be
32// placed in it.
33template<class ELFT>
Rafael Espindola74df5c72016-07-19 12:33:46 +000034struct PhdrEntry {
35 PhdrEntry(unsigned Type, unsigned Flags);
Rui Ueyama18f084f2016-07-20 19:36:41 +000036 void add(OutputSectionBase<ELFT> *Sec);
Eugene Leviantbbe38602016-07-19 09:25:43 +000037
38 typename ELFT::Phdr H = {};
39 OutputSectionBase<ELFT> *First = nullptr;
40 OutputSectionBase<ELFT> *Last = nullptr;
41};
George Rimar5d53d1f2016-07-12 08:50:42 +000042
43template <class ELFT>
44llvm::StringRef getOutputSectionName(InputSectionBase<ELFT> *S);
45
Rui Ueyama96bdd5b2016-07-25 22:26:28 +000046template <class ELFT> void reportDiscarded(InputSectionBase<ELFT> *IS);
Rui Ueyama31f32fa2016-08-08 19:39:45 +000047
48template <class ELFT> uint32_t getMipsEFlags();
Simon Atanasyan85c6b442016-08-12 06:28:49 +000049
50uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
51 llvm::StringRef FileName);
Rui Ueyamaafff74e22015-08-05 23:24:46 +000052}
53}
Michael J. Spencer84487f12015-07-24 21:03:07 +000054
55#endif