changeset 364:3bdd326dc269

- Todo entries - some clarifications in code about GNU thiscalls (which are effectively idential to cdecl calls) * took away own mode identifier, as aliasing to cdecl now - cleanups
author Tassilo Philipp
date Tue, 14 Apr 2020 19:35:30 +0200
parents 3ff4a4ba7f0e
children 1d03a3a4220d
files ToDo doc/manual/manual_dyncall_api.tex dyncall/dyncall.h dyncall/dyncall_signature.h dyncallback/dyncall_callback_x86.c
diffstat 5 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ToDo	Tue Apr 14 17:47:33 2020 +0200
+++ b/ToDo	Tue Apr 14 19:35:30 2020 +0200
@@ -1,5 +1,9 @@
 1.2:
 ----
+- test atpcs thumb on arm and verify if ellipsis and C++ thiscalls work, if so adapt doc appendix
+- test eabi thumb on arm and verify if ellipsis and C++ thiscalls work, if so adapt doc appendix
+- new platform matrix
+  * check dark green cells and validate in general
 - openbsd-4.0-* test/resolve_self fails, but unsure why. dlopen correctly returns RTLD_DEFAULT, which
   should lookup via dlsym the function in the object itself, but cannot. So... some compiler flag might
   be missing to keep symbol names, or some prefixing happens
@@ -15,6 +19,7 @@
   prototype exist (e.g. just calling some pointer), without any declaration... even possible in C, as one has
   to cast to the function type? need to support?
 
+- dyncall sparc v7/v8: -xO3 on SunPro segfaults in tests (observed years ago)
 
 - dyncallback's "stack_cleanup" can be removed from non x86 impls... test if they still work
 - target a minimum c version, for use with -pedantic, etc.? Right now we use e.g. extensions
@@ -60,6 +65,12 @@
 
 dyncall:
 --------
+- callbacks and use of CC signature characters (only x86 has any support for different CCs for callbacks):
+  * support for arm (arm/thumb on same platform)
+  * check if ellipsis support is needed (is there any need for calling back into an ellipse function?)
+  * check if syscalls support is needed (is there any need for calling back into a syscall?)
+- think about using 'inline' for all/most dyncall_api.c functions?
+- support for where syscalls originate from on OpenBSD: http://undeadly.org/cgi?action=article;sid=20191202105849
 - merge arm32_thumb_{gas/apple} and include thumb support for portasm
 - x64 verification: return values are passed via RAX and RDX, and XMM0 and XMM1.
 - find big endian arm box (also hardfloat), e.g. cubietruck: http://blog.netbsd.org/tnf/entry/working_arm_multiprocessor_support
--- a/doc/manual/manual_dyncall_api.tex	Tue Apr 14 17:47:33 2020 +0200
+++ b/doc/manual/manual_dyncall_api.tex	Tue Apr 14 19:35:30 2020 +0200
@@ -162,7 +162,7 @@
 \lstinline@DC_CALL_C_X86_WIN32_FAST_MS@  & C x86 Windows Microsoft fast call\\
 \lstinline@DC_CALL_C_X86_WIN32_FAST_GNU@ & C x86 Windows GCC fast call\\
 \lstinline@DC_CALL_C_X86_WIN32_THIS_MS@  & C x86 Windows Microsoft this call\\
-\lstinline@DC_CALL_C_X86_WIN32_THIS_GNU@ & C x86 Windows GCC this call\\
+\lstinline@DC_CALL_C_X86_WIN32_THIS_GNU@ & C x86 Windows GCC this call (identical to CDECL w/ this-ptr as 1st arg)\\
 \lstinline@DC_CALL_C_X86_PLAN9@          & C x86 Plan9 call\\
 \lstinline@DC_CALL_C_X64_WIN64@          & C x64 Windows standard call\\
 \lstinline@DC_CALL_C_X64_SYSV@           & C x64 System V standard call\\
--- a/dyncall/dyncall.h	Tue Apr 14 17:47:33 2020 +0200
+++ b/dyncall/dyncall.h	Tue Apr 14 19:35:30 2020 +0200
@@ -58,7 +58,7 @@
 #define DC_CALL_C_X86_WIN32_FAST_MS     3
 #define DC_CALL_C_X86_WIN32_FAST_GNU    4
 #define DC_CALL_C_X86_WIN32_THIS_MS     5
