]> Cypherpunks repositories - gostls13.git/commit
cmd/link/internal/arm: fix off-by-1 in trampoline reachability computation
authorThan McIntosh <thanm@google.com>
Mon, 13 Mar 2023 16:02:36 +0000 (12:02 -0400)
committerThan McIntosh <thanm@google.com>
Wed, 15 Mar 2023 17:32:28 +0000 (17:32 +0000)
commitf26bf203ac67fd917f2eb992baa1cb2d01edf3c8
tree299f88e1de9a6291a083cb64b59690e099d7c93d
parentf5eef58e4381259cbd84b3f2074c79607fb5c821
cmd/link/internal/arm: fix off-by-1 in trampoline reachability computation

Tweak the code in trampoline generation that determines if a given
call branch will reach, changing the lower limit guard from "x <
-0x800000" to "x <= -0x800000". This is to resolve linking failures
when the computed displacement is exactly -0x800000, which results in
errors of the form

  .../ld.gold: internal error in arm_branch_common, at ../../gold/arm.cc:4079

when using the Gold linker, and

  ...:(.text+0x...): relocation truncated to fit: R_ARM_CALL against `runtime.morestack_noctxt'

when using the bfd linker.

Fixes #59034.
Updates #58425.

Change-Id: I8a76986b38727df1b961654824c2af23f06b9fcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/475957
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/arm/asm.go