mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
cmd/compile: make -A and -newexport compatible
Packages compiled with -A may reference the builtin "any" type, so it needs to be included in the list of predeclared types for binary import/export. Also, when -A is used, mark all symbols as SymExport instead of SymPackage in importsym. This parallels the logic in autoexport and is necessary to prevent a "export/package mismatch" errors in exportsym during dumpexport's verifyExport pass. Change-Id: Iff5ec5fbfe2219525ec9d1a975307fa8936af9b9 Reviewed-on: https://go-review.googlesource.com/19627 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
1402e522c6
commit
d930d69fd9
@ -1035,6 +1035,9 @@ func predeclared() []*Type {
|
||||
|
||||
// package unsafe
|
||||
Types[TUNSAFEPTR],
|
||||
|
||||
// any type, for builtin export data
|
||||
Types[TANY],
|
||||
}
|
||||
}
|
||||
return predecl
|
||||
|
@ -442,7 +442,7 @@ func importsym(s *Sym, op Op) *Sym {
|
||||
|
||||
// mark the symbol so it is not reexported
|
||||
if s.Def == nil {
|
||||
if exportname(s.Name) || initname(s.Name) {
|
||||
if Debug['A'] != 0 || exportname(s.Name) || initname(s.Name) {
|
||||
s.Flags |= SymExport
|
||||
} else {
|
||||
s.Flags |= SymPackage // package scope
|
||||
|
@ -678,4 +678,8 @@ var predeclared = []types.Type{
|
||||
|
||||
// package unsafe
|
||||
types.Typ[types.UnsafePointer],
|
||||
|
||||
// any type, for builtin export data
|
||||
// TODO(mdempsky): Provide an actual Type value to represent "any"?
|
||||
types.Typ[types.Invalid],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user