Write out input file in Go syntax replacing C package
                names with real values. Used to generate files in the
                syscall package when bootstrapping a new target.
+       -srcdir directory
+               Find the Go input files, listed on the command line,
+               in directory.
        -objdir directory
                Put all generated files in directory.
        -importpath string
 
 // constant values used in the host's C libraries and system calls.
 var godefs = flag.Bool("godefs", false, "for bootstrap: write Go definitions for C file to standard output")
 
+var srcDir = flag.String("srcdir", "", "source directory")
 var objDir = flag.String("objdir", "", "object directory")
 var importPath = flag.String("importpath", "", "import path of package being built (for comments in generated files)")
 var exportHeader = flag.String("exportheader", "", "where to write export header if any exported functions")
        // Use the beginning of the md5 of the input to disambiguate.
        h := md5.New()
        for _, input := range goFiles {
+               if *srcDir != "" {
+                       input = filepath.Join(*srcDir, input)
+               }
                f, err := os.Open(input)
                if err != nil {
                        fatalf("%s", err)
 
        fs := make([]*File, len(goFiles))
        for i, input := range goFiles {
+               if *srcDir != "" {
+                       input = filepath.Join(*srcDir, input)
+               }
                f := new(File)
                f.ReadGo(input)
                f.DiscardCgoDirectives()