Commit c5c52f07 authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/cgo: don't emit #pragma declarations when using gccgo

Update #5905

Don't emit #pragma cgo_ldflag and cgo_import_static
declarations that gccgo doesn't understand and can't use.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/11490043
parent 9094941a
......@@ -32,7 +32,7 @@ func (p *Package) writeDefs() {
fflg := creat(*objDir + "_cgo_flags")
for k, v := range p.CgoFlags {
fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " "))
if k == "LDFLAGS" {
if k == "LDFLAGS" && !*gccgo {
for _, arg := range v {
fmt.Fprintf(fc, "#pragma cgo_ldflag %q\n", arg)
}
......@@ -105,7 +105,10 @@ func (p *Package) writeDefs() {
fmt.Fprintf(fm, "extern char %s[];\n", n.C)
fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, n.C)
fmt.Fprintf(fc, "#pragma cgo_import_static %s\n", n.C)
if !*gccgo {
fmt.Fprintf(fc, "#pragma cgo_import_static %s\n", n.C)
}
fmt.Fprintf(fc, "extern byte *%s;\n", n.C)
cVars[n.C] = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment