changeset 409:15698dc0cba3

- regression fix: return values were broken on some arm32-thumb targets
author Tassilo Philipp
date Sun, 03 Oct 2021 19:41:41 +0200
parents 5387564a1096
children 7608e34098b0
files ChangeLog dyncall/dyncall_callvm_arm32_thumb.c
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 03 12:27:06 2021 +0200
+++ b/ChangeLog	Sun Oct 03 19:41:41 2021 +0200
@@ -7,6 +7,7 @@
   o Haiku/x86 build fix
   o dynload fix for PE files that do not contain a symbol export directory (thanks Ashok!)
 dyncall:
+  o fixed broken return values w/ arm32/thumb mode (only affected some platforms)
   o build fix when using clang's integrated assembler on arm32 hard-float platforms
 dyncallback:
   o build fix when using clang's integrated assembler on arm32 hard-float platforms
--- a/dyncall/dyncall_callvm_arm32_thumb.c	Sun Oct 03 12:27:06 2021 +0200
+++ b/dyncall/dyncall_callvm_arm32_thumb.c	Sun Oct 03 19:41:41 2021 +0200
@@ -46,16 +46,23 @@
 **
 ** - hybrid return-type call (bool ... pointer)
 **
-** Note the return type of this declaration is intentially of double-word size (despite
-** the return value not being used in the code below).
-** On some platforms (FreeBSD/arm, Nintendo DS, ...) the compiler generates cleanup code
-** in the caller (dc_callvm_call_arm32_thumb) that reuses, thus overwrites r0 and r1.
+** Note: return types of this decl and func below are of double-word size, intentionally
+** to keep some platforms' compilers from generating code in the callers that reuse, and
+** thus overwrite, r0 and r1 directly after the call.
 ** With this "hint", we preserve those registers by letting the compiler assume both
 ** registers are used for the return type.
 */
 DClonglong dcCall_arm32_thumb(DCpointer target, DCpointer stackdata, DCsize size);
 
 
+/* Call. */
+DClonglong dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target)
+{
+  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
+  return dcCall_arm32_thumb(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
+}
+
+
 static void dc_callvm_mode_arm32_thumb(DCCallVM* in_self,DCint mode);
 
 static void dc_callvm_free_arm32_thumb(DCCallVM* in_self)
@@ -150,14 +157,6 @@
 }
 
 
-/* Call. */
-void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target)
-{
-  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
-  dcCall_arm32_thumb(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
-}
-
-
 DCCallVM_vt gVT_arm32_thumb =
 {
   &dc_callvm_free_arm32_thumb