[dev.link] cmd/link: fix xcoff loader for new obj format

config.go needs to be removed from this CL.

Change-Id: I04a267feeae1551bb18f6a03a725adc9db593fdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/204099
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Jeremy Faller 2019-10-29 11:37:44 -04:00 committed by Cherry Zhang
parent c0555a2a7a
commit e961b26c27
3 changed files with 48 additions and 14 deletions

View file

@ -1707,15 +1707,27 @@ func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string,
}
if c1 == 0x01 && (c2 == 0xD7 || c2 == 0xF7) {
ldxcoff := func(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
textp, err := loadxcoff.Load(ctxt.Arch, ctxt.Syms, f, pkg, length, pn)
if err != nil {
Errorf(nil, "%v", err)
return
if *flagNewobj {
ldxcoff := func(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
textp, err := loadxcoff.Load(ctxt.loader, ctxt.Arch, ctxt.Syms, f, pkg, length, pn)
if err != nil {
Errorf(nil, "%v", err)
return
}
ctxt.Textp = append(ctxt.Textp, textp...)
}
ctxt.Textp = append(ctxt.Textp, textp...)
return ldhostobj(ldxcoff, ctxt.HeadType, f, pkg, length, pn, file)
} else {
ldxcoff := func(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
textp, err := loadxcoff.LoadOld(ctxt.Arch, ctxt.Syms, f, pkg, length, pn)
if err != nil {
Errorf(nil, "%v", err)
return
}
ctxt.Textp = append(ctxt.Textp, textp...)
}
return ldhostobj(ldxcoff, ctxt.HeadType, f, pkg, length, pn, file)
}
return ldhostobj(ldxcoff, ctxt.HeadType, f, pkg, length, pn, file)
}
/* check the header */