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