cmd/compile: don't export pos info in new export format for now
Exporting filenames as part of the position information can lead
to different object files which breaks tests.
Change-Id: Ia678ab64293ebf04bf83601e6ba72919d05762a4
Reviewed-on: https://go-review.googlesource.com/22385
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
diff --git a/src/cmd/compile/internal/gc/bexport.go b/src/cmd/compile/internal/gc/bexport.go
index 7aa6c9c..4964911 100644
--- a/src/cmd/compile/internal/gc/bexport.go
+++ b/src/cmd/compile/internal/gc/bexport.go
@@ -112,6 +112,14 @@
// (suspected) format errors, and whenever a change is made to the format.
const debugFormat = false // default: false
+// If posInfoFormat is set, position information (file, lineno) is written
+// for each exported object, including methods and struct fields. Currently
+// disabled because it may lead to different object files depending on which
+// directory they are built under, which causes tests checking for hermetic
+// builds to fail (e.g. TestCgoConsistentResults for cmd/go).
+// TODO(gri) determine what to do here.
+const posInfoFormat = false
+
// TODO(gri) remove eventually
const forceNewExport = false // force new export format - DO NOT SUBMIT with this flag set
@@ -160,6 +168,9 @@
}
p.rawByte(format)
+ // posInfo exported or not?
+ p.bool(posInfoFormat)
+
// --- generic export data ---
if p.trace {
@@ -493,6 +504,10 @@
}
func (p *exporter) pos(n *Node) {
+ if !posInfoFormat {
+ return
+ }
+
var file string
var line int
if n != nil {