Skip to content

Commit

Permalink
msvcrt: Import longjmp from ntdll for PE builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
julliard committed Mar 8, 2024
1 parent d538432 commit c51c257
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 87 deletions.
2 changes: 1 addition & 1 deletion dlls/crtdll/crtdll.spec
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
@ cdecl -arch=win64 localtime(ptr) _localtime64
@ cdecl log(double)
@ cdecl log10(double)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbstowcs(ptr str long)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr100/msvcr100.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -1739,7 +1739,7 @@
@ cdecl -arch=!i386 logf(float)
@ cdecl log10(double)
@ cdecl -arch=!i386 log10f(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbrlen(ptr long ptr)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr110/msvcr110.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -2097,7 +2097,7 @@
@ cdecl -arch=!i386 logf(float)
@ cdecl log10(double)
@ cdecl -arch=!i386 log10f(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbrlen(ptr long ptr)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr120/msvcr120.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -2269,7 +2269,7 @@
@ cdecl logb(double)
@ cdecl logbf(float)
@ cdecl logbl(double) logb
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl lrint(double)
@ cdecl lrintf(float)
@ cdecl lrintl(double) lrint
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr70/msvcr70.spec
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -780,7 +780,7 @@
@ cdecl -arch=win64 localtime(ptr) _localtime64
@ cdecl log(double)
@ cdecl log10(double)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbstowcs(ptr str long)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr71/msvcr71.spec
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -776,7 +776,7 @@
@ cdecl -arch=win64 localtime(ptr) _localtime64
@ cdecl log(double)
@ cdecl log10(double)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbstowcs(ptr str long)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr80/msvcr80.spec
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -1420,7 +1420,7 @@
@ cdecl -arch=!i386 logf(float)
@ cdecl log10(double)
@ cdecl -arch=!i386 log10f(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbrlen(ptr long ptr)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcr90/msvcr90.spec
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -1392,7 +1392,7 @@
@ cdecl log10(double)
@ cdecl -arch=!i386 log10f(float)
@ cdecl -arch=!i386 logf(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbrlen(ptr long ptr)
Expand Down
21 changes: 0 additions & 21 deletions dlls/msvcrt/except_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,6 @@ unsigned int CDECL __CxxQueryExceptionSize(void)
}


/*******************************************************************
* longjmp (MSVCRT.@)
*/
void __cdecl MSVCRT_longjmp(_JUMP_BUFFER *jmp, int retval)
{
EXCEPTION_RECORD rec;

if (!retval) retval = 1;
if (jmp->Frame)
{
rec.ExceptionCode = STATUS_LONGJUMP;
rec.ExceptionFlags = 0;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = NULL;
rec.NumberParameters = 1;
rec.ExceptionInformation[0] = (DWORD_PTR)jmp;
RtlUnwind((void *)jmp->Frame, (void *)jmp->Pc, &rec, IntToPtr(retval));
}
__wine_longjmp( (__wine_jmp_buf *)jmp, retval );
}

/*********************************************************************
* _fpieee_flt (MSVCRT.@)
*/
Expand Down
20 changes: 0 additions & 20 deletions dlls/msvcrt/except_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,6 @@ unsigned int CDECL __CxxQueryExceptionSize(void)
*/
__ASM_GLOBAL_FUNC( _setjmp, "b _setjmpex" );

/*******************************************************************
* longjmp (MSVCRT.@)
*/
void __cdecl MSVCRT_longjmp(_JUMP_BUFFER *jmp, int retval)
{
EXCEPTION_RECORD rec;

if (!retval) retval = 1;
if (jmp->Frame)
{
rec.ExceptionCode = STATUS_LONGJUMP;
rec.ExceptionFlags = 0;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = NULL;
rec.NumberParameters = 1;
rec.ExceptionInformation[0] = (DWORD_PTR)jmp;
RtlUnwind((void *)jmp->Frame, (void *)jmp->Lr, &rec, IntToPtr(retval));
}
__wine_longjmp( (__wine_jmp_buf *)jmp, retval );
}

/*********************************************************************
* _fpieee_flt (MSVCRT.@)
Expand Down
21 changes: 0 additions & 21 deletions dlls/msvcrt/except_arm64ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,6 @@ unsigned int CDECL __CxxQueryExceptionSize(void)
}


/*******************************************************************
* longjmp (MSVCRT.@)
*/
void __cdecl MSVCRT_longjmp( _JUMP_BUFFER *jmp, int retval )
{
EXCEPTION_RECORD rec;

if (!retval) retval = 1;
if (jmp->Frame)
{
rec.ExceptionCode = STATUS_LONGJUMP;
rec.ExceptionFlags = 0;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = NULL;
rec.NumberParameters = 1;
rec.ExceptionInformation[0] = (DWORD_PTR)jmp;
RtlUnwind( (void *)jmp->Frame, (void *)jmp->Rip, &rec, IntToPtr(retval) );
}
__wine_longjmp( (__wine_jmp_buf *)jmp, retval );
}

/*********************************************************************
* _fpieee_flt (MSVCRT.@)
*/
Expand Down
6 changes: 4 additions & 2 deletions dlls/msvcrt/except_i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

#ifdef __i386__

#include <setjmp.h>
#include <stdarg.h>
#include <fpieee.h>
#define longjmp ms_longjmp /* avoid prototype mismatch */
#include <setjmp.h>
#undef longjmp

#include "windef.h"
#include "winbase.h"
Expand Down Expand Up @@ -1074,7 +1076,7 @@ int WINAPIV __regs__setjmp3(_JUMP_BUFFER *jmp, int nb_args, ...)
/*********************************************************************
* longjmp (MSVCRT.@)
*/
void CDECL MSVCRT_longjmp(_JUMP_BUFFER *jmp, int retval)
void __cdecl longjmp(_JUMP_BUFFER *jmp, int retval)
{
unsigned long cur_frame = 0;

Expand Down
8 changes: 6 additions & 2 deletions dlls/msvcrt/except_x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@

#if defined(__x86_64__) && !defined(__arm64ec__)

#include <setjmp.h>
#include <stdarg.h>
#include <fpieee.h>
#define longjmp ms_longjmp /* avoid prototype mismatch */
#include <setjmp.h>
#undef longjmp

#include "ntstatus.h"
#define WIN32_NO_STATUS
Expand Down Expand Up @@ -700,7 +702,8 @@ unsigned int CDECL __CxxQueryExceptionSize(void)
/*******************************************************************
* longjmp (MSVCRT.@)
*/
void __cdecl MSVCRT_longjmp( _JUMP_BUFFER *jmp, int retval )
#ifndef __WINE_PE_BUILD
void __cdecl longjmp( _JUMP_BUFFER *jmp, int retval )
{
EXCEPTION_RECORD rec;

Expand All @@ -717,6 +720,7 @@ void __cdecl MSVCRT_longjmp( _JUMP_BUFFER *jmp, int retval )
}
__wine_longjmp( (__wine_jmp_buf *)jmp, retval );
}
#endif

/*******************************************************************
* _local_unwind (MSVCRT.@)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcrt/msvcrt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -1368,7 +1368,7 @@
@ cdecl log10(double)
@ cdecl -arch=!i386 logf(float)
@ cdecl -arch=!i386 log10f(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbrlen(ptr long ptr)
Expand Down
4 changes: 2 additions & 2 deletions dlls/msvcrtd/msvcrtd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -733,7 +733,7 @@
@ cdecl -arch=win64 localtime(ptr) _localtime64
@ cdecl log(double)
@ cdecl log10(double)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl malloc(long)
@ cdecl mblen(ptr long)
@ cdecl mbstowcs(ptr str long)
Expand Down
4 changes: 2 additions & 2 deletions dlls/ucrtbase/ucrtbase.spec
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@
@ cdecl _locking(long long long)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386 _longjmpex(ptr long) longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
Expand Down Expand Up @@ -2405,7 +2405,7 @@
@ cdecl logbf(float)
@ cdecl logbl(double) logb
@ cdecl -arch=!i386 logf(float)
@ cdecl longjmp(ptr long) MSVCRT_longjmp
@ cdecl longjmp(ptr long)
@ cdecl lrint(double)
@ cdecl lrintf(float)
@ cdecl lrintl(double) lrint
Expand Down

0 comments on commit c51c257

Please sign in to comment.