Commit f4f1b307 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: accept old and new import format for builtin declarations

Test with forceNewExport set to true (but continues to be disabled by
default for now).

Fixes #15322.

Change-Id: I3b893db2206cbb79e66339284f22f4a0b20bf137
Reviewed-on: https://go-review.googlesource.com/22328Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent ed41054b
......@@ -643,11 +643,24 @@ func loadsys() {
iota_ = -1000000
incannedimport = 1
importpkg = Runtimepkg
parse_import(bufio.NewReader(strings.NewReader(runtimeimport)), nil)
importpkg = unsafepkg
parse_import(bufio.NewReader(strings.NewReader(unsafeimport)), nil)
// The first byte in the binary export format is a 'c' or 'd'
// specifying the encoding format. We could just check that
// byte, but this is a perhaps more robust. Also, it is not
// speed-critical.
// TODO(gri) simplify once textual export format has gone
if strings.HasPrefix(runtimeimport, "package") {
// textual export format
importpkg = Runtimepkg
parse_import(bufio.NewReader(strings.NewReader(runtimeimport)), nil)
importpkg = unsafepkg
parse_import(bufio.NewReader(strings.NewReader(unsafeimport)), nil)
} else {
// binary export format
importpkg = Runtimepkg
Import(bufio.NewReader(strings.NewReader(runtimeimport)))
importpkg = unsafepkg
Import(bufio.NewReader(strings.NewReader(unsafeimport)))
}
importpkg = nil
incannedimport = 0
......
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