llvm/lld/COFF/DLL.cpp

//===- DLL.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 defines various types of chunks for the DLL import or export
// descriptor tables. They are inherently Windows-specific.
// You need to read Microsoft PE/COFF spec to understand details
// about the data structures.
//
// If you are not particularly interested in linking against Windows
// DLL, you can skip this file, and you should still be able to
// understand the rest of the linker.
//
//===----------------------------------------------------------------------===//

#include "DLL.h"
#include "COFFLinkerContext.h"
#include "Chunks.h"
#include "SymbolTable.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Path.h"

usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::support::endian;
usingnamespacellvm::COFF;

namespace lld::coff {
namespace {

// Import table

// A chunk for the import descriptor table.
class HintNameChunk : public NonSectionChunk {};

// A chunk for the import descriptor table.
class LookupChunk : public NonSectionChunk {};

// A chunk for the import descriptor table.
// This chunk represent import-by-ordinal symbols.
// See Microsoft PE/COFF spec 7.1. Import Header for details.
class OrdinalOnlyChunk : public NonSectionChunk {};

// A chunk for the import descriptor table.
class ImportDirectoryChunk : public NonSectionChunk {};

// A chunk representing null terminator in the import table.
// Contents of this chunk is always null bytes.
class NullChunk : public NonSectionChunk {};

// A chunk for ARM64EC auxiliary IAT.
class AuxImportChunk : public NonSectionChunk {};

static std::vector<std::vector<DefinedImportData *>>
binImports(COFFLinkerContext &ctx,
           const std::vector<DefinedImportData *> &imports) {}

// See Microsoft PE/COFF spec 4.3 for details.

// A chunk for the delay import descriptor table etnry.
class DelayDirectoryChunk : public NonSectionChunk {};

// Initial contents for delay-loaded functions.
// This code calls __delayLoadHelper2 function to resolve a symbol
// which then overwrites its jump table slot with the result
// for subsequent function calls.
static const uint8_t thunkX64[] =;

static const uint8_t tailMergeX64[] =;

static const uint8_t tailMergeUnwindInfoX64[] =;

static const uint8_t thunkX86[] =;

static const uint8_t tailMergeX86[] =;

static const uint8_t thunkARM[] =;

static const uint8_t tailMergeARM[] =;

static const uint8_t thunkARM64[] =;

static const uint8_t tailMergeARM64[] =;

// A chunk for the delay import thunk.
class ThunkChunkX64 : public NonSectionCodeChunk {};

class TailMergeChunkX64 : public NonSectionCodeChunk {};

class TailMergePDataChunkX64 : public NonSectionChunk {};

class TailMergeUnwindInfoX64 : public NonSectionChunk {};

class ThunkChunkX86 : public NonSectionCodeChunk {};

class TailMergeChunkX86 : public NonSectionCodeChunk {};

class ThunkChunkARM : public NonSectionCodeChunk {};

class TailMergeChunkARM : public NonSectionCodeChunk {};

class ThunkChunkARM64 : public NonSectionCodeChunk {};

class TailMergeChunkARM64 : public NonSectionCodeChunk {};

// A chunk for the import descriptor table.
class DelayAddressChunk : public NonSectionChunk {};

// Export table
// Read Microsoft PE/COFF spec 5.3 for details.

// A chunk for the export descriptor table.
class ExportDirectoryChunk : public NonSectionChunk {};

class AddressTableChunk : public NonSectionChunk {};

class NamePointersChunk : public NonSectionChunk {};

class ExportOrdinalChunk : public NonSectionChunk {};

} // anonymous namespace

void IdataContents::create(COFFLinkerContext &ctx) {}

std::vector<Chunk *> DelayLoadContents::getChunks() {}

std::vector<Chunk *> DelayLoadContents::getDataChunks() {}

uint64_t DelayLoadContents::getDirSize() {}

void DelayLoadContents::create(Defined *h) {}

Chunk *DelayLoadContents::newTailMergeChunk(Chunk *dir) {}

Chunk *DelayLoadContents::newTailMergeUnwindInfoChunk() {}
Chunk *DelayLoadContents::newTailMergePDataChunk(Chunk *tm, Chunk *unwind) {}

Chunk *DelayLoadContents::newThunkChunk(DefinedImportData *s,
                                        Chunk *tailMerge) {}

EdataContents::EdataContents(COFFLinkerContext &ctx) :{}

} // namespace lld::coff