#include "Driver.h"
#include "COFFLinkerContext.h"
#include "Config.h"
#include "DebugTypes.h"
#include "ICF.h"
#include "InputFiles.h"
#include "MarkLive.h"
#include "MinGW.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "Writer.h"
#include "lld/Common/Args.h"
#include "lld/Common/CommonLinkerContext.h"
#include "lld/Common/Driver.h"
#include "lld/Common/Filesystem.h"
#include "lld/Common/Timer.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/COFFModuleDefinition.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.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/Support/TimeProfiler.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
#include <algorithm>
#include <future>
#include <memory>
#include <optional>
#include <tuple>
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::COFF;
usingnamespacellvm::sys;
namespace lld::coff {
bool link(ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput) { … }
static std::pair<StringRef, StringRef> getOldNewOptions(opt::InputArgList &args,
unsigned id) { … }
static std::tuple<StringRef, StringRef, StringRef>
getOldNewOptionsExtra(opt::InputArgList &args, unsigned id) { … }
static std::string getOutputPath(StringRef path, bool isDll, bool isDriver) { … }
static bool isCrtend(StringRef s) { … }
MBErrPair;
static std::future<MBErrPair> createFutureForFile(std::string path) { … }
StringRef LinkerDriver::mangle(StringRef sym) { … }
llvm::Triple::ArchType LinkerDriver::getArch() { … }
bool LinkerDriver::findUnderscoreMangle(StringRef sym) { … }
MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> mb) { … }
void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
bool wholeArchive, bool lazy) { … }
void LinkerDriver::enqueuePath(StringRef path, bool wholeArchive, bool lazy) { … }
void LinkerDriver::addArchiveBuffer(MemoryBufferRef mb, StringRef symName,
StringRef parentName,
uint64_t offsetInArchive) { … }
void LinkerDriver::enqueueArchiveMember(const Archive::Child &c,
const Archive::Symbol &sym,
StringRef parentName) { … }
bool LinkerDriver::isDecorated(StringRef sym) { … }
void LinkerDriver::parseDirectives(InputFile *file) { … }
StringRef LinkerDriver::findFile(StringRef filename) { … }
static std::optional<sys::fs::UniqueID> getUniqueID(StringRef path) { … }
std::optional<StringRef> LinkerDriver::findFileIfNew(StringRef filename) { … }
StringRef LinkerDriver::findLibMinGW(StringRef filename) { … }
StringRef LinkerDriver::findLib(StringRef filename) { … }
std::optional<StringRef> LinkerDriver::findLibIfNew(StringRef filename) { … }
void LinkerDriver::detectWinSysRoot(const opt::InputArgList &Args) { … }
void LinkerDriver::addClangLibSearchPaths(const std::string &argv0) { … }
void LinkerDriver::addWinSysRootLibSearchPaths() { … }
void LinkerDriver::addLibSearchPaths() { … }
Symbol *LinkerDriver::addUndefined(StringRef name) { … }
StringRef LinkerDriver::mangleMaybe(Symbol *s) { … }
StringRef LinkerDriver::findDefaultEntry() { … }
WindowsSubsystem LinkerDriver::inferSubsystem() { … }
uint64_t LinkerDriver::getDefaultImageBase() { … }
static std::string rewritePath(StringRef s) { … }
static std::string createResponseFile(const opt::InputArgList &args,
ArrayRef<StringRef> filePaths,
ArrayRef<StringRef> searchPaths) { … }
static unsigned parseDebugTypes(const opt::InputArgList &args) { … }
std::string LinkerDriver::getMapFile(const opt::InputArgList &args,
opt::OptSpecifier os,
opt::OptSpecifier osFile) { … }
std::string LinkerDriver::getImplibPath() { … }
std::string LinkerDriver::getImportName(bool asLib) { … }
void LinkerDriver::createImportLibrary(bool asLib) { … }
void LinkerDriver::parseModuleDefs(StringRef path) { … }
void LinkerDriver::enqueueTask(std::function<void()> task) { … }
bool LinkerDriver::run() { … }
void LinkerDriver::parseOrderFile(StringRef arg) { … }
void LinkerDriver::parseCallGraphFile(StringRef path) { … }
static void readCallGraphsFromObjectFiles(COFFLinkerContext &ctx) { … }
static void markAddrsig(Symbol *s) { … }
static void findKeepUniqueSections(COFFLinkerContext &ctx) { … }
void LinkerDriver::parsePDBAltPath() { … }
void LinkerDriver::convertResources() { … }
void LinkerDriver::maybeCreateECExportThunk(StringRef name, Symbol *&sym) { … }
void LinkerDriver::createECExportThunks() { … }
void LinkerDriver::maybeExportMinGWSymbols(const opt::InputArgList &args) { … }
std::optional<std::string> getReproduceFile(const opt::InputArgList &args) { … }
static std::unique_ptr<llvm::vfs::FileSystem>
getVFS(const opt::InputArgList &args) { … }
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) { … }
}