llvm/llvm/lib/MC/WinCOFFObjectWriter.cpp

//===- llvm/MC/WinCOFFObjectWriter.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains an implementation of a Win32 COFF object file writer.
//
//===----------------------------------------------------------------------===//

#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 {};

// This class contains staging data for a COFF relocation entry.
struct COFFRelocation {};

relocations;

class COFFSection {};
} // namespace

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) {}

//------------------------------------------------------------------------------
// Symbol class implementation

// In the case that the name does not fit within 8 bytes, the offset
// into the string table is stored in the last 4 bytes instead, leaving
// the first 4 bytes as 0.
void COFFSymbol::set_name_offset(uint32_t Offset) {}

//------------------------------------------------------------------------------
// WinCOFFWriter class implementation

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) {}

/// This function takes a section data object from the assembler
/// and creates the associated COFF section staging object.
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) {}

/// This function takes a symbol data object from the assembler
/// and creates the associated COFF symbol staging object.
void WinCOFFWriter::defineSymbol(const MCAssembler &Asm,
                                 const MCSymbol &MCSym) {}

void WinCOFFWriter::SetSectionName(COFFSection &S) {}

void WinCOFFWriter::SetSymbolName(COFFSymbol &S) {}

bool WinCOFFWriter::IsPhysicalSection(COFFSection *S) {}

//------------------------------------------------------------------------------
// entity writing methods

void WinCOFFWriter::WriteFileHeader(const COFF::header &Header) {}

void WinCOFFWriter::WriteSymbol(const COFFSymbol &S) {}

void WinCOFFWriter::WriteAuxiliarySymbols(
    const COFFSymbol::AuxiliarySymbols &S) {}

// Write the section header.
void WinCOFFWriter::writeSectionHeaders() {}

void WinCOFFWriter::WriteRelocation(const COFF::relocation &R) {}

// Write MCSec's contents. What this function does is essentially
// "Asm.writeSectionData(&MCSec)", but it's a bit complicated
// because it needs to compute a CRC.
uint32_t WinCOFFWriter::writeSectionContents(MCAssembler &Asm,
                                             const MCSection &MCSec) {}

void WinCOFFWriter::writeSection(MCAssembler &Asm, const COFFSection &Sec) {}

// Create .file symbols.
void WinCOFFWriter::createFileSymbols(MCAssembler &Asm) {}

void WinCOFFWriter::setWeakDefaultNames() {}

static bool isAssociative(const COFFSection &Section) {}

void WinCOFFWriter::assignSectionNumbers() {}

// Assign file offsets to COFF object file structures.
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) {}

//------------------------------------------------------------------------------
// WinCOFFObjectWriter class implementation

////////////////////////////////////////////////////////////////////////////////
// MCObjectWriter interface implementations

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_)
    :{}

// Pin the vtable to this file.
void MCWinCOFFObjectTargetWriter::anchor() {}

//------------------------------------------------------------------------------
// WinCOFFObjectWriter factory function

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) {}