mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: improve gccgo support
Use wrapper functions to tell scheduler what we are doing. With this patch, and a separate patch to the go tool, all the cgo tests pass with gccgo. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6812058
This commit is contained in:
parent
f284a3ff4d
commit
3b04d23cbf
2 changed files with 198 additions and 68 deletions
|
|
@ -644,7 +644,14 @@ func (p *Package) rewriteRef(f *File) {
|
|||
n.Kind = "var"
|
||||
}
|
||||
if n.Mangle == "" {
|
||||
n.Mangle = "_C" + n.Kind + "_" + n.Go
|
||||
// When using gccgo variables have to be
|
||||
// exported so that they become global symbols
|
||||
// that the C code can refer to.
|
||||
prefix := "_C"
|
||||
if *gccgo && n.Kind == "var" {
|
||||
prefix = "C"
|
||||
}
|
||||
n.Mangle = prefix + n.Kind + "_" + n.Go
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue