Skip to content

Commit

Permalink
[libc] Fix set_thread_ptr call in rv32 start up code
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mikhailramalho committed Aug 30, 2023
1 parent 36c9afc commit b0272d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libc/startup/linux/riscv64/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void cleanup_tls(uintptr_t addr, uintptr_t size) {
}

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

using InitCallback = void(int, char **, char **);
Expand Down

0 comments on commit b0272d8

Please sign in to comment.