mirror of
https://github.com/golang/go
synced 2024-10-04 21:11:22 -06:00
cmd/link: move ppc64 genplt declarations into loop
(Split out from CL 22243.) Change-Id: I07709a0c417e7a57e839e5085a37db7d5fbf3a35 Reviewed-on: https://go-review.googlesource.com/22322 Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
854ab14b7e
commit
79c527f4a7
@ -39,14 +39,6 @@ import (
|
||||
)
|
||||
|
||||
func genplt() {
|
||||
var s *ld.LSym
|
||||
var stub *ld.LSym
|
||||
var pprevtextp **ld.LSym
|
||||
var r *ld.Reloc
|
||||
var n string
|
||||
var o1 uint32
|
||||
var i int
|
||||
|
||||
// The ppc64 ABI PLT has similar concepts to other
|
||||
// architectures, but is laid out quite differently. When we
|
||||
// see an R_PPC64_REL24 relocation to a dynamic symbol
|
||||
@ -95,11 +87,11 @@ func genplt() {
|
||||
//
|
||||
// This assumes "case 1" from the ABI, where the caller needs
|
||||
// us to save and restore the TOC pointer.
|
||||
pprevtextp = &ld.Ctxt.Textp
|
||||
pprevtextp := &ld.Ctxt.Textp
|
||||
|
||||
for s = *pprevtextp; s != nil; pprevtextp, s = &s.Next, s.Next {
|
||||
for i = range s.R {
|
||||
r = &s.R[i]
|
||||
for s := *pprevtextp; s != nil; pprevtextp, s = &s.Next, s.Next {
|
||||
for i := range s.R {
|
||||
r := &s.R[i]
|
||||
if r.Type != 256+ld.R_PPC64_REL24 || r.Sym.Type != obj.SDYNIMPORT {
|
||||
continue
|
||||
}
|
||||
@ -109,9 +101,9 @@ func genplt() {
|
||||
addpltsym(ld.Ctxt, r.Sym)
|
||||
|
||||
// Generate call stub
|
||||
n = fmt.Sprintf("%s.%s", s.Name, r.Sym.Name)
|
||||
n := fmt.Sprintf("%s.%s", s.Name, r.Sym.Name)
|
||||
|
||||
stub = ld.Linklookup(ld.Ctxt, n, 0)
|
||||
stub := ld.Linklookup(ld.Ctxt, n, 0)
|
||||
if s.Attr.Reachable() {
|
||||
stub.Attr |= ld.AttrReachable
|
||||
}
|
||||
@ -135,7 +127,7 @@ func genplt() {
|
||||
|
||||
// Restore TOC after bl. The compiler put a
|
||||
// nop here for us to overwrite.
|
||||
o1 = 0xe8410018 // ld r2,24(r1)
|
||||
const o1 = 0xe8410018 // ld r2,24(r1)
|
||||
ld.Ctxt.Arch.ByteOrder.PutUint32(s.P[r.Off+4:], o1)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user