@@ -104,6 +104,7 @@ DllMain(
104104#if defined(HAVE_NO_SEH ) && !defined(__aarch64__ )
105105 TCLEXCEPTION_REGISTRATION registration ;
106106#endif
107+ (void )reserved ;
107108
108109 /*
109110 * If we are attaching to the DLL from a new process, tell Tk about the
@@ -148,13 +149,21 @@ DllMain(
148149
149150 "movq %%rdx, %%gs:0" "\n\t"
150151
151- /*
152- * Call TkFinalize
153- */
152+ :
153+ /* No outputs */
154+ :
155+ [registration ] "m" (registration ),
156+ [error ] "i" (TCL_ERROR )
157+ :
158+ "%rax" , "%rdx" , "memory"
159+ );
154160
155- "movq $0x0, 0x0(%%rsp)" "\n\t"
156- "call TkFinalize" "\n\t"
161+ /* Just do a regular C call so we don't need to worry about following
162+ * the calling convention, specially the registers the function may
163+ * clobber: */
164+ TkFinalize (NULL );
157165
166+ __asm__ __volatile__ (
158167 /*
159168 * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION
160169 * and store a TCL_OK status
@@ -188,11 +197,9 @@ DllMain(
188197 :
189198 /* No outputs */
190199 :
191- [registration ] "m" (registration ),
192- [ok ] "i" (TCL_OK ),
193- [error ] "i" (TCL_ERROR )
200+ [ok ] "i" (TCL_OK )
194201 :
195- "%rax" , "%rbx" , "%rcx" , "% rdx" , "%rsi" , "%rdi " , "memory"
202+ "%rax" , "%rdx" , "%rbp " , "memory"
196203 );
197204
198205# else
@@ -218,12 +225,18 @@ DllMain(
218225
219226 "movl %%edx, %%fs:0" "\n\t"
220227
221- /*
222- * Call TkFinalize
223- */
228+ :
229+ /* No outputs */
230+ :
231+ [registration ] "m" (registration ),
232+ [error ] "i" (TCL_ERROR )
233+ :
234+ "%eax" , "%ebx" , "%edx" , "memory"
235+ );
236+
237+ TkFinalize (NULL );
224238
225- "movl $0x0, 0x0(%%esp)" "\n\t"
226- "call _TkFinalize" "\n\t"
239+ __asm__ __volatile__ (
227240
228241 /*
229242 * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION
@@ -259,11 +272,9 @@ DllMain(
259272 :
260273 /* No outputs */
261274 :
262- [registration ] "m" (registration ),
263- [ok ] "i" (TCL_OK ),
264- [error ] "i" (TCL_ERROR )
275+ [ok ] "i" (TCL_OK )
265276 :
266- "%eax" , "%ebx" , "%ecx" , "% edx" , "%esi" , "%edi " , "memory"
277+ "%eax" , "%ebx" , "%edx" , "%ebp " , "memory"
267278 );
268279
269280# endif
0 commit comments