mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link, cmd/oldlink: detect object file format mismatch
When using the new(old) linker but an old(new) object file is found, give a better error message. Change-Id: I94786f1a4b527c15c4f5b00457eab60d215a72a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/225457 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
7716d7fc1b
commit
3e6ff18247
2 changed files with 7 additions and 0 deletions
|
|
@ -1667,6 +1667,9 @@ func (l *Loader) Preload(syms *sym.Symbols, f *bio.Reader, lib *sym.Library, uni
|
|||
}
|
||||
r := goobj2.NewReaderFromBytes(roObject, readonly)
|
||||
if r == nil {
|
||||
if len(roObject) >= 8 && bytes.Equal(roObject[:8], []byte("\x00go114ld")) {
|
||||
log.Fatalf("found object file %s in old format, but -go115newobj is true\nset -go115newobj consistently in all -gcflags, -asmflags, and -ldflags", f.File().Name())
|
||||
}
|
||||
panic("cannot read object file")
|
||||
}
|
||||
localSymVersion := syms.IncVersion()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue