This libgo patch changes the go tool to look for a tool build ID
before hashing the entire file It also fixes the key used to store
the ID. This is a significant speedup in go tool run time.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed
to mainline.
Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 275558)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-5c3f52ffbae7a9bb59bce63cd2cffdd8af8f4a92
+68038b4fdf1456482af986cb05dcf3121bd43ffc
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: libgo/go/cmd/go/internal/work/buildid.go
===================================================================
--- libgo/go/cmd/go/internal/work/buildid.go (revision 275473)
+++ libgo/go/cmd/go/internal/work/buildid.go (working copy)
@@ -291,14 +291,19 @@ func (b *Builder) gccgoToolID(name, lang
exe = lp
}
}
- if _, err := os.Stat(exe); err != nil {
- return "", fmt.Errorf("%s: can not find compiler %q:
%v; output %q", name, exe, err, out)
+ id, err = buildid.ReadFile(exe)
+ if err != nil {
+ return "", err
+ }
+
+ // If we can't find a build ID, use a hash.
+ if id == "" {
+ id = b.fileHash(exe)
}
- id = b.fileHash(exe)
}
b.id.Lock()
- b.toolIDCache[name] = id
+ b.toolIDCache[key] = id
b.id.Unlock()
return id, nil