From 41b658386efad9d3023a023e3b4bfaf5f814250d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=AF=E6=B4=84?= <1840686745@qq.com>
Date: Thu, 26 Aug 2021 03:53:25 +0800
Subject: [PATCH] Fix StackOverflowError on ARM (#2)

---
 src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
index ff462ad27..f0314a729 100644
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
@@ -85,8 +85,14 @@
 #endif
 
 address os::current_stack_pointer() {
+#if defined(__clang__) || defined(__llvm__)
+  void *sp;
+  __asm__("mov %0, " SPELL_REG_SP : "=r"(sp));
+  return (address) sp;
+#else
   register address sp __asm__ (SPELL_REG_SP);
   return sp;
+#endif
 }
 
 char* os::non_memory_address_word() {
-- 
2.30.2

