gollvm: accept + ignore some additional command line flags

Change the command line parser to accept (and ignore) a collection of
flags supported by gccgo that are used as part of the gccgo torture
test and regression test. These include fno-diagnostics-show-caret,
-fno-show-column, -fbounds-check, -pedantic-errors, and others. Also
included on the list are -flto and -fuse_linker_plugin (it is worth
noting that at some point we want to support some form of LTO).

Change-Id: Ia084aadf662b7d2016a038f5be010fe32ff7eed5
Reviewed-on: https://go-review.googlesource.com/112620
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/driver-main/llvm-goc.cpp b/driver-main/llvm-goc.cpp
index e788c0f..d7ac106 100644
--- a/driver-main/llvm-goc.cpp
+++ b/driver-main/llvm-goc.cpp
@@ -107,6 +107,12 @@
     exit(0);
   }
 
+  // Honor --print-multi-lib. FIXME: add real multilib support.
+  if (args_.hasArg(gollvm::options::OPT_print_multi_lib)) {
+    llvm::outs() << ".;@m64\n";
+    exit(0);
+  }
+
   // Complain about missing arguments.
   if (missingArgIndex != 0) {
     errs() << progname << ": error: argument to '"
diff --git a/driver/GollvmOptions.td b/driver/GollvmOptions.td
index 9b049d3..bb947d0 100644
--- a/driver/GollvmOptions.td
+++ b/driver/GollvmOptions.td
@@ -170,6 +170,10 @@
 def dumpmachine : Flag<["-"], "dumpmachine">,
   HelpText<"Emit target machine and exit.">;
 
+def print_multi_lib : Flag<["--"], "print-multi-lib">,
+  HelpText<"Emit the mapping from multilib directory names to compiler "
+           "flags that enable them">;
+
 def w : Flag<["-"], "w">,
   HelpText<"Suppress warning messages">;
 def no_warn : Flag<["-"], "no-warm">, Alias<w>;
@@ -320,6 +324,38 @@
 def fno_toplevel_reorder : Flag<["-"], "fno-toplevel-reorder">,
     Flags<[Ignored]>, HelpText<"This option is ignored">;
 
+def fno_diagnostics_show_caret : Flag<["-"], "fno-diagnostics-show-caret">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def fno_show_column : Flag<["-"], "fno-show-column">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def fbounds_check : Flag<["-"], "fbounds-check">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def finline_functions : Flag<["-"], "finline-functions">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def funroll_loops : Flag<["-"], "funroll-loops">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def pedantic_errors : Flag<["-"], "pedantic-errors">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">,
+    Flags<[Ignored]>, HelpText<"This option is ignored">;
+
+// Currently unsupported or not-yet-supported.
+
+def flto : Flag<["-"], "flto">,
+    Flags<[Ignored]>, HelpText<"This option is not yet supported">;
+
+def fuse_linker_plugin : Flag<["-"], "fuse-linker-plugin">,
+    Flags<[Ignored]>, HelpText<"This option is not yet supported">;
+
 // Debugging options for gollvm developers.
 
 def fgo_dump_ast : Flag<["-"], "fgo-dump-ast">,
@@ -364,4 +400,3 @@
 def disable_llvm_passes : Flag<["-"], "disable-llvm-passes">,
   HelpText<"Use together with -emit-llvm to get pristine LLVM IR from the "
            "frontend by not running any LLVM passes at all">;
-