gollvm: add preliminary support for go:embed

Update the driver to accept the -fgo-embedcfg=... command line option,
and pass the results on to the front end.

Change-Id: I58d65ae89f5ffeaeba6771f4f0ce802d4197143d
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/281856
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/bridge/go-c.h b/bridge/go-c.h
index 2f08ff0..be80eec 100644
--- a/bridge/go-c.h
+++ b/bridge/go-c.h
@@ -28,6 +28,7 @@
   const char* prefix;
   const char* relative_import_path;
   const char* c_header;
+  const char* embedcfg;
   Backend* backend;
   Linemap* linemap;
   bool check_divide_by_zero;
diff --git a/driver/CompileGo.cpp b/driver/CompileGo.cpp
index 6510b72..533a9d5 100644
--- a/driver/CompileGo.cpp
+++ b/driver/CompileGo.cpp
@@ -622,6 +622,9 @@
   opt::Arg *chdr =
       args_.getLastArg(gollvm::options::OPT_fgo_c_header_EQ);
   args.c_header = (chdr == nullptr ? NULL : chdr->getValue());
+  opt::Arg *ecfg =
+      args_.getLastArg(gollvm::options::OPT_fgo_embedcfg_EQ);
+  args.embedcfg = (ecfg == nullptr ? NULL : ecfg->getValue());
   args.check_divide_by_zero =
       driver_.reconcileOptionPair(gollvm::options::OPT_fgo_check_divide_zero,
                                   gollvm::options::OPT_fno_go_check_divide_zero,
diff --git a/driver/GollvmOptions.td b/driver/GollvmOptions.td
index 6db0a65..3c60287 100644
--- a/driver/GollvmOptions.td
+++ b/driver/GollvmOptions.td
@@ -411,6 +411,10 @@
   Group<f_Group>,
   HelpText<"The C header file to write.">;
 
+def fgo_embedcfg_EQ : Joined<["-"], "fgo-embedcfg=">,
+  Group<f_Group>,
+  HelpText<"List of embedded files via go:embed.">;
+
 // Needed for compatibility with gccgo
 
 def xassembler_with_cpp : Flag<["-"], "xassembler-with-cpp">,