[PATCH] D107253: [LLD] [MinGW] Support both "--opt value" and "--opt=value" for more options

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 00:56:17 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb7fb5b54a930: [LLD] [MinGW] Support both "--opt value" and "--opt=value" for more options (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107253/new/

https://reviews.llvm.org/D107253

Files:
  lld/MinGW/Options.td
  lld/test/MinGW/driver.test


Index: lld/test/MinGW/driver.test
===================================================================
--- lld/test/MinGW/driver.test
+++ lld/test/MinGW/driver.test
@@ -161,6 +161,7 @@
 
 RUN: ld.lld -### -m i386pep foo.o --image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
 RUN: ld.lld -### -m i386pep foo.o -image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
+RUN: ld.lld -### -m i386pep foo.o --image-base=0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
 IMAGE-BASE: -base:0x1230000
 
 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-GC-SECTIONS %s
@@ -180,6 +181,7 @@
 
 RUN: ld.lld -### -m i386pep foo.o --icf=all 2>&1 | FileCheck -check-prefix ICF %s
 RUN: ld.lld -### -m i386pep foo.o -icf=all 2>&1 | FileCheck -check-prefix ICF %s
+RUN: ld.lld -### -m i386pep foo.o --icf all 2>&1 | FileCheck -check-prefix ICF %s
 ICF: -opt:icf
 
 RUN: ld.lld -### -m i386pep --start-group foo.o --end-group 2> /dev/null
Index: lld/MinGW/Options.td
===================================================================
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -16,6 +16,11 @@
     HelpText<help>;
 }
 
+multiclass EqNoHelp<string name> {
+  def NAME: Separate<["--", "-"], name>;
+  def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
+}
+
 multiclass B<string name, string help1, string help2> {
   def NAME: Flag<["--", "-"], name>, HelpText<help1>;
   def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
@@ -57,8 +62,8 @@
     "Remove unused sections",
     "Don't remove unused sections">;
 def help: F<"help">, HelpText<"Print option help">;
-def icf: J<"icf=">, HelpText<"Identical code folding">;
-def image_base: S<"image-base">, HelpText<"Base address of the program">;
+defm icf: Eq<"icf", "Identical code folding">;
+defm image_base: Eq<"image-base", "Base address of the program">;
 defm insert_timestamp: B<"insert-timestamp",
     "Include PE header timestamp",
     "Don't include PE header timestamp">;
@@ -109,12 +114,11 @@
     HelpText<"Print (but do not run) the commands to run for this compilation">;
 def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
 defm delayload: Eq<"delayload", "DLL to load only on demand">;
-def mllvm: S<"mllvm">;
+defm mllvm: EqNoHelp<"mllvm">;
 defm pdb: Eq<"pdb", "Output PDB debug info file, chosen implicitly if the argument is empty">;
 defm thinlto_cache_dir: EqLong<"thinlto-cache-dir",
   "Path to ThinLTO cached object file directory">;
-def Xlink : J<"Xlink=">, MetaVarName<"<arg>">,
-    HelpText<"Pass <arg> to the COFF linker">;
+defm Xlink : Eq<"Xlink", "Pass <arg> to the COFF linker">, MetaVarName<"<arg>">;
 
 // Alias
 def alias_Bdynamic_call_shared: Flag<["-"], "call_shared">, Alias<Bdynamic>;
@@ -135,15 +139,13 @@
 def: F<"end-group">;
 def: Flag<["--"], "full-shutdown">;
 def: F<"high-entropy-va">;
-def: S<"major-image-version">;
-def: S<"minor-image-version">;
+defm: EqNoHelp<"major-image-version">;
+defm: EqNoHelp<"minor-image-version">;
 def: F<"no-undefined">;
 def: F<"nxcompat">;
 def: F<"pic-executable">;
-def: S<"plugin">;
-def: J<"plugin=">;
-def: S<"plugin-opt">;
-def: J<"plugin-opt=">;
-def: J<"sysroot">;
+defm: EqNoHelp<"plugin">;
+defm: EqNoHelp<"plugin-opt">;
+defm: EqNoHelp<"sysroot">;
 def: F<"start-group">;
 def: F<"tsaware">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107253.363644.patch
Type: text/x-patch
Size: 3369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/8073df84/attachment.bin>


More information about the llvm-commits mailing list