]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: write _cgo_export.h to object directory, not source dir
authorRuss Cox <rsc@golang.org>
Thu, 12 Jan 2012 23:04:31 +0000 (15:04 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 12 Jan 2012 23:04:31 +0000 (15:04 -0800)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540048

src/cmd/cgo/out.go
src/pkg/go/build/build.go

index b1644d2b0e10a950d65af56629828478bc0501d3..3e25b2099c25e02d5b3eca5d5833dcb1816679ca 100644 (file)
@@ -396,7 +396,7 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) {
 // from Go so that they are callable from C.
 func (p *Package) writeExports(fgo2, fc, fm *os.File) {
        fgcc := creat(*objDir + "_cgo_export.c")
-       fgcch := creat("_cgo_export.h")
+       fgcch := creat(*objDir + "_cgo_export.h")
 
        fmt.Fprintf(fgcch, "/* Created by cgo - DO NOT EDIT. */\n")
        fmt.Fprintf(fgcch, "%s\n", gccExportHeaderProlog)
index 5301ab53e519d43b0bcce89ba652db9f899b6ceb..9515a7e645224f41d032ad227e0ff4e4cf89ad1f 100644 (file)
@@ -396,8 +396,7 @@ func (b *build) cgo(cgofiles, cgocfiles []string) (outGo, outObj []string) {
                Output: output,
        })
        outGo = append(outGo, gofiles...)
-       exportH := filepath.Join(b.path, "_cgo_export.h")
-       b.script.addIntermediate(defunC, exportH, b.obj+"_cgo_flags")
+       b.script.addIntermediate(defunC, b.obj+"_cgo_export.h", b.obj+"_cgo_flags")
        b.script.addIntermediate(cfiles...)
 
        // cc _cgo_defun.c