[libc-commits] [PATCH] D151539: [libc] Initiliaze the global pointer in riscv startup code.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 30 14:03:40 PDT 2023


sivachandra updated this revision to Diff 526784.
sivachandra added a comment.

Update as per the suggestion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151539/new/

https://reviews.llvm.org/D151539

Files:
  libc/startup/linux/riscv64/start.cpp


Index: libc/startup/linux/riscv64/start.cpp
===================================================================
--- libc/startup/linux/riscv64/start.cpp
+++ libc/startup/linux/riscv64/start.cpp
@@ -123,6 +123,10 @@
 };
 
 __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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151539.526784.patch
Type: text/x-patch
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230530/fa9da802/attachment.bin>


More information about the libc-commits mailing list