cgo: handle versioned ELF symbols

Fixes #1397.

R=iant
CC=golang-dev
https://golang.org/cl/4444064
This commit is contained in:
Russ Cox 2011-04-27 23:21:03 -04:00
parent 70b0de8e98
commit 09092a78e6
14 changed files with 454 additions and 119 deletions

View file

@ -20,7 +20,6 @@ import (
"os"
"reflect"
"strings"
"runtime"
)
// A Package collects information about the package we're going to write.
@ -135,20 +134,7 @@ func main() {
// instead of needing to make the linkers duplicate all the
// specialized knowledge gcc has about where to look for imported
// symbols and which ones to use.
syms, imports := dynimport(*dynobj)
if runtime.GOOS == "windows" {
for _, sym := range syms {
ss := strings.Split(sym, ":", -1)
fmt.Printf("#pragma dynimport %s %s %q\n", ss[0], ss[0], strings.ToLower(ss[1]))
}
return
}
for _, sym := range syms {
fmt.Printf("#pragma dynimport %s %s %q\n", sym, sym, "")
}
for _, p := range imports {
fmt.Printf("#pragma dynimport %s %s %q\n", "_", "_", p)
}
dynimport(*dynobj)
return
}