Commit eec8fb5e authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: explicitly disallow mixing -iexport={false,true}

flagiexport currently controls not just whether to use the indexed
export format when writing out package data, but also how symbol
import logic works. In particular, it enables lazy loading logic that
currently doesn't work with packages imported via bimport.

We could change the import logic to base decisions on the export data
format used by the packages that individual symbols were loaded from,
but since we expect to deprecate and remove bimport anyway and there's
no need for mixing bimport and iimport, it's simpler to just disallow
mixing them.

Change-Id: I02dbac45062e9dd85a1a647ee46bfa0efbb67e9d
Reviewed-on: https://go-review.googlesource.com/110715Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
parent c2366b27
......@@ -1115,10 +1115,21 @@ func importfile(f *Val) *types.Pkg {
errorexit()
}
// New indexed format is distinguished by an 'i' byte,
// whereas old export format always starts with 'c', 'd', or 'v'.
if c == 'i' {
if !flagiexport {
yyerror("import %s: cannot import package compiled with -iexport=true", file)
errorexit()
}
iimport(importpkg, imp)
} else {
// Old export format always starts with 'c', 'd', or 'v'.
if flagiexport {
yyerror("import %s: cannot import package compiled with -iexport=false", file)
errorexit()
}
imp.UnreadByte()
Import(importpkg, imp.Reader)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment