]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: disable binary package export format
authorMatthew Dempsky <mdempsky@google.com>
Wed, 3 Oct 2018 17:56:23 +0000 (10:56 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 3 Oct 2018 19:24:11 +0000 (19:24 +0000)
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: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/main.go

index 3aa7c390675a23abf9c526e12434546030f67b19..6ee660988a7ceb2a81a13aabde6b1418d56a9d3b 100644 (file)
@@ -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)
                }
 
index fb5a413b846149f6f0dd51f8c873562e55110033..f188c9a9cda40cd21e1a608501bc96a000fdfcd3 100644 (file)
@@ -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
index 44cf75e7c989a35914404e2e98dd1f7543592be1..68f6294724d6a191a95748213c0edb8457b80622 100644 (file)
@@ -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_)