diff --git a/go/gccgoexportdata/gccgoexportdata.go b/go/gccgoexportdata/gccgoexportdata.go index 7d276c75..ca5f75f0 100644 --- a/go/gccgoexportdata/gccgoexportdata.go +++ b/go/gccgoexportdata/gccgoexportdata.go @@ -30,10 +30,11 @@ import ( // CompilerInfo executes the specified gccgo compiler and returns // information about it: its version (e.g. "4.8.0"), its target triple // (e.g. "x86_64-unknown-linux-gnu"), and the list of directories it -// searches to find standard packages. -func CompilerInfo(gccgo string) (version, triple string, dirs []string, err error) { +// searches to find standard packages. The given arguments are passed +// directly to calls to the specified gccgo compiler. +func CompilerInfo(gccgo string, args ...string) (version, triple string, dirs []string, err error) { var inst gccgoimporter.GccgoInstallation - err = inst.InitFromDriver(gccgo) + err = inst.InitFromDriver(gccgo, args...) if err == nil { version = inst.GccVersion triple = inst.TargetTriple diff --git a/go/internal/gccgoimporter/gccgoinstallation.go b/go/internal/gccgoimporter/gccgoinstallation.go index 2bf1f6ff..cebfc571 100644 --- a/go/internal/gccgoimporter/gccgoinstallation.go +++ b/go/internal/gccgoimporter/gccgoinstallation.go @@ -28,8 +28,10 @@ type GccgoInstallation struct { } // Ask the driver at the given path for information for this GccgoInstallation. -func (inst *GccgoInstallation) InitFromDriver(gccgoPath string) (err error) { - cmd := exec.Command(gccgoPath, "-###", "-S", "-x", "go", "-") +// The given arguments are passed directly to the call to the driver. +func (inst *GccgoInstallation) InitFromDriver(gccgoPath string, args ...string) (err error) { + argv := append([]string{"-###", "-S", "-x", "go", "-"}, args...) + cmd := exec.Command(gccgoPath, argv...) stderr, err := cmd.StderrPipe() if err != nil { return @@ -57,7 +59,8 @@ func (inst *GccgoInstallation) InitFromDriver(gccgoPath string) (err error) { } } - stdout, err := exec.Command(gccgoPath, "-dumpversion").Output() + argv = append([]string{"-dumpversion"}, args...) + stdout, err := exec.Command(gccgoPath, argv...).Output() if err != nil { return }