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
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/StringRef.h"
21 class InputSectionBase;
22 template <class ELFT> void writeResult();
24 // This describes a program header entry.
25 // Each contains type, access flags and range of output sections that will be
28 PhdrEntry(unsigned type, unsigned flags) : p_type(type), p_flags(flags) {}
29 void add(OutputSection *sec);
34 uint64_t p_filesz = 0;
35 uint64_t p_offset = 0;
40 OutputSection *firstSec = nullptr;
41 OutputSection *lastSec = nullptr;
44 uint64_t lmaOffset = 0;
47 void addReservedSymbols();
48 llvm::StringRef getOutputSectionName(const InputSectionBase *s);
50 template <class ELFT> uint32_t calcMipsEFlags();
52 uint8_t getMipsFpAbiFlag(uint8_t oldFlag, uint8_t newFlag,
53 llvm::StringRef fileName);
55 bool isMipsN32Abi(const InputFile *f);