get_tp.s (436B)
1 /* tcc-build riscv64 thread-pointer reader. 2 * 3 * Returns `tp` (x4) in a0. Stock musl spells this as inline asm with 4 * an output operand; tcc 0.9.26 has no riscv64 inline-asm operand 5 * path. tcc-asm has `mv` and `jalr`; it lacks the `ret` pseudo, so 6 * the canonical `jalr zero, ra, 0` form is used (matches tcc-libc/ 7 * riscv64/sys_stubs.S). 8 */ 9 10 .global __get_tp 11 .type __get_tp, %function 12 __get_tp: 13 mv a0, tp 14 jalr zero, ra, 0