Fixes #16243.
Change-Id: I207d1e8aa48abe453a23c709ccf4f8e07368595b
Reviewed-on: https://go-review.googlesource.com/24648
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
// TODO(gri) disable and remove once there is only one export format again
const forceObjFileStability = true
-const exportVersion = "v0"
+// Supported export format versions.
+// TODO(gri) Make this more systematic (issue #16244).
+const (
+ exportVersion0 = "v0"
+ exportVersion1 = "v1"
+ exportVersion = exportVersion1
+)
// exportInlined enables the export of inlined function bodies and related
// dependencies. The compiler should work w/o any loss of functionality with
p.paramList(sig.Params(), inlineable)
p.paramList(sig.Results(), inlineable)
+ // for issue #16243
+ // We make this conditional for 1.7 to avoid consistency problems
+ // with installed packages compiled with an older version.
+ // TODO(gri) Clean up after 1.7 is out (issue #16244)
+ if exportVersion == exportVersion1 {
+ p.bool(m.Nointerface)
+ }
+
var f *Func
if inlineable {
f = mfn.Func
// changes to bimport.go and bexport.go.
type importer struct {
- in *bufio.Reader
- buf []byte // reused for reading strings
+ in *bufio.Reader
+ buf []byte // reused for reading strings
+ version string
// object lists, in order of deserialization
strList []string
// --- generic export data ---
- if v := p.string(); v != exportVersion {
- Fatalf("importer: unknown export data version: %s", v)
+ p.version = p.string()
+ if p.version != exportVersion0 && p.version != exportVersion1 {
+ Fatalf("importer: unknown export data version: %s", p.version)
}
// populate typList with predeclared "known" types
params := p.paramList()
result := p.paramList()
+ nointerface := false
+ if p.version == exportVersion1 {
+ nointerface = p.bool()
+ }
+
n := methodname1(newname(sym), recv[0].Right)
n.Type = functype(recv[0], params, result)
checkwidth(n.Type)
- addmethod(sym, n.Type, tsym.Pkg, false, false)
+ addmethod(sym, n.Type, tsym.Pkg, false, nointerface)
p.funcList = append(p.funcList, n)
importlist = append(importlist, n)
package gc
const runtimeimport = "" +
- "cn\x00\x03v0\x01\rruntime\x00\t\x11newobject\x00\x02\x17\"\vtyp·2\x00\x00" +
+ "cn\x00\x03v1\x01\rruntime\x00\t\x11newobject\x00\x02\x17\"\vtyp·2\x00\x00" +
"\x01\x17:\x00\t\x13panicindex\x00\x00\x00\t\x13panicslice\x00\x00\x00\t\x15pani" +
"cdivide\x00\x00\x00\t\x15throwreturn\x00\x00\x00\t\x11throwinit\x00\x00\x00" +
"\t\x11panicwrap\x00\x05 \x00 \x00 \x00\x00\t\rgopanic\x00\x01\x1b\x00\x00\x00\x00\t\x11go" +
"\x01\x02\v\x00\x01\x00\n$$\n"
const unsafeimport = "" +
- "cn\x00\x03v0\x01\vunsafe\x00\x05\r\rPointer\x00\x16\x00\t\x0fOffsetof\x00\x01" +
+ "cn\x00\x03v1\x01\vunsafe\x00\x05\r\rPointer\x00\x16\x00\t\x0fOffsetof\x00\x01" +
":\x00\x01\x16\x00\t\vSizeof\x00\x01:\x00\x01\x16\x00\t\rAlignof\x00\x01:\x00\x01\x16\x00\v\b\x00\v" +
"\x00\x01\x00\n$$\n"
ss.Type = functype(s2[0], s6, s8)
checkwidth(ss.Type)
- addmethod(s4, ss.Type, p.structpkg, false, false)
+ addmethod(s4, ss.Type, p.structpkg, false, p.pragma&Nointerface != 0)
+ p.pragma = 0
funchdr(ss)
// inl.C's inlnode in on a dotmeth node expects to find the inlineable body as
data []byte
path string
buf []byte // for reading strings
+ version string
// object lists
strList []string // in order of appearance
// --- generic export data ---
- if v := p.string(); v != "v0" {
- return p.read, nil, fmt.Errorf("unknown export data version: %s", v)
+ p.version = p.string()
+ if p.version != "v0" && p.version != "v1" {
+ return p.read, nil, fmt.Errorf("unknown export data version: %s", p.version)
}
// populate typList with predeclared "known" types
params, isddd := p.paramList()
result, _ := p.paramList()
+ if p.version == "v1" {
+ p.int() // nointerface flag - discarded
+ }
+
sig := types.NewSignature(recv.At(0), params, result, isddd)
t0.AddMethod(types.NewFunc(token.NoPos, parent, name, sig))
}