From 4cb564bc99c22f8d18ae24063a55d3e61f63bce6 Mon Sep 17 00:00:00 2001
From: Ivan Tan <ivantan1524@gmail.com>
Date: Fri, 7 Jul 2023 18:58:42 +0800
Subject: [PATCH] aarch64: align sp in _start

---
 src/crt0/src/lib.rs  | 1 +
 src/ld_so/src/lib.rs | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/crt0/src/lib.rs b/src/crt0/src/lib.rs
index c4ad4072b..3b0595da8 100644
--- a/src/crt0/src/lib.rs
+++ b/src/crt0/src/lib.rs
@@ -11,6 +11,7 @@ global_asm!(
     .globl _start
 _start:
     mov x0, sp
+    and sp, x0, #0xfffffffffffffff0 //align sp
     bl relibc_start
 "
 );
diff --git a/src/ld_so/src/lib.rs b/src/ld_so/src/lib.rs
index 748f337da..863660964 100644
--- a/src/ld_so/src/lib.rs
+++ b/src/ld_so/src/lib.rs
@@ -9,6 +9,7 @@ global_asm!(
 .globl _start
 _start:
     mov x0, sp
+    and sp, x0, #0xfffffffffffffff0 //align sp
     bl relibc_ld_so_start
     # TODO: aarch64
     udf #0
-- 
GitLab