#include "Writer.h"
#include "Config.h"
#include "InputChunks.h"
#include "InputElement.h"
#include "MapFile.h"
#include "OutputSections.h"
#include "OutputSegment.h"
#include "Relocations.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "WriterUtils.h"
#include "lld/Common/Arrays.h"
#include "lld/Common/CommonLinkerContext.h"
#include "lld/Common/Strings.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/BinaryFormat/WasmTraits.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/RandomNumberGenerator.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/xxhash.h"
#include <cstdarg>
#include <map>
#include <optional>
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacellvm::wasm;
namespace lld::wasm {
static constexpr int stackAlignment = …;
static constexpr int heapAlignment = …;
namespace {
class Writer { … };
}
void Writer::calculateCustomSections() { … }
void Writer::createCustomSections() { … }
void Writer::createRelocSections() { … }
void Writer::populateProducers() { … }
void Writer::writeHeader() { … }
void Writer::writeSections() { … }
static void
computeHash(llvm::MutableArrayRef<uint8_t> hashBuf,
llvm::ArrayRef<uint8_t> data,
std::function<void(uint8_t *dest, ArrayRef<uint8_t> arr)> hashFn) { … }
static void makeUUID(unsigned version, llvm::ArrayRef<uint8_t> fileHash,
llvm::MutableArrayRef<uint8_t> output) { … }
void Writer::writeBuildId() { … }
static void setGlobalPtr(DefinedGlobal *g, uint64_t memoryPtr) { … }
void Writer::layoutMemory() { … }
void Writer::addSection(OutputSection *sec) { … }
static void addStartStopSymbols(const OutputSegment *seg) { … }
void Writer::addSections() { … }
void Writer::finalizeSections() { … }
void Writer::populateTargetFeatures() { … }
void Writer::checkImportExportTargetFeatures() { … }
static bool shouldImport(Symbol *sym) { … }
void Writer::calculateImports() { … }
void Writer::calculateExports() { … }
void Writer::populateSymtab() { … }
void Writer::calculateTypes() { … }
void Writer::createCommandExportWrappers() { … }
static void finalizeIndirectFunctionTable() { … }
static void scanRelocations() { … }
void Writer::assignIndexes() { … }
static StringRef getOutputDataSegmentName(const InputChunk &seg) { … }
OutputSegment *Writer::createOutputSegment(StringRef name) { … }
void Writer::createOutputSegments() { … }
void Writer::combineOutputSegments() { … }
static void createFunction(DefinedFunction *func, StringRef bodyContent) { … }
bool Writer::needsPassiveInitialization(const OutputSegment *segment) { … }
bool Writer::hasPassiveInitializedSegments() { … }
void Writer::createSyntheticInitFunctions() { … }
void Writer::createInitMemoryFunction() { … }
void Writer::createStartFunction() { … }
void Writer::createApplyDataRelocationsFunction() { … }
void Writer::createApplyTLSRelocationsFunction() { … }
void Writer::createApplyGlobalRelocationsFunction() { … }
void Writer::createApplyGlobalTLSRelocationsFunction() { … }
void Writer::createCallCtorsFunction() { … }
void Writer::createCommandExportWrapper(uint32_t functionIndex,
DefinedFunction *f) { … }
void Writer::createInitTLSFunction() { … }
void Writer::calculateInitFunctions() { … }
void Writer::createSyntheticSections() { … }
void Writer::createSyntheticSectionsPostLayout() { … }
void Writer::run() { … }
void Writer::openFile() { … }
void Writer::createHeader() { … }
void writeResult() { … }
}