2015-12-30 11:57:38 +00:00
|
|
|
//===- Writer.h -------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2017-01-02 19:19:15 +00:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
#include <cstdint>
|
2016-07-23 20:48:50 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace elf {
|
2017-01-02 19:19:15 +00:00
|
|
|
class InputFile;
|
2017-04-16 16:03:39 +00:00
|
|
|
class OutputSection;
|
|
|
|
class InputSectionBase;
|
2016-07-23 20:48:50 +00:00
|
|
|
template <class ELFT> class ObjectFile;
|
2015-12-30 11:57:38 +00:00
|
|
|
template <class ELFT> class SymbolTable;
|
2017-01-02 19:19:15 +00:00
|
|
|
template <class ELFT> void writeResult();
|
|
|
|
template <class ELFT> void markLive();
|
2017-04-16 16:03:39 +00:00
|
|
|
template <class ELFT> bool isRelroSection(const OutputSection *Sec);
|
2015-12-30 11:57:38 +00:00
|
|
|
|
2017-01-02 19:19:15 +00:00
|
|
|
// This describes a program header entry.
|
|
|
|
// Each contains type, access flags and range of output sections that will be
|
|
|
|
// placed in it.
|
|
|
|
struct PhdrEntry {
|
|
|
|
PhdrEntry(unsigned Type, unsigned Flags);
|
2017-04-16 16:03:39 +00:00
|
|
|
void add(OutputSection *Sec);
|
2015-12-30 11:57:38 +00:00
|
|
|
|
2017-01-02 19:19:15 +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-04-16 16:03:39 +00:00
|
|
|
uint32_t p_align = 0;
|
2017-01-02 19:19:15 +00:00
|
|
|
uint32_t p_type = 0;
|
|
|
|
uint32_t p_flags = 0;
|
2016-07-23 20:48:50 +00:00
|
|
|
|
2017-04-16 16:03:39 +00:00
|
|
|
OutputSection *First = nullptr;
|
|
|
|
OutputSection *Last = nullptr;
|
2017-01-02 19:19:15 +00:00
|
|
|
bool HasLMA = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
llvm::StringRef getOutputSectionName(llvm::StringRef Name);
|
2016-07-23 20:48:50 +00:00
|
|
|
|
2017-01-02 19:19:15 +00:00
|
|
|
template <class ELFT> uint32_t getMipsEFlags();
|
|
|
|
|
|
|
|
uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
|
|
|
|
llvm::StringRef FileName);
|
|
|
|
|
|
|
|
bool isMipsN32Abi(const InputFile *F);
|
2015-12-30 11:57:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|