diff --git a/libc/platform/bionic/tls.h b/libc/platform/bionic/tls.h index bf9e65b5e..e01eccd74 100644 --- a/libc/platform/bionic/tls.h +++ b/libc/platform/bionic/tls.h @@ -34,6 +34,8 @@ # define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; }) #elif defined(__i386__) # define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; }) +#elif defined(__riscv) +# define __get_tls() ({ void** __val; __asm__("mv %0, tp" : "=r"(__val)); __val; }) #elif defined(__x86_64__) # define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; }) #else