#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFragment.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolCOFF.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/MCWinCOFFObjectWriter.h"
#include "llvm/MC/StringTableBuilder.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <memory>
#include <string>
#include <vector>
usingnamespacellvm;
write32le;
#define DEBUG_TYPE …
namespace {
constexpr int OffsetLabelIntervalBits = …;
name;
enum AuxiliaryType { … };
struct AuxSymbol { … };
class COFFSection;
class COFFSymbol { … };
struct COFFRelocation { … };
relocations;
class COFFSection { … };
}
class llvm::WinCOFFWriter { … };
WinCOFFObjectWriter::WinCOFFObjectWriter(
std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW, raw_pwrite_stream &OS)
: … { … }
WinCOFFObjectWriter::WinCOFFObjectWriter(
std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW, raw_pwrite_stream &OS,
raw_pwrite_stream &DwoOS)
: … { … }
static bool isDwoSection(const MCSection &Sec) { … }
void COFFSymbol::set_name_offset(uint32_t Offset) { … }
WinCOFFWriter::WinCOFFWriter(WinCOFFObjectWriter &OWriter,
raw_pwrite_stream &OS, DwoMode Mode)
: … { … }
COFFSymbol *WinCOFFWriter::createSymbol(StringRef Name) { … }
COFFSymbol *WinCOFFWriter::GetOrCreateCOFFSymbol(const MCSymbol *Symbol) { … }
COFFSection *WinCOFFWriter::createSection(StringRef Name) { … }
static uint32_t getAlignment(const MCSectionCOFF &Sec) { … }
void WinCOFFWriter::defineSection(const MCAssembler &Asm,
const MCSectionCOFF &MCSec) { … }
static uint64_t getSymbolValue(const MCSymbol &Symbol, const MCAssembler &Asm) { … }
COFFSymbol *WinCOFFWriter::getLinkedSymbol(const MCSymbol &Symbol) { … }
void WinCOFFWriter::defineSymbol(const MCAssembler &Asm,
const MCSymbol &MCSym) { … }
void WinCOFFWriter::SetSectionName(COFFSection &S) { … }
void WinCOFFWriter::SetSymbolName(COFFSymbol &S) { … }
bool WinCOFFWriter::IsPhysicalSection(COFFSection *S) { … }
void WinCOFFWriter::WriteFileHeader(const COFF::header &Header) { … }
void WinCOFFWriter::WriteSymbol(const COFFSymbol &S) { … }
void WinCOFFWriter::WriteAuxiliarySymbols(
const COFFSymbol::AuxiliarySymbols &S) { … }
void WinCOFFWriter::writeSectionHeaders() { … }
void WinCOFFWriter::WriteRelocation(const COFF::relocation &R) { … }
uint32_t WinCOFFWriter::writeSectionContents(MCAssembler &Asm,
const MCSection &MCSec) { … }
void WinCOFFWriter::writeSection(MCAssembler &Asm, const COFFSection &Sec) { … }
void WinCOFFWriter::createFileSymbols(MCAssembler &Asm) { … }
void WinCOFFWriter::setWeakDefaultNames() { … }
static bool isAssociative(const COFFSection &Section) { … }
void WinCOFFWriter::assignSectionNumbers() { … }
void WinCOFFWriter::assignFileOffsets(MCAssembler &Asm) { … }
void WinCOFFWriter::reset() { … }
void WinCOFFWriter::executePostLayoutBinding(MCAssembler &Asm) { … }
void WinCOFFWriter::recordRelocation(MCAssembler &Asm,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) { … }
static std::time_t getTime() { … }
uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) { … }
void WinCOFFObjectWriter::reset() { … }
bool WinCOFFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
bool InSet, bool IsPCRel) const { … }
void WinCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm) { … }
void WinCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) { … }
uint64_t WinCOFFObjectWriter::writeObject(MCAssembler &Asm) { … }
MCWinCOFFObjectTargetWriter::MCWinCOFFObjectTargetWriter(unsigned Machine_)
: … { … }
void MCWinCOFFObjectTargetWriter::anchor() { … }
std::unique_ptr<MCObjectWriter> llvm::createWinCOFFObjectWriter(
std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW, raw_pwrite_stream &OS) { … }
std::unique_ptr<MCObjectWriter> llvm::createWinCOFFDwoObjectWriter(
std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW, raw_pwrite_stream &OS,
raw_pwrite_stream &DwoOS) { … }