]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - ELF/Writer.h
Vendor import of lld trunk r302418:
[FreeBSD/FreeBSD.git] / 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 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 OutputSection *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(OutputSection *Sec);
35
36   uint64_t p_paddr = 0;
37   uint64_t p_vaddr = 0;
38   uint64_t p_memsz = 0;
39   uint64_t p_filesz = 0;
40   uint64_t p_offset = 0;
41   uint32_t p_align = 0;
42   uint32_t p_type = 0;
43   uint32_t p_flags = 0;
44
45   OutputSection *First = nullptr;
46   OutputSection *Last = nullptr;
47   bool HasLMA = false;
48 };
49
50 llvm::StringRef getOutputSectionName(llvm::StringRef Name);
51
52 template <class ELFT> uint32_t getMipsEFlags();
53
54 uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
55                          llvm::StringRef FileName);
56
57 bool isMipsN32Abi(const InputFile *F);
58 }
59 }
60
61 #endif