diff options
author | Siva Chandra <sivachandra@google.com> | 2023-05-26 08:08:46 +0000 |
---|---|---|
committer | Siva Chandra <sivachandra@google.com> | 2023-07-05 07:32:31 +0000 |
commit | 3db36d6a9b57d4ab8f68e4a31368f8b7bf64167c (patch) | |
tree | 61637b491b42a320bd00072861d28cc4d63d46c5 /libc/startup | |
parent | 8c6aea6c5662e48526cf575f7163a5830abd1d43 (diff) | |
download | llvm-3db36d6a9b57d4ab8f68e4a31368f8b7bf64167c.zip llvm-3db36d6a9b57d4ab8f68e4a31368f8b7bf64167c.tar.gz llvm-3db36d6a9b57d4ab8f68e4a31368f8b7bf64167c.tar.bz2 |
[libc] Initiliaze the global pointer in riscv startup code.
Reviewed By: mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D151539
Diffstat (limited to 'libc/startup')
-rw-r--r-- | libc/startup/linux/riscv64/start.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp index 80e7d3f1..67aa3e6 100644 --- a/libc/startup/linux/riscv64/start.cpp +++ b/libc/startup/linux/riscv64/start.cpp @@ -123,6 +123,10 @@ struct AuxEntry { }; __attribute__((noinline)) static void do_start() { + LIBC_INLINE_ASM(".option push\n\t" + ".option norelax\n\t" + "lla gp, __global_pointer$\n\t" + ".option pop\n\t"); auto tid = __llvm_libc::syscall_impl(SYS_gettid); if (tid <= 0) __llvm_libc::syscall_impl(SYS_exit, 1); |