Commit bd229936 authored by Cherry Zhang's avatar Cherry Zhang

[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: default avatarThan McIntosh <thanm@google.com>
parent 286d7442
......@@ -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))
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment