#include "lld/Common/Driver.h"
#include "Config.h"
#include "InputChunks.h"
#include "InputElement.h"
#include "MarkLive.h"
#include "SymbolTable.h"
#include "Writer.h"
#include "lld/Common/Args.h"
#include "lld/Common/CommonLinkerContext.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Filesystem.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Reproduce.h"
#include "lld/Common/Strings.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Object/Wasm.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/TarWriter.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/TargetParser/Host.h"
#include <optional>
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::opt;
usingnamespacellvm::sys;
usingnamespacellvm::wasm;
namespace lld::wasm {
Configuration *config;
Ctx ctx;
void errorOrWarn(const llvm::Twine &msg) { … }
void Ctx::reset() { … }
namespace {
enum { … };
static void initLLVM() { … }
class LinkerDriver { … };
static bool hasZOption(opt::InputArgList &args, StringRef key) { … }
}
bool link(ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput) { … }
#define PREFIX …
#include "Options.inc"
#undef PREFIX
static constexpr opt::OptTable::Info optInfo[] = …;
namespace {
class WasmOptTable : public opt::GenericOptTable { … };
}
static void handleColorDiagnostics(opt::InputArgList &args) { … }
static cl::TokenizerCallback getQuotingStyle(opt::InputArgList &args) { … }
static std::optional<std::string> findFile(StringRef path1,
const Twine &path2) { … }
opt::InputArgList WasmOptTable::parse(ArrayRef<const char *> argv) { … }
static void readImportFile(StringRef filename) { … }
std::vector<std::pair<MemoryBufferRef, uint64_t>> static getArchiveMembers(
MemoryBufferRef mb) { … }
void LinkerDriver::addFile(StringRef path) { … }
static std::optional<std::string> findFromSearchPaths(StringRef path) { … }
static std::optional<std::string> searchLibraryBaseName(StringRef name) { … }
static std::optional<std::string> searchLibrary(StringRef name) { … }
void LinkerDriver::addLibrary(StringRef name) { … }
void LinkerDriver::createFiles(opt::InputArgList &args) { … }
static StringRef getEntry(opt::InputArgList &args) { … }
static UnresolvedPolicy getUnresolvedSymbolPolicy(opt::InputArgList &args) { … }
static std::pair<BuildIdKind, SmallVector<uint8_t, 0>>
getBuildId(opt::InputArgList &args) { … }
static void readConfigs(opt::InputArgList &args) { … }
static void setConfigs() { … }
static void checkOptions(opt::InputArgList &args) { … }
static const char *getReproduceOption(opt::InputArgList &args) { … }
static Symbol *handleUndefined(StringRef name, const char *option) { … }
static void handleLibcall(StringRef name) { … }
static void writeWhyExtract() { … }
static void demoteLazySymbols() { … }
static UndefinedGlobal *
createUndefinedGlobal(StringRef name, llvm::wasm::WasmGlobalType *type) { … }
static InputGlobal *createGlobal(StringRef name, bool isMutable) { … }
static GlobalSymbol *createGlobalVariable(StringRef name, bool isMutable) { … }
static GlobalSymbol *createOptionalGlobal(StringRef name, bool isMutable) { … }
static void createSyntheticSymbols() { … }
static void createOptionalSymbols() { … }
static void processStubLibrariesPreLTO() { … }
static bool addStubSymbolDeps(const StubFile *stub_file, Symbol *sym,
ArrayRef<StringRef> deps) { … }
static void processStubLibraries() { … }
static std::string createResponseFile(const opt::InputArgList &args) { … }
struct WrappedSymbol { … };
static Symbol *addUndefined(StringRef name) { … }
static std::vector<WrappedSymbol> addWrappedSymbols(opt::InputArgList &args) { … }
static void wrapSymbols(ArrayRef<WrappedSymbol> wrapped) { … }
static void splitSections() { … }
static bool isKnownZFlag(StringRef s) { … }
static void checkZOptions(opt::InputArgList &args) { … }
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) { … }
}