llvm/lld/wasm/InputChunks.cpp

//===- InputChunks.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
//
//===----------------------------------------------------------------------===//

#include "InputChunks.h"
#include "Config.h"
#include "OutputSegment.h"
#include "WriterUtils.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/LLVM.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/xxhash.h"

#define DEBUG_TYPE

usingnamespacellvm;
usingnamespacellvm::wasm;
usingnamespacellvm::support::endian;

namespace lld {
StringRef relocTypeToString(uint8_t relocType) {}

bool relocIs64(uint8_t relocType) {}

std::string toString(const wasm::InputChunk *c) {}

namespace wasm {
StringRef InputChunk::getComdatName() const {}

uint32_t InputChunk::getSize() const {}

uint32_t InputChunk::getInputSize() const {}

// Copy this input chunk to an mmap'ed output file and apply relocations.
void InputChunk::writeTo(uint8_t *buf) const {}

void InputChunk::relocate(uint8_t *buf) const {}

// Copy relocation entries to a given output stream.
// This function is used only when a user passes "-r". For a regular link,
// we consume relocations instead of copying them to an output file.
void InputChunk::writeRelocations(raw_ostream &os) const {}

uint64_t InputChunk::getTombstone() const {}

void InputFunction::setFunctionIndex(uint32_t index) {}

void InputFunction::setTableIndex(uint32_t index) {}

// Write a relocation value without padding and return the number of bytes
// witten.
static unsigned writeCompressedReloc(uint8_t *buf, const WasmRelocation &rel,
                                     uint64_t value) {}

static unsigned getRelocWidthPadded(const WasmRelocation &rel) {}

static unsigned getRelocWidth(const WasmRelocation &rel, uint64_t value) {}

// Relocations of type LEB and SLEB in the code section are padded to 5 bytes
// so that a fast linker can blindly overwrite them without needing to worry
// about the number of bytes needed to encode the values.
// However, for optimal output the code section can be compressed to remove
// the padding then outputting non-relocatable files.
// In this case we need to perform a size calculation based on the value at each
// relocation.  At best we end up saving 4 bytes for each relocation entry.
//
// This function only computes the final output size.  It must be called
// before getSize() is used to calculate of layout of the code section.
void InputFunction::calculateSize() {}

// Override the default writeTo method so that we can (optionally) write the
// compressed version of the function.
void InputFunction::writeCompressed(uint8_t *buf) const {}

uint64_t InputChunk::getChunkOffset(uint64_t offset) const {}

uint64_t InputChunk::getOffset(uint64_t offset) const {}

uint64_t InputChunk::getVA(uint64_t offset) const {}

// Generate code to apply relocations to the data section at runtime.
// This is only called when generating shared libraries (PIC) where address are
// not known at static link time.
void InputChunk::generateRelocationCode(raw_ostream &os) const {}

// Split WASM_SEG_FLAG_STRINGS section. Such a section is a sequence of
// null-terminated strings.
void MergeInputChunk::splitStrings(ArrayRef<uint8_t> data) {}

// This function is called after we obtain a complete list of input sections
// that need to be linked. This is responsible to split section contents
// into small chunks for further processing.
//
// Note that this function is called from parallelForEach. This must be
// thread-safe (i.e. no memory allocation from the pools).
void MergeInputChunk::splitIntoPieces() {}

SectionPiece *MergeInputChunk::getSectionPiece(uint64_t offset) {}

// Returns the offset in an output section for a given input offset.
// Because contents of a mergeable section is not contiguous in output,
// it is not just an addition to a base output offset.
uint64_t MergeInputChunk::getParentOffset(uint64_t offset) const {}

void SyntheticMergedChunk::finalizeContents() {}

uint64_t InputSection::getTombstoneForSection(StringRef name) {}

} // namespace wasm
} // namespace lld