mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
misc/cgo/life: fix, add to build
#pragma dynexport is no longer needed for this use of cgo, since the gcc and gc code are now linked together into the same binary. It may still be necessary later. On the Mac, you cannot use the GOT to resolve symbols that exist in the current binary, so 6l and 8l translate the GOT-loading mov instructions into lea instructions. On ELF systems, we could use the GOT for those symbols, but for consistency 6l and 8l apply the same translation. The translation is sketchy in the extreme (depending on the relocation being in a mov instruction) but it verifies that the instruction is a mov before rewriting it to lea. Also makes typedefs global across files. Fixes #1335. Fixes #1345. R=iant, r CC=golang-dev https://golang.org/cl/3650042
This commit is contained in:
parent
a890d70cc1
commit
0cd3475386
12 changed files with 159 additions and 67 deletions
|
|
@ -232,18 +232,6 @@ func (p *Package) Record(f *File) {
|
|||
error(token.NoPos, "inconsistent package names: %s, %s", p.PackageName, f.Package)
|
||||
}
|
||||
|
||||
if p.Typedef == nil {
|
||||
p.Typedef = f.Typedef
|
||||
} else {
|
||||
for k, v := range f.Typedef {
|
||||
if p.Typedef[k] == nil {
|
||||
p.Typedef[k] = v
|
||||
} else if !reflect.DeepEqual(p.Typedef[k], v) {
|
||||
error(token.NoPos, "inconsistent definitions for C type %s", k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if p.Name == nil {
|
||||
p.Name = f.Name
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue