mirror of
https://github.com/golang/go
synced 2024-11-23 22:10:04 -07:00
cmd/link: on PPC64, put plt stubs at beginning of Textp
Put call stubs at the beginning (instead of the end). So the trampoline pass knows the addresses of the stubs, and it can insert trampolines when necessary. Fixes #19425. Change-Id: I1e06529ef837a6130df58917315610d45a6819ca Reviewed-on: https://go-review.googlesource.com/38131 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
This commit is contained in:
parent
43afcb5c96
commit
15b37655bc
@ -87,6 +87,7 @@ func genplt(ctxt *ld.Link) {
|
|||||||
//
|
//
|
||||||
// This assumes "case 1" from the ABI, where the caller needs
|
// This assumes "case 1" from the ABI, where the caller needs
|
||||||
// us to save and restore the TOC pointer.
|
// us to save and restore the TOC pointer.
|
||||||
|
var stubs []*ld.Symbol
|
||||||
for _, s := range ctxt.Textp {
|
for _, s := range ctxt.Textp {
|
||||||
for i := range s.R {
|
for i := range s.R {
|
||||||
r := &s.R[i]
|
r := &s.R[i]
|
||||||
@ -108,7 +109,7 @@ func genplt(ctxt *ld.Link) {
|
|||||||
if stub.Size == 0 {
|
if stub.Size == 0 {
|
||||||
// Need outer to resolve .TOC.
|
// Need outer to resolve .TOC.
|
||||||
stub.Outer = s
|
stub.Outer = s
|
||||||
ctxt.Textp = append(ctxt.Textp, stub)
|
stubs = append(stubs, stub)
|
||||||
gencallstub(ctxt, 1, stub, r.Sym)
|
gencallstub(ctxt, 1, stub, r.Sym)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +122,11 @@ func genplt(ctxt *ld.Link) {
|
|||||||
ctxt.Arch.ByteOrder.PutUint32(s.P[r.Off+4:], o1)
|
ctxt.Arch.ByteOrder.PutUint32(s.P[r.Off+4:], o1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Put call stubs at the beginning (instead of the end).
|
||||||
|
// So when resolving the relocations to calls to the stubs,
|
||||||
|
// the addresses are known and trampolines can be inserted
|
||||||
|
// when necessary.
|
||||||
|
ctxt.Textp = append(stubs, ctxt.Textp...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func genaddmoduledata(ctxt *ld.Link) {
|
func genaddmoduledata(ctxt *ld.Link) {
|
||||||
|
Loading…
Reference in New Issue
Block a user