# HG changeset patch # User Tassilo Philipp # Date 1633282901 -7200 # Node ID 15698dc0cba394be8a099c2847f8cbe9a45d2f92 # Parent 5387564a1096f1745cfc4f8ece18bf0571ae5a6f - regression fix: return values were broken on some arm32-thumb targets diff -r 5387564a1096 -r 15698dc0cba3 ChangeLog --- 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 diff -r 5387564a1096 -r 15698dc0cba3 dyncall/dyncall_callvm_arm32_thumb.c --- 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