]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/Writer.h
MFV r314910: 7843 get_clones_stat() is suboptimal for lots of clones
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / ELF / Writer.h
1 //===- Writer.h -------------------------------------------------*- C++ -*-===//
2 //
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
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
15 #include <cstdint>
16 #include <memory>
17
18 namespace lld {
19 namespace elf {
20 class InputFile;
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);
28
29 // This describes a program header entry.
30 // Each contains type, access flags and range of output sections that will be
31 // placed in it.
32 struct PhdrEntry {
33   PhdrEntry(unsigned Type, unsigned Flags);
34   void add(OutputSectionBase *Sec);
35
36   uint64_t p_paddr = 0;
37   uint64_t p_vaddr = 0;
38   uint64_t p_align = 0;
39   uint64_t p_memsz = 0;
40   uint64_t p_filesz = 0;
41   uint64_t p_offset = 0;
42   uint32_t p_type = 0;
43   uint32_t p_flags = 0;
44
45   OutputSectionBase *First = nullptr;
46   OutputSectionBase *Last = nullptr;
47   bool HasLMA = false;
48 };
49
50 llvm::StringRef getOutputSectionName(llvm::StringRef Name);
51
52 template <class ELFT>
53 void allocateHeaders(llvm::MutableArrayRef<PhdrEntry>,
54                      llvm::ArrayRef<OutputSectionBase *>);
55 template <class ELFT> void reportDiscarded(InputSectionBase<ELFT> *IS);
56
57 template <class ELFT> uint32_t getMipsEFlags();
58
59 uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
60                          llvm::StringRef FileName);
61
62 bool isMipsN32Abi(const InputFile *F);
63 }
64 }
65
66 #endif