-#define DC_CALL_C_X86_WIN32_THIS_GNU    6
+#define DC_CALL_C_X86_WIN32_THIS_GNU    DC_CALL_C_X86_CDECL /* alias - identical to cdecl (w/ this-ptr as 1st arg) */
 #define DC_CALL_C_X64_WIN64             7
 #define DC_CALL_C_X64_SYSV              8
 #define DC_CALL_C_PPC32_DARWIN          9
--- a/dyncall/dyncall_signature.h	Tue Apr 14 17:47:33 2020 +0200
+++ b/dyncall/dyncall_signature.h	Tue Apr 14 19:35:30 2020 +0200
@@ -70,7 +70,7 @@
 #define DC_SIGCHAR_CC_FASTCALL_MS      'F'
 #define DC_SIGCHAR_CC_FASTCALL_GNU     'f'
 #define DC_SIGCHAR_CC_THISCALL_MS      '+'
-#define DC_SIGCHAR_CC_THISCALL_GNU     '#'
+#define DC_SIGCHAR_CC_THISCALL_GNU     '#' /* GNU thiscalls are cdecl, but keep specific sig char for clarity */
 #define DC_SIGCHAR_CC_ARM_ARM          'A'
 #define DC_SIGCHAR_CC_ARM_THUMB        'a'
 #define DC_SIGCHAR_CC_SYSCALL          '$'
--- a/dyncallback/dyncall_callback_x86.c	Tue Apr 14 17:47:33 2020 +0200
+++ b/dyncallback/dyncall_callback_x86.c	Tue Apr 14 19:35:30 2020 +0200
@@ -6,7 +6,7 @@
  Description: Callback - Implementation for x86
  License:
 
-   Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
+   Copyright (c) 2007-2020 Daniel Adler <dadler@uni-goettingen.de>,
                            Tassilo Philipp <tphilipp@potion-studios.com>
 
    Permission to use, copy, modify, and distribute this software for any
@@ -204,14 +204,12 @@
     ch = *ptr++;
     switch(ch) {
       case DC_SIGCHAR_CC_DEFAULT:      mode = DC_CALL_C_DEFAULT;            break;
-	  /*@@@ add ellipsis?*/
+      case DC_SIGCHAR_CC_THISCALL_GNU: // == cdecl
       case DC_SIGCHAR_CC_CDECL:        mode = DC_CALL_C_X86_CDECL;          break;
       case DC_SIGCHAR_CC_STDCALL:      mode = DC_CALL_C_X86_WIN32_STD;      break;
       case DC_SIGCHAR_CC_FASTCALL_MS:  mode = DC_CALL_C_X86_WIN32_FAST_MS;  break;
       case DC_SIGCHAR_CC_FASTCALL_GNU: mode = DC_CALL_C_X86_WIN32_FAST_GNU; break;
       case DC_SIGCHAR_CC_THISCALL_MS:  mode = DC_CALL_C_X86_WIN32_THIS_MS;  break;
-      case DC_SIGCHAR_CC_THISCALL_GNU: mode = DC_CALL_C_X86_WIN32_THIS_GNU; break;
-      case DC_SIGCHAR_CC_SYSCALL:      mode = DC_CALL_SYS_DEFAULT;          break;
     }
   }
 
@@ -226,10 +224,6 @@
       pcb->args_vt = &dcArgsVT_default;
       pcb->stack_cleanup = dcbCleanupSize_x86_std(ptr);
       break;
-    case DC_CALL_C_X86_WIN32_THIS_MS:
-      pcb->args_vt = &dcArgsVT_this_ms;
-      pcb->stack_cleanup = dcbCleanupSize_x86_this_ms(ptr);
-      break;
     case DC_CALL_C_X86_WIN32_FAST_MS:
       pcb->args_vt = &dcArgsVT_fast_ms;
       pcb->stack_cleanup = dcbCleanupSize_x86_fast_ms(ptr);
@@ -238,6 +232,10 @@
       pcb->args_vt = &dcArgsVT_fast_gnu;
       pcb->stack_cleanup = dcbCleanupSize_x86_fast_gnu(ptr);
       break;
+    case DC_CALL_C_X86_WIN32_THIS_MS:
+      pcb->args_vt = &dcArgsVT_this_ms;
+      pcb->stack_cleanup = dcbCleanupSize_x86_this_ms(ptr);
+      break;
   }
 
 #if defined(DC_PLAN9)