]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/internal/obj: traverse files in deterministic order
authorCherry Zhang <cherryyz@google.com>
Tue, 11 Aug 2020 18:58:03 +0000 (14:58 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 11 Aug 2020 20:41:44 +0000 (20:41 +0000)
CL 245485 introduced a map for used files in a function. When
numbering symbols, make sure we traverse the files in
deterministic order.

Should fix longtest builders.

Change-Id: I1006bc5425116ab40e33a61e8f5acd1bdb4abad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/247997
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/obj/sym.go

index cf78849cdae8499ebd737c8e7906bbfe63801456..34f61b7f62e48a7321ced33a0ce6278d0b3129c3 100644 (file)
@@ -368,7 +368,12 @@ func (ctxt *Link) traverseFuncAux(flag traverseFlag, fsym *LSym, fn func(parent
                }
        }
        files := ctxt.PosTable.FileTable()
+       usedFiles := make([]goobj.CUFileIndex, 0, len(pc.UsedFiles))
        for f := range pc.UsedFiles {
+               usedFiles = append(usedFiles, f)
+       }
+       sort.Slice(usedFiles, func(i, j int) bool { return usedFiles[i] < usedFiles[j] })
+       for _, f := range usedFiles {
                if filesym := ctxt.Lookup(files[f]); filesym != nil {
                        fn(fsym, filesym)
                }