#ifndef LLD_WASM_CONFIG_H
#define LLD_WASM_CONFIG_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/Support/CachePruning.h"
#include <optional>
namespace llvm {
enum class CodeGenOptLevel;
}
namespace lld::wasm {
class InputFile;
class StubFile;
class ObjFile;
class SharedFile;
class BitcodeFile;
class InputTable;
class InputGlobal;
class InputFunction;
class Symbol;
enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic };
enum class BuildIdKind { None, Fast, Sha1, Hexstring, Uuid };
struct Configuration {
bool bsymbolic;
bool checkFeatures;
bool compressRelocations;
bool demangle;
bool disableVerify;
bool experimentalPic;
bool emitRelocs;
bool exportAll;
bool exportDynamic;
bool exportTable;
bool extendedConst;
bool growableTable;
bool gcSections;
llvm::StringSet<> keepSections;
std::optional<std::pair<llvm::StringRef, llvm::StringRef>> memoryImport;
std::optional<llvm::StringRef> memoryExport;
bool sharedMemory;
bool importTable;
bool importUndefined;
std::optional<bool> is64;
bool mergeDataSegments;
bool pie;
bool printGcSections;
bool relocatable;
bool saveTemps;
bool shared;
bool shlibSigCheck;
bool stripAll;
bool stripDebug;
bool stackFirst;
bool isStatic = true;
bool trace;
uint64_t globalBase;
uint64_t initialHeap;
uint64_t initialMemory;
uint64_t maxMemory;
bool noGrowableMemory;
uint64_t tableBase;
uint64_t zStackSize;
unsigned ltoPartitions;
unsigned ltoo;
llvm::CodeGenOptLevel ltoCgo;
unsigned optimize;
llvm::StringRef thinLTOJobs;
bool ltoDebugPassManager;
UnresolvedPolicy unresolvedSymbols;
BuildIdKind buildId = BuildIdKind::None;
llvm::StringRef entry;
llvm::StringRef mapFile;
llvm::StringRef outputFile;
llvm::StringRef soName;
llvm::StringRef thinLTOCacheDir;
llvm::StringRef whyExtract;
llvm::StringSet<> allowUndefinedSymbols;
llvm::StringSet<> exportedSymbols;
std::vector<llvm::StringRef> requiredExports;
llvm::SmallVector<llvm::StringRef, 0> searchPaths;
llvm::CachePruningPolicy thinLTOCachePolicy;
std::optional<std::vector<std::string>> features;
std::optional<std::vector<std::string>> extraFeatures;
llvm::SmallVector<uint8_t, 0> buildIdVector;
};
extern Configuration *config;
struct Ctx {
llvm::SmallVector<ObjFile *, 0> objectFiles;
llvm::SmallVector<StubFile *, 0> stubFiles;
llvm::SmallVector<SharedFile *, 0> sharedFiles;
llvm::SmallVector<BitcodeFile *, 0> bitcodeFiles;
llvm::SmallVector<InputFunction *, 0> syntheticFunctions;
llvm::SmallVector<InputGlobal *, 0> syntheticGlobals;
llvm::SmallVector<InputTable *, 0> syntheticTables;
bool isPic = false;
bool legacyFunctionTable = false;
bool emitBssSegments = false;
llvm::SmallVector<std::tuple<std::string, const InputFile *, const Symbol &>,
0>
whyExtractRecords;
void reset();
};
extern Ctx ctx;
}
#endif