2015-08-14 14:12:54 +00:00
|
|
|
//===- Writer.h -------------------------------------------------*- C++ -*-===//
|
2015-07-24 21:03:07 +00:00
|
|
|
//
|
|
|
|
// The LLVM Linker
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_ELF_WRITER_H
|
|
|
|
#define LLD_ELF_WRITER_H
|
|
|
|
|
2016-12-19 21:21:07 +00:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2016-10-12 22:36:31 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2016-07-19 09:25:43 +00:00
|
|
|
#include <cstdint>
|
2016-07-12 08:50:42 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2015-07-24 21:03:07 +00:00
|
|
|
namespace lld {
|
2016-02-28 00:25:54 +00:00
|
|
|
namespace elf {
|
2016-11-05 22:58:01 +00:00
|
|
|
class InputFile;
|
2017-02-24 15:07:30 +00:00
|
|
|
class OutputSection;
|
2017-02-23 02:28:28 +00:00
|
|
|
class InputSectionBase;
|
2017-07-26 22:13:32 +00:00
|
|
|
template <class ELFT> class ObjFile;
|
2017-07-26 18:42:48 +00:00
|
|
|
class SymbolTable;
|
2016-08-09 03:38:23 +00:00
|
|
|
template <class ELFT> void writeResult();
|
2016-07-19 09:25:43 +00:00
|
|
|
|
|
|
|
// This describes a program header entry.
|
|
|
|
// Each contains type, access flags and range of output sections that will be
|
|
|
|
// placed in it.
|
2016-12-19 17:01:01 +00:00
|
|
|
struct PhdrEntry {
|
2017-05-26 02:17:13 +00:00
|
|
|
PhdrEntry(unsigned Type, unsigned Flags) : p_type(Type), p_flags(Flags) {}
|
2017-02-24 15:07:30 +00:00
|
|
|
void add(OutputSection *Sec);
|
2016-07-19 09:25:43 +00:00
|
|
|
|
2016-12-19 17:01:01 +00:00
|
|
|
uint64_t p_paddr = 0;
|
|
|
|
uint64_t p_vaddr = 0;
|
|
|
|
uint64_t p_memsz = 0;
|
|
|
|
uint64_t p_filesz = 0;
|
|
|
|
uint64_t p_offset = 0;
|
2017-03-07 15:51:09 +00:00
|
|
|
uint32_t p_align = 0;
|
2016-12-19 17:01:01 +00:00
|
|
|
uint32_t p_type = 0;
|
|
|
|
uint32_t p_flags = 0;
|
|
|
|
|
2017-09-07 11:01:10 +00:00
|
|
|
OutputSection *FirstSec = nullptr;
|
|
|
|
OutputSection *LastSec = nullptr;
|
2016-09-09 09:46:16 +00:00
|
|
|
bool HasLMA = false;
|
2018-01-29 03:44:44 +00:00
|
|
|
|
2018-01-25 19:02:08 +00:00
|
|
|
uint64_t LMAOffset = 0;
|
2016-07-19 09:25:43 +00:00
|
|
|
};
|
2016-07-12 08:50:42 +00:00
|
|
|
|
2017-12-23 17:21:39 +00:00
|
|
|
void addReservedSymbols();
|
2018-05-23 01:58:43 +00:00
|
|
|
llvm::StringRef getOutputSectionName(const InputSectionBase *S);
|
2016-07-12 08:50:42 +00:00
|
|
|
|
2017-10-02 14:56:41 +00:00
|
|
|
template <class ELFT> uint32_t calcMipsEFlags();
|
2016-08-12 06:28:49 +00:00
|
|
|
|
|
|
|
uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
|
|
|
|
llvm::StringRef FileName);
|
2016-11-05 22:58:01 +00:00
|
|
|
|
|
|
|
bool isMipsN32Abi(const InputFile *F);
|
2017-11-13 22:40:36 +00:00
|
|
|
bool isMicroMips();
|
2017-10-03 13:30:02 +00:00
|
|
|
bool isMipsR6();
|
2017-07-18 11:55:35 +00:00
|
|
|
} // namespace elf
|
|
|
|
} // namespace lld
|
2015-07-24 21:03:07 +00:00
|
|
|
|
|
|
|
#endif
|