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>
}
_, 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 {
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))
}