]> Cypherpunks repositories - gostls13.git/commit
cmd/asm,cmd/internal/obj/riscv,cmd/link: improve TLS handling on riscv64
authorJoel Sing <joel@sing.id.au>
Thu, 15 Sep 2022 16:29:12 +0000 (02:29 +1000)
committerJoel Sing <joel@sing.id.au>
Thu, 3 Aug 2023 16:15:14 +0000 (16:15 +0000)
commit9ff01162295c815c252dec812f6ce983aa90a62b
tree5d0f0eb023841479264959471b96fb7a59dee431
parentb7c826d2c4576dbe04a79ab7d0dfa03c722c0ab9
cmd/asm,cmd/internal/obj/riscv,cmd/link: improve TLS handling on riscv64

The existing Thread Local Storage (TLS) implementation for riscv64 uses
initial-exec (IE) mode, however a MOV of a TLS symbol currently loads the
thread pointer offset and not the actual address or memory location.

Rework TLS on riscv64 to generate the full instruction sequence needed to
load from or store to a TLS symbol. Additionally, provide support for both
initial-exec (IE) and local-exec (LE) TLS - in many cases we can use LE,
which is slightly more efficient and easier to support in the linker.

Change-Id: I1b43f8888b3b6b10354bbb79d604771e64d92645
Reviewed-on: https://go-review.googlesource.com/c/go/+/431103
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: M Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
src/cmd/asm/internal/asm/endtoend_test.go
src/cmd/asm/internal/asm/testdata/riscv64.s
src/cmd/internal/obj/riscv/obj.go
src/cmd/internal/objabi/reloctype.go
src/cmd/internal/objabi/reloctype_string.go
src/cmd/link/internal/riscv64/asm.go
src/runtime/tls_riscv64.s