Skip to content

Commit

Permalink
Clarify TLS descriptor calling convention.
Browse files Browse the repository at this point in the history
Make it clear that vector registers are callee-saved.
  • Loading branch information
ishitatsuyuki committed May 22, 2023
1 parent 2e72e56 commit 7ff7a09
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions riscv-elf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,11 @@ Up to 3 `unsigned long` may be stored inline within the descriptor. Dynamic link
implementations may use this to avoid a separate allocation to store data associated
with the symbol.

The TLS descriptor `resolver` is called with a special calling convention where all
registers all callee-saved, except `a0` which is used to pass the argument and `t0`
which is used as the alternate link register.
The TLS descriptor `resolver` is called with a special calling convention, specified as follows:

- `a0` is used to pass the argument and return value.
- `t0` is used as the link register.
- Any other registers are callee-saved. This includes any vector registers when the vector extension is supported.

Example assembler load and store of a thread local variable `i` using the `%tlsdesc_hi`, `%tlsdesc_lo_add`, `%tlsdesc_lo_load` assembler functions and `.tlsdesc_call` assembler directive. The emitted relocations are in the comments.

Expand Down

0 comments on commit 7ff7a09

Please sign in to comment.