llvm/llvm/include/llvm/BinaryFormat/COFF.h

//===-- llvm/BinaryFormat/COFF.h --------------------------------*- C++ -*-===//
//
// 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 definitions used in Windows COFF Files.
//
// Structures and enums defined within this file where created using
// information from Microsoft's publicly available PE/COFF format document:
//
// Microsoft Portable Executable and Common Object File Format Specification
// Revision 8.1 - February 15, 2008
//
// As of 5/2/2010, hosted by Microsoft at:
// http://www.microsoft.com/whdc/system/platform/firmware/pecoff.mspx
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BINARYFORMAT_COFF_H
#define LLVM_BINARYFORMAT_COFF_H

#include "llvm/Support/DataTypes.h"
#include <cassert>

namespace llvm {
namespace COFF {

// The maximum number of sections that a COFF object can have (inclusive).
const int32_t MaxNumberOfSections16 =;

// The PE signature bytes that follows the DOS stub header.
static const char PEMagic[] =;

static const char BigObjMagic[] =;

static const char ClGlObjMagic[] =;

// The signature bytes that start a .res file.
static const char WinResMagic[] =;

// Sizes in bytes of various things in the COFF format.
enum {};

struct header {};

struct BigObjHeader {};

enum MachineTypes : unsigned {};

template <typename T> bool isArm64EC(T Machine) {}

template <typename T> bool isAnyArm64(T Machine) {}

template <typename T> bool is64Bit(T Machine) {}

enum Characteristics : unsigned {};

enum ResourceTypeID : unsigned {};

struct symbol {};

enum SymbolSectionNumber : int32_t {};

/// Storage class tells where and what the symbol represents
enum SymbolStorageClass {};

enum SymbolBaseType : unsigned {};

enum SymbolComplexType : unsigned {};

enum AuxSymbolType {};

struct section {};

enum SectionCharacteristics : uint32_t {};

struct relocation {};

enum RelocationTypeI386 : unsigned {};

enum RelocationTypeAMD64 : unsigned {};

enum RelocationTypesARM : unsigned {};

enum RelocationTypesARM64 : unsigned {};

enum DynamicRelocationType : unsigned {};

enum Arm64XFixupType : uint8_t {};

enum COMDATType : uint8_t {};

// Auxiliary Symbol Formats
struct AuxiliaryFunctionDefinition {};

struct AuxiliarybfAndefSymbol {};

struct AuxiliaryWeakExternal {};

enum WeakExternalCharacteristics : unsigned {};

struct AuxiliarySectionDefinition {};

struct AuxiliaryCLRToken {};

Auxiliary;

/// The Import Directory Table.
///
/// There is a single array of these and one entry per imported DLL.
struct ImportDirectoryTableEntry {};

/// The PE32 Import Lookup Table.
///
/// There is an array of these for each imported DLL. It represents either
/// the ordinal to import from the target DLL, or a name to lookup and import
/// from the target DLL.
///
/// This also happens to be the same format used by the Import Address Table
/// when it is initially written out to the image.
struct ImportLookupTableEntry32 {};

/// The DOS compatible header at the front of all PEs.
struct DOSHeader {};

struct PE32Header {};

struct DataDirectory {};

enum DataDirectoryIndex : unsigned {};

enum WindowsSubsystem : unsigned {};

enum DLLCharacteristics : unsigned {};

enum ExtendedDLLCharacteristics : unsigned {};

enum DebugType : unsigned {};

enum BaseRelocationType : unsigned {};

enum ImportType : unsigned {};

enum ImportNameType : unsigned {};

enum class GuardFlags : uint32_t {};

struct ImportHeader {};

enum CodeViewIdentifiers {};

// These flags show up in the @feat.00 symbol. They appear to be some kind of
// compiler features bitfield read by link.exe.
enum Feat00Flags : uint32_t {};

enum Arm64ECThunkType : uint8_t {};

inline bool isReservedSectionNumber(int32_t SectionNumber) {}

/// Encode section name based on string table offset.
/// The size of Out must be at least COFF::NameSize.
bool encodeSectionName(char *Out, uint64_t Offset);

} // End namespace COFF.
} // End namespace llvm.

#endif