Skip to content

Commit b0272d8

Browse files
[libc] Fix set_thread_ptr call in rv32 start up code
This patch changes the instruction in set_thread_ptr from ld to mv, as rv32 doesn't have the ld instruction, and mv is supported by both rv32 and rv64. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D159110
1 parent 36c9afc commit b0272d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/startup/linux/riscv64/start.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void cleanup_tls(uintptr_t addr, uintptr_t size) {
8080
}
8181

8282
static void set_thread_ptr(uintptr_t val) {
83-
LIBC_INLINE_ASM("ld tp, %0\n\t" : : "m"(val));
83+
LIBC_INLINE_ASM("mv tp, %0\n\t" : : "r"(val));
8484
}
8585

8686
using InitCallback = void(int, char **, char **);

0 commit comments

Comments
 (0)