1 //===- Writer.h -------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_ELF_WRITER_H
10 #define LLD_ELF_WRITER_H
13 #include "llvm/ADT/StringRef.h"
19 void copySectionsIntoPartitions();
20 template <class ELFT
> void createSyntheticSections();
21 template <class ELFT
> void writeResult();
23 // This describes a program header entry.
24 // Each contains type, access flags and range of output sections that will be
27 PhdrEntry(unsigned type
, unsigned flags
)
28 : p_align(type
== llvm::ELF::PT_LOAD
? config
->maxPageSize
: 0),
29 p_type(type
), p_flags(flags
) {}
30 void add(OutputSection
*sec
);
35 uint64_t p_filesz
= 0;
36 uint64_t p_offset
= 0;
41 OutputSection
*firstSec
= nullptr;
42 OutputSection
*lastSec
= nullptr;
45 uint64_t lmaOffset
= 0;
48 void addReservedSymbols();
49 bool includeInSymtab(const Symbol
&b
);
51 template <class ELFT
> uint32_t calcMipsEFlags();
53 uint8_t getMipsFpAbiFlag(uint8_t oldFlag
, uint8_t newFlag
,
54 llvm::StringRef fileName
);
56 bool isMipsN32Abi(const InputFile
*f
);
60 bool canHaveMemtagGlobals();
61 } // namespace lld::elf