From: Lynn Boger Date: Fri, 4 Nov 2016 19:53:59 +0000 (-0500) Subject: cmd/link: don't use trampolines in ppc64le ext linking X-Git-Tag: go1.8beta1~285 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ec77b8e09cace7338ebc39faadd599e5cb676295;p=gostls13.git cmd/link: don't use trampolines in ppc64le ext linking On ppc64x, trampolines are used to resolve too-far branches for internal linking. The external linking, solution on ppc64x is to split text sections when they get too large, allowing the external linker to handle the long branches. On arm trampolines are generanted for too-far branches for internal and external linking. When the change was made recently to enable trampolines for external linking on arm, that broke the ppc64x fix for too-far branches with external linking. The fix adds a check to use trampolines only for internal linking with ppc64x. Fixes #17795 Change-Id: Icce968fb96545f10a913e07654514643bce96261 Reviewed-on: https://go-review.googlesource.com/32853 Run-TryBot: Lynn Boger Run-TryBot: Cherry Zhang TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang Reviewed-by: David Chase --- diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 5197cb99b4..7dff9baaea 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -325,12 +325,17 @@ func isRuntimeDepPkg(pkg string) bool { } // detect too-far jumps in function s, and add trampolines if necessary -// (currently only ARM supports trampoline insertion) +// ARM supports trampoline insertion for internal and external linking +// PPC64 & PPC64LE support trampoline insertion for internal linking only func trampoline(ctxt *Link, s *Symbol) { if Thearch.Trampoline == nil { return // no need or no support of trampolines on this arch } + if Linkmode == LinkExternal && SysArch.Family == sys.PPC64 { + return + } + for ri := range s.R { r := &s.R[ri] if !r.Type.IsDirectJump() {