"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/cmd/link/internal/ppc64/asm.go" between
go1.16.4.src.tar.gz and go1.16.5.src.tar.gz

About: Google’s Go is a compiled, garbage-collected, concurrent programming language. Latest stable release (1.16).

asm.go  (go1.16.4.src):asm.go  (go1.16.5.src)
skipping to change at line 645 skipping to change at line 645
default: default:
return -1 return -1
} }
if target.IsBigEndian() { if target.IsBigEndian() {
return int64(o1)<<32 | int64(o2) return int64(o1)<<32 | int64(o2)
} }
return int64(o2)<<32 | int64(o1) return int64(o2)<<32 | int64(o1)
} }
// Determine if the code was compiled so that the TOC register R2 is initialized
and maintained
func r2Valid(ctxt *ld.Link) bool {
switch ctxt.BuildMode {
case ld.BuildModeCArchive, ld.BuildModeCShared, ld.BuildModePIE, ld.Build
ModeShared, ld.BuildModePlugin:
return true
}
// -linkshared option
return ctxt.IsSharedGoLink()
}
// resolve direct jump relocation r in s, and add trampoline if necessary // resolve direct jump relocation r in s, and add trampoline if necessary
func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
// Trampolines are created if the branch offset is too large and the link er cannot insert a call stub to handle it. // Trampolines are created if the branch offset is too large and the link er cannot insert a call stub to handle it.
// For internal linking, trampolines are always created for long calls. // For internal linking, trampolines are always created for long calls.
// For external linking, the linker can insert a call stub to handle a lo ng call, but depends on having the TOC address in // For external linking, the linker can insert a call stub to handle a lo ng call, but depends on having the TOC address in
// r2. For those build modes with external linking where the TOC address is not maintained in r2, trampolines must be created. // r2. For those build modes with external linking where the TOC address is not maintained in r2, trampolines must be created.
if ctxt.IsExternal() && (ctxt.DynlinkingGo() || ctxt.BuildMode == ld.Buil dModeCArchive || ctxt.BuildMode == ld.BuildModeCShared || ctxt.BuildMode == ld.B uildModePIE) { if ctxt.IsExternal() && r2Valid(ctxt) {
// No trampolines needed since r2 contains the TOC // No trampolines needed since r2 contains the TOC
return return
} }
relocs := ldr.Relocs(s) relocs := ldr.Relocs(s)
r := relocs.At(ri) r := relocs.At(ri)
var t int64 var t int64
// ldr.SymValue(rs) == 0 indicates a cross-package jump to a function tha t is not yet // ldr.SymValue(rs) == 0 indicates a cross-package jump to a function tha t is not yet
// laid out. Conservatively use a trampoline. This should be rare, as we lay out packages // laid out. Conservatively use a trampoline. This should be rare, as we lay out packages
// in dependency order. // in dependency order.
skipping to change at line 706 skipping to change at line 716
t = ldr.SymValue(tramp) + r.Add() - (ldr.SymValue (s) + int64(r.Off())) t = ldr.SymValue(tramp) + r.Add() - (ldr.SymValue (s) + int64(r.Off()))
// With internal linking, the trampoline can be u sed if it is not too far. // With internal linking, the trampoline can be u sed if it is not too far.
// With external linking, the trampoline must be in this section for it to be reused. // With external linking, the trampoline must be in this section for it to be reused.
if (ctxt.IsInternal() && int64(int32(t<<6)>>6) == t) || (ctxt.IsExternal() && ldr.SymSect(s) == ldr.SymSect(tramp)) { if (ctxt.IsInternal() && int64(int32(t<<6)>>6) == t) || (ctxt.IsExternal() && ldr.SymSect(s) == ldr.SymSect(tramp)) {
break break
} }
} }
if ldr.SymType(tramp) == 0 { if ldr.SymType(tramp) == 0 {
if ctxt.DynlinkingGo() || ctxt.BuildMode == ld.Bu ildModeCArchive || ctxt.BuildMode == ld.BuildModeCShared || ctxt.BuildMode == ld .BuildModePIE { if r2Valid(ctxt) {
// Should have returned for above cases // Should have returned for above cases
ctxt.Errorf(s, "unexpected trampoline for shared or dynamic linking") ctxt.Errorf(s, "unexpected trampoline for shared or dynamic linking")
} else { } else {
trampb := ldr.MakeSymbolUpdater(tramp) trampb := ldr.MakeSymbolUpdater(tramp)
ctxt.AddTramp(trampb) ctxt.AddTramp(trampb)
gentramp(ctxt, ldr, trampb, rs, r.Add()) gentramp(ctxt, ldr, trampb, rs, r.Add())
} }
} }
sb := ldr.MakeSymbolUpdater(s) sb := ldr.MakeSymbolUpdater(s)
relocs := sb.Relocs() relocs := sb.Relocs()
 End of changes. 3 change blocks. 
2 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)