]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/Writer.h
Merge ^/head r327150 through r327164.
[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 OutputSection;
22 class InputSectionBase;
23 template <class ELFT> class ObjFile;
24 class SymbolTable;
25 template <class ELFT> void writeResult();
26 template <class ELFT> void markLive();
27
28 // This describes a program header entry.
29 // Each contains type, access flags and range of output sections that will be
30 // placed in it.
31 struct PhdrEntry {
32   PhdrEntry(unsigned Type, unsigned Flags) : p_type(Type), p_flags(Flags) {}
33   void add(OutputSection *Sec);
34
35   uint64_t p_paddr = 0;
36   uint64_t p_vaddr = 0;
37   uint64_t p_memsz = 0;
38   uint64_t p_filesz = 0;
39   uint64_t p_offset = 0;
40   uint32_t p_align = 0;
41   uint32_t p_type = 0;
42   uint32_t p_flags = 0;
43
44   OutputSection *FirstSec = nullptr;
45   OutputSection *LastSec = nullptr;
46   bool HasLMA = false;
47 };
48
49 void addReservedSymbols();
50 llvm::StringRef getOutputSectionName(InputSectionBase *S);
51
52 template <class ELFT> uint32_t calcMipsEFlags();
53
54 uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
55                          llvm::StringRef FileName);
56
57 bool isMipsN32Abi(const InputFile *F);
58 bool isMicroMips();
59 bool isMipsR6();
60 } // namespace elf
61 } // namespace lld
62
63 #endif