mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
9094941a40
commit
c5c52f072b
1 changed files with 5 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ func (p *Package) writeDefs() {
|
||||||
fflg := creat(*objDir + "_cgo_flags")
|
fflg := creat(*objDir + "_cgo_flags")
|
||||||
for k, v := range p.CgoFlags {
|
for k, v := range p.CgoFlags {
|
||||||
fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " "))
|
fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " "))
|
||||||
if k == "LDFLAGS" {
|
if k == "LDFLAGS" && !*gccgo {
|
||||||
for _, arg := range v {
|
for _, arg := range v {
|
||||||
fmt.Fprintf(fc, "#pragma cgo_ldflag %q\n", arg)
|
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, "extern char %s[];\n", n.C)
|
||||||
fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, 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)
|
fmt.Fprintf(fc, "extern byte *%s;\n", n.C)
|
||||||
|
|
||||||
cVars[n.C] = true
|
cVars[n.C] = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue