mirror of
https://github.com/golang/go
synced 2024-11-18 16:04:44 -07:00
cmd/cgo: don't #include cgo_export.h in gccgo _cgo_main.c
Instead of relying on the asm names declared in the gccgo version of cgo_export.h, just emit a dummy symbol with the right asm name. This is enough to let the _cgo_main link succeed, which is all that matters here. Fixes #9294. Change-Id: I803990705b6b226ed0adf17dc57b58a9f501b213 Reviewed-on: https://go-review.googlesource.com/1901 Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
1e65616e1a
commit
1303f0d3d8
@ -835,8 +835,6 @@ func (p *Package) writeGccgoExports(fgo2, fc, fm io.Writer) {
|
||||
fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n")
|
||||
fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n")
|
||||
|
||||
fmt.Fprintf(fm, "#include \"_cgo_export.h\"\n")
|
||||
|
||||
for _, exp := range p.ExpFunc {
|
||||
fn := exp.Func
|
||||
fntype := fn.Type
|
||||
@ -924,7 +922,8 @@ func (p *Package) writeGccgoExports(fgo2, fc, fm io.Writer) {
|
||||
fmt.Fprint(fgcc, "}\n")
|
||||
|
||||
// Dummy declaration for _cgo_main.c
|
||||
fmt.Fprintf(fm, "%s %s %s {}\n", cRet, goName, cParams)
|
||||
fmt.Fprintf(fm, `char %s[1] __asm__("%s.%s");`, goName, gccgoSymbolPrefix, goName)
|
||||
fmt.Fprint(fm, "\n")
|
||||
|
||||
// For gccgo we use a wrapper function in Go, in order
|
||||
// to call CgocallBack and CgocallBackDone.
|
||||
|
Loading…
Reference in New Issue
Block a user