From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: [musl] Draft riscv64 TLSDESC implementation
Date: Tue, 22 Aug 2023 13:38:21 -0400 [thread overview]
Message-ID: <20230822173821.GW4163@brightrain.aerifal.cx> (raw)
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
The psABI work is not finalized, but based on the current status of
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373, I think
the attached is a valid (but untested) implementation of TLSDESC for
riscv64. Actually activating it requires also adding the relocation
type macro to riscv64/reloc.h.
If any rv folks could look it over and make sure I haven't made any
stupid asm errors or missed any obvious optimizations, that would help
to quickly get this merged when the psABI is finalized.
Rich
[-- Attachment #2: tlsdesc.s --]
[-- Type: text/plain, Size: 590 bytes --]
.text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,%function
__tlsdesc_static:
ld a0,8(a0)
jr t0
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic
.type __tlsdesc_dynamic,%function
__tlsdesc_dynamic:
add sp,sp,-8
sd t1,(sp)
sd t2,8(sp)
ld t2,-8(tp) # t2=dtv
ld a0,8(a0) # a0=&{modidx,off}
ld t1,8(a0) # t1=off
ld a0,(a0) # a0=modidx
sll a0,a0,3 # a0=8*modidx
add a0,a0,t2 # a0=dtv+8*modidx
ld a0,(a0) # a0=dtv[modidx]
add a0,a0,t1 # a0=dtv[modidx]+off
sub a0,a0,tp # a0=dtv[modidx]+off-tp
ld t1,(sp)
ld t2,8(sp)
add sp,sp,8
jr t0
reply other threads:[~2023-08-22 17:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230822173821.GW4163@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).