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