[PATCH] D45001: [WebAssembly] Error if both --export-table and --import-table are specified.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 30 09:09:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD328873: [WebAssembly] Error if both --export-table and --import-table are specified. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45001?vs=140136&id=140443#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45001

Files:
  test/wasm/driver.ll
  wasm/Driver.cpp


Index: test/wasm/driver.ll
===================================================================
--- test/wasm/driver.ll
+++ test/wasm/driver.ll
@@ -16,3 +16,7 @@
 ; RUN: not wasm-ld 2>&1 | FileCheck -check-prefix=BOTH %s
 ; BOTH:     error: no input files
 ; BOTH-NOT: error: no output file specified
+
+; RUN: not wasm-ld --export-table --import-table %t.o 2>&1 \
+; RUN:   | FileCheck -check-prefix=TABLE %s
+; TABLE: error: --import-table and --export-table may not be used together
Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -286,7 +286,9 @@
       Args.hasFlag(OPT_check_signatures, OPT_no_check_signatures, false);
   Config->Demangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, true);
   Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start");
+  Config->ExportTable = Args.hasArg(OPT_export_table);
   Config->ImportMemory = Args.hasArg(OPT_import_memory);
+  Config->ImportTable = Args.hasArg(OPT_import_table);
   Config->OutputFile = Args.getLastArgValue(OPT_o);
   Config->Relocatable = Args.hasArg(OPT_relocatable);
   Config->GcSections =
@@ -296,11 +298,6 @@
   Config->SearchPaths = args::getStrings(Args, OPT_L);
   Config->StripAll = Args.hasArg(OPT_strip_all);
   Config->StripDebug = Args.hasArg(OPT_strip_debug);
-  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);
 
@@ -321,6 +318,9 @@
   if (Config->OutputFile.empty())
     error("no output file specified");
 
+  if (Config->ImportTable && Config->ExportTable)
+    error("--import-table and --export-table may not be used together");
+
   if (Config->Relocatable) {
     if (!Config->Entry.empty())
       error("entry point specified for relocatable output file");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45001.140443.patch
Type: text/x-patch
Size: 2090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180330/43f53bc8/attachment.bin>


More information about the llvm-commits mailing list