mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
[WebAssembly] Name Config members after commandline argument. NFC
This addresses a late review comment from D44427/rLLD328643 llvm-svn: 328700
This commit is contained in:
parent
202f809437
commit
fc90b30dc2
@ -17,19 +17,18 @@
|
||||
namespace lld {
|
||||
namespace wasm {
|
||||
|
||||
enum class ExposeAs { IMPORT, EXPORT, NONE };
|
||||
|
||||
struct Configuration {
|
||||
bool AllowUndefined;
|
||||
bool CheckSignatures;
|
||||
bool Demangle;
|
||||
bool ExportTable;
|
||||
bool GcSections;
|
||||
bool ImportMemory;
|
||||
bool ImportTable;
|
||||
bool PrintGcSections;
|
||||
bool Relocatable;
|
||||
bool StripAll;
|
||||
bool StripDebug;
|
||||
ExposeAs Table;
|
||||
uint32_t GlobalBase;
|
||||
uint32_t InitialMemory;
|
||||
uint32_t MaxMemory;
|
||||
|
@ -216,15 +216,6 @@ static StringRef getEntry(opt::InputArgList &Args, StringRef Default) {
|
||||
return Arg->getValue();
|
||||
}
|
||||
|
||||
static ExposeAs getExpose(opt::InputArgList &Args, unsigned Import,
|
||||
unsigned Export) {
|
||||
auto *Arg = Args.getLastArg(Import, Export);
|
||||
if (!Arg)
|
||||
return ExposeAs::NONE;
|
||||
return Arg->getOption().getID() == Import ? ExposeAs::IMPORT
|
||||
: ExposeAs::EXPORT;
|
||||
}
|
||||
|
||||
static const uint8_t UnreachableFn[] = {
|
||||
0x03 /* ULEB length */, 0x00 /* ULEB num locals */,
|
||||
0x00 /* opcode unreachable */, 0x0b /* opcode end */
|
||||
@ -305,7 +296,11 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
||||
Config->SearchPaths = args::getStrings(Args, OPT_L);
|
||||
Config->StripAll = Args.hasArg(OPT_strip_all);
|
||||
Config->StripDebug = Args.hasArg(OPT_strip_debug);
|
||||
Config->Table = getExpose(Args, OPT_import_table, OPT_export_table);
|
||||
auto *TableArg = Args.getLastArg(OPT_import_table, OPT_export_table);
|
||||
Config->ImportTable =
|
||||
TableArg && TableArg->getOption().getID() == OPT_import_table;
|
||||
Config->ExportTable =
|
||||
TableArg && TableArg->getOption().getID() == OPT_export_table;
|
||||
errorHandler().Verbose = Args.hasArg(OPT_verbose);
|
||||
ThreadsEnabled = Args.hasFlag(OPT_threads, OPT_no_threads, true);
|
||||
|
||||
|
@ -127,7 +127,7 @@ void Writer::createImportSection() {
|
||||
uint32_t NumImports = ImportedSymbols.size();
|
||||
if (Config->ImportMemory)
|
||||
++NumImports;
|
||||
if (Config->Table == ExposeAs::IMPORT)
|
||||
if (Config->ImportTable)
|
||||
++NumImports;
|
||||
|
||||
if (NumImports == 0)
|
||||
@ -152,7 +152,7 @@ void Writer::createImportSection() {
|
||||
writeImport(OS, Import);
|
||||
}
|
||||
|
||||
if (Config->Table == ExposeAs::IMPORT) {
|
||||
if (Config->ImportTable) {
|
||||
uint32_t TableSize = kInitialTableOffset + IndirectFunctions.size();
|
||||
WasmImport Import;
|
||||
Import.Module = "env";
|
||||
@ -236,7 +236,7 @@ void Writer::createGlobalSection() {
|
||||
}
|
||||
|
||||
void Writer::createTableSection() {
|
||||
if (Config->Table == ExposeAs::IMPORT)
|
||||
if (Config->ImportTable)
|
||||
return;
|
||||
|
||||
// Always output a table section (or table import), even if there are no
|
||||
@ -259,7 +259,7 @@ void Writer::createTableSection() {
|
||||
|
||||
void Writer::createExportSection() {
|
||||
bool ExportMemory = !Config->Relocatable && !Config->ImportMemory;
|
||||
bool ExportTable = !Config->Relocatable && Config->Table == ExposeAs::EXPORT;
|
||||
bool ExportTable = !Config->Relocatable && Config->ExportTable;
|
||||
|
||||
uint32_t NumExports =
|
||||
(ExportMemory ? 1 : 0) + (ExportTable ? 1 : 0) + ExportedSymbols.size();
|
||||
|
Loading…
Reference in New Issue
Block a user