]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/internal/obj/riscv: fix trampoline calls from large functions
authorJoel Sing <joel@sing.id.au>
Fri, 15 Oct 2021 16:59:41 +0000 (03:59 +1100)
committerJoel Sing <joel@sing.id.au>
Tue, 19 Oct 2021 11:52:34 +0000 (11:52 +0000)
commitbde0463da3f31934791b0bb2ccacdf6206314073
treeec3cb0594eac99f4da7e8ed0cf2f9c0ed4fc81f2
parentb0351bfd7d5f0d367c27aa07789b2e6317442ece
cmd/internal/obj/riscv: fix trampoline calls from large functions

On riscv64, the JAL instruction is only capable of reaching +/-1MB. In the case where
a single function and its trampolines exceeds this size, it is possible that the JAL
is unable to reach the trampoline, which is laid down after the function text. In the
case of large functions, switch back to using a AUIPC+JALR pairs rather than using
trampolines.

Fixes #48791

Change-Id: I119cf3bc20ce4933a9b7ab41a8e514437c6addb9
Reviewed-on: https://go-review.googlesource.com/c/go/+/356250
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/internal/obj/riscv/asm_test.go
src/cmd/internal/obj/riscv/obj.go