From c1a3d8f4705c50c88ad018e64d1b332e4104dd14 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Thu, 22 Aug 2019 15:12:52 +0100 Subject: [PATCH] Fix stack resetting for objc_msgSend on ARM. If we called into C to find the IMP (e.g. for forwarding), we were then reloading all of the arguments but failing to adjust the stack pointer by the correct amount, leaving it around 192 bytes offset from its correct location. This, unsurprisingly, led to crashing and other exciting behaviour. --- objc_msgSend.aarch64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objc_msgSend.aarch64.S b/objc_msgSend.aarch64.S index 31b6b52..6d0b327 100644 --- a/objc_msgSend.aarch64.S +++ b/objc_msgSend.aarch64.S @@ -76,7 +76,7 @@ ldp q4, q5, [sp, #144] ldp q6, q7, [sp, #176] ldp fp, lr, [sp, #208] - ldp \receiver, x8, [sp], #16 + ldp \receiver, x8, [sp], #(ARGUMENT_SPILL_SIZE + 16) br x9 6: adr x10, SmallObjectClasses