mirror of https://github.com/golang/go.git
[dev.link] cmd/link: restore export data hash
With the previous CL, the export data will not change whether it is compiled with -dynlink flag or not. Restore the export data hash, and reenable plugin version check. TODO: it may be still better to just generate a fingerprint for each package at compile time. Change-Id: I1f298ac97c3ab9b8d05d1c95e8be74d10ca7cd0e Reviewed-on: https://go-review.googlesource.com/c/go/+/201720 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
286d744246
commit
bd229936cf
|
|
@ -145,13 +145,12 @@ func main() {
|
|||
}
|
||||
|
||||
_, err = plugin.Open("plugin-mismatch.so")
|
||||
// TODO: newobj
|
||||
//if err == nil {
|
||||
// log.Fatal(`plugin.Open("plugin-mismatch.so"): should have failed`)
|
||||
//}
|
||||
//if s := err.Error(); !strings.Contains(s, "different version") {
|
||||
// log.Fatalf(`plugin.Open("plugin-mismatch.so"): error does not mention "different version": %v`, s)
|
||||
//}
|
||||
if err == nil {
|
||||
log.Fatal(`plugin.Open("plugin-mismatch.so"): should have failed`)
|
||||
}
|
||||
if s := err.Error(); !strings.Contains(s, "different version") {
|
||||
log.Fatalf(`plugin.Open("plugin-mismatch.so"): error does not mention "different version": %v`, s)
|
||||
}
|
||||
|
||||
_, err = plugin.Open("plugin2-dup.so")
|
||||
if err == nil {
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ func genhash(ctxt *Link, lib *sym.Library) {
|
|||
return
|
||||
}
|
||||
h.Write(pkgDefBytes[0:firstEOL])
|
||||
//h.Write(pkgDefBytes[firstDoubleDollar : firstDoubleDollar+secondDoubleDollar]) // TODO: newobj: -dynlink may change symbol numbering? which will make the export data differ
|
||||
h.Write(pkgDefBytes[firstDoubleDollar : firstDoubleDollar+secondDoubleDollar])
|
||||
lib.Hash = hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue