mirror of
https://github.com/golang/go
synced 2024-11-17 19:04:47 -07:00
[dev.link] cmd/link: refer to .got instead of .got.plt on S390X
S390X uses .got instead of .got.plt. It is changed accidentally in CL 222977. This CL fixes it. Also, on S390X, we need to set the relocation "variant" of R_PCREL relocation. In the old code AddPCRelPlus has the magic. Here we use the equivalent R_PCRELDBL, as the loader doesn't have variant. Fix S390X build. Change-Id: I388e16f02a0568d70287aa9a132fd42b442e3905 Reviewed-on: https://go-review.googlesource.com/c/go/+/223143 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
a3e965ce8a
commit
2a5bf32638
@ -1645,6 +1645,10 @@ func (ctxt *Link) doelf() {
|
||||
dynamic.SetReachable(true)
|
||||
dynamic.SetType(sym.SELFSECT) // writable
|
||||
|
||||
if ctxt.IsS390X() {
|
||||
// S390X uses .got instead of .got.plt
|
||||
gotplt = got
|
||||
}
|
||||
thearch.Elfsetupplt(ctxt, plt, gotplt, dynamic.Sym())
|
||||
|
||||
/*
|
||||
@ -1678,8 +1682,6 @@ func (ctxt *Link) doelf() {
|
||||
|
||||
if ctxt.IsPPC64() {
|
||||
elfwritedynentsym2(ctxt, dynamic, DT_PLTGOT, plt.Sym())
|
||||
} else if ctxt.IsS390X() {
|
||||
elfwritedynentsym2(ctxt, dynamic, DT_PLTGOT, got.Sym())
|
||||
} else {
|
||||
elfwritedynentsym2(ctxt, dynamic, DT_PLTGOT, gotplt.Sym())
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.S
|
||||
// larl %r1,_GLOBAL_OFFSET_TABLE_
|
||||
plt.AddUint8(0xc0)
|
||||
plt.AddUint8(0x10)
|
||||
plt.AddPCRelPlus(ctxt.Arch, got.Sym(), 6)
|
||||
plt.AddSymRef(ctxt.Arch, got.Sym(), 6, objabi.R_PCRELDBL, 4)
|
||||
// mvc 48(8,%r15),8(%r1)
|
||||
plt.AddUint8(0xd2)
|
||||
plt.AddUint8(0x07)
|
||||
|
Loading…
Reference in New Issue
Block a user