]> Cypherpunks repositories - gostls13.git/commitdiff
gc: use AbsFileLine for deterministic binary export data
authorAlan Donovan <adonovan@google.com>
Mon, 25 Apr 2016 22:31:36 +0000 (18:31 -0400)
committerRobert Griesemer <gri@golang.org>
Tue, 26 Apr 2016 21:43:17 +0000 (21:43 +0000)
This version of the file name honors the -trimprefix flag,
which strips off variable parts like $WORK or $PWD.
The TestCgoConsistentResults test now passes.

Change-Id: If93980b054f9b13582dd314f9d082c26eaac4f41
Reviewed-on: https://go-review.googlesource.com/22444
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/bexport.go

index b44eb5e05a3a2ed38855e005886703896a9a51c4..5618012c77e27b13ea5426ac0634ea644242e717 100644 (file)
@@ -113,12 +113,8 @@ import (
 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
+// for each exported object, including methods and struct fields.
+const posInfoFormat = true // default: true
 
 // TODO(gri) remove eventually
 const forceNewExport = false // force new export format - do NOT submit with this flag set
@@ -517,7 +513,7 @@ func (p *exporter) pos(n *Node) {
        var file string
        var line int
        if n != nil {
-               file, line = Ctxt.LineHist.FileLine(int(n.Lineno))
+               file, line = Ctxt.LineHist.AbsFileLine(int(n.Lineno))
        }
 
        if file == p.prevFile && line != p.prevLine {