mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-23 09:54:39 +08:00
backported setjmp/longjmp changes from v7.x branch:
Hand-picked from commits436ad4b830
and844cb490ab
: - setjmp.h: Only pass a frame pointer to setjmp if SEH is enabled This should avoid the need for clearing the frame pointer in the longjmp wrapper. - crt: Use importlibs for longjmp. Fixes setjmp/longjmp code built with -fno-asynchronous-unwind-tables with SEH toolchains.
This commit is contained in:
parent
e174bf62d3
commit
7b26999f1d
@ -131,6 +131,8 @@ ADD_UNDERSCORE(hypot)
|
||||
;logb
|
||||
ADD_UNDERSCORE(nextafter)
|
||||
|
||||
longjmp
|
||||
|
||||
#ifndef UCRTBASE
|
||||
_daylight DATA
|
||||
_timezone DATA
|
||||
@ -140,6 +142,4 @@ ADD_UNDERSCORE(timezone)
|
||||
ADD_UNDERSCORE(tzname)
|
||||
|
||||
ADD_UNDERSCORE(vsnprintf_s)
|
||||
|
||||
longjmp DATA
|
||||
#endif
|
||||
|
@ -1158,7 +1158,7 @@ F_I386(_seh_longjmp_unwind4@4)
|
||||
_set_purecall_handler
|
||||
_set_se_translator
|
||||
F_I386(_setjmp3)
|
||||
longjmp F_X86_ANY(DATA)
|
||||
longjmp
|
||||
memchr
|
||||
memcmp
|
||||
memcpy
|
||||
|
@ -1413,7 +1413,6 @@ log F_X86_ANY(DATA)
|
||||
log10
|
||||
F_NON_I386(log10f F_X86_ANY(DATA))
|
||||
F_NON_I386(logf F_X86_ANY(DATA))
|
||||
F_ARM_ANY(longjmp)
|
||||
malloc
|
||||
mblen
|
||||
F_ARM_ANY(mbrlen)
|
||||
|
@ -2431,7 +2431,6 @@ logb
|
||||
logbf
|
||||
logbl
|
||||
F_NON_I386(logf F_X86_ANY(DATA))
|
||||
longjmp F_X86_ANY(DATA)
|
||||
lrint
|
||||
lrintf
|
||||
lrintl
|
||||
|
@ -80,7 +80,7 @@ F_I386(_seh_longjmp_unwind@4)
|
||||
_set_purecall_handler
|
||||
_set_se_translator
|
||||
F_I386(_setjmp3)
|
||||
longjmp F_X86_ANY(DATA)
|
||||
longjmp
|
||||
memchr
|
||||
memcmp
|
||||
memcpy
|
||||
|
@ -599,7 +599,7 @@ localtime DATA
|
||||
;_localtime32 = localtime
|
||||
log
|
||||
log10
|
||||
longjmp DATA
|
||||
longjmp
|
||||
malloc
|
||||
mblen
|
||||
mbstowcs
|
||||
|
@ -1963,7 +1963,7 @@ iswxdigit
|
||||
isxdigit
|
||||
labs
|
||||
log
|
||||
longjmp DATA
|
||||
longjmp
|
||||
mbstowcs
|
||||
memchr
|
||||
memcmp
|
||||
|
@ -29,29 +29,6 @@ __MINGW_USYMBOL(mingw_getsp):
|
||||
ret
|
||||
#endif
|
||||
|
||||
/* On ARM:
|
||||
* Error: cannot represent BFD_RELOC_32_PCREL relocation in this object file format
|
||||
* But anyway, nothing is needed here as libarm32/libmsvcrt.a is exporting longjmp
|
||||
ldr ip, 1f
|
||||
ldr pc, [pc, ip]
|
||||
1: .long __imp_longjmp - (1b + 4)
|
||||
*/
|
||||
#if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__))
|
||||
.globl __MINGW_USYMBOL(longjmp)
|
||||
.def __MINGW_USYMBOL(longjmp); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(longjmp):
|
||||
#if defined(_AMD64_) || defined(__x86_64__)
|
||||
#ifndef __SEH__
|
||||
xorq %rax,%rax
|
||||
movq %rax, (%rcx)
|
||||
#endif
|
||||
leaq __MINGW_IMP_LSYMBOL(longjmp)(%rip), %rax
|
||||
jmpq *(%rax)
|
||||
#elif defined(_X86_) || defined(__i386__)
|
||||
jmp *__imp__longjmp
|
||||
#endif
|
||||
#endif /* !(defined(_ARM_) || defined(__arm__)) */
|
||||
|
||||
#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
|
||||
.globl __MINGW_USYMBOL(__mingw_setjmp)
|
||||
.def __MINGW_USYMBOL(__mingw_setjmp); .scl 2; .type 32; .endef
|
||||
|
@ -200,6 +200,8 @@ extern "C" {
|
||||
#define _JMP_BUF_DEFINED
|
||||
#endif
|
||||
|
||||
_CRTIMP __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value);
|
||||
|
||||
void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
|
||||
|
||||
#if !defined(USE_NO_MINGW_SETJMP_TWO_ARGS)
|
||||
@ -217,18 +219,21 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
|
||||
# define setjmp(BUF) __mingw_setjmp((BUF))
|
||||
# define longjmp __mingw_longjmp
|
||||
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __mingw_setjmp(jmp_buf _Buf);
|
||||
# else
|
||||
__MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __mingw_longjmp(jmp_buf _Buf,int _Value);
|
||||
# elif defined(__SEH__)
|
||||
# if (__MINGW_GCC_VERSION < 40702)
|
||||
# define setjmp(BUF) _setjmp((BUF), mingw_getsp())
|
||||
# else
|
||||
# define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
|
||||
# endif
|
||||
# else
|
||||
# define setjmp(BUF) _setjmp((BUF), NULL)
|
||||
# endif
|
||||
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf _Buf, void *_Ctx);
|
||||
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp3(jmp_buf _Buf, void *_Ctx);
|
||||
# else
|
||||
# undef setjmp
|
||||
# ifdef _WIN64
|
||||
# ifdef __SEH__
|
||||
# if (__MINGW_GCC_VERSION < 40702)
|
||||
# define setjmp(BUF) _setjmpex((BUF), mingw_getsp())
|
||||
# define setjmpex(BUF) _setjmpex((BUF), mingw_getsp())
|
||||
@ -252,9 +257,6 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
|
||||
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) setjmp(jmp_buf _Buf);
|
||||
#endif
|
||||
|
||||
__MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/;
|
||||
__MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user