Commit d546bebe authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/gc: disable binary package export format

The new indexed package export format appears stable, and no reports
of needing to revert back to binary package export.

This CL disables the binary package export format by mechanically
replacing 'flagiexport' with 'true', and then superficial code
cleanups to keep the resulting code idiomatic. The resulting dead code
is removed in a followup CL.

Change-Id: Ic30d85f78778a31d279a56b9ab14e80836d50135
Reviewed-on: https://go-review.googlesource.com/c/139337
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 02b444bc
......@@ -12,8 +12,6 @@ import (
)
var (
flagiexport bool // if set, use indexed export data format
Debug_export int // if set, print debugging information about export data
)
......@@ -75,11 +73,7 @@ func dumpexport(bout *bio.Writer) {
// The linker also looks for the $$ marker - use char after $$ to distinguish format.
exportf(bout, "\n$$B\n") // indicate binary export format
off := bout.Offset()
if flagiexport {
iexport(bout.Writer)
} else {
export(bout.Writer, Debug_export != 0)
}
iexport(bout.Writer)
size := bout.Offset() - off
exportf(bout, "\n$$\n")
......@@ -95,7 +89,7 @@ func importsym(ipkg *types.Pkg, s *types.Sym, op Op) *Node {
// declaration for all imported symbols. The exception
// is declarations for Runtimepkg, which are populated
// by loadsys instead.
if flagiexport && s.Pkg != Runtimepkg {
if s.Pkg != Runtimepkg {
Fatalf("missing ONONAME for %v\n", s)
}
......
......@@ -71,9 +71,7 @@ func fnpkg(fn *Node) *types.Pkg {
func typecheckinl(fn *Node) {
lno := setlineno(fn)
if flagiexport {
expandInline(fn)
}
expandInline(fn)
// typecheckinl is only for imported functions;
// their bodies may refer to unsafe as long as the package
......
......@@ -249,7 +249,6 @@ func Main(archInit func(*Arch)) {
flag.StringVar(&blockprofile, "blockprofile", "", "write block profile to `file`")
flag.StringVar(&mutexprofile, "mutexprofile", "", "write mutex profile to `file`")
flag.StringVar(&benchfile, "bench", "", "append benchmark times to `file`")
flag.BoolVar(&flagiexport, "iexport", true, "export indexed package data")
objabi.Flagparse(usage)
// Record flags that affect the build result. (And don't
......@@ -1129,24 +1128,13 @@ 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 {
if flagiexport {
yyerror("import %s: cannot import package compiled with -iexport=false", file)
errorexit()
}
imp.UnreadByte()
Import(importpkg, imp.Reader)
// Indexed format is distinguished by an 'i' byte,
// whereas previous export formats started with 'c', 'd', or 'v'.
if c != 'i' {
yyerror("import %s: unexpected package format byte: %v", file, c)
errorexit()
}
iimport(importpkg, imp)
default:
yyerror("no import in %q", path_)
......
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