From: Ivo Raisr Date: Sat, 21 Nov 2015 21:35:34 +0000 (+0000) Subject: Implement properly setjmp/longjmp on Solaris x86/amd64. X-Git-Tag: svn/VALGRIND_3_12_0~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8baa800e6305febb07c47b793c5046bee8437b80;p=thirdparty%2Fvalgrind.git Implement properly setjmp/longjmp on Solaris x86/amd64. The default implementation provided by __builtin functions does very weird things. Uncovered by Philippe's commit r15716. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15734 --- diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c index 81a1a538a6..24ca357324 100644 --- a/coregrind/m_libcsetjmp.c +++ b/coregrind/m_libcsetjmp.c @@ -37,7 +37,7 @@ /* See include/pub_tool_libcsetjmp.h for background and rationale. */ /* The alternative implementations are for ppc{32,64}-linux and - {amd64,x86}-{linux,darwin}. See #259977. That leaves only + {amd64,x86}-{linux,darwin,solaris}. See #259977. That leaves only {arm,s390x}-linux using the gcc builtins now. */ @@ -377,15 +377,16 @@ __asm__( #endif /* VGP_ppc64be_linux */ -/* ------------ amd64-{linux,darwin} ------------ */ +/* -------- amd64-{linux,darwin,solaris} -------- */ -#if defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) +#if defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) || \ + defined(VGP_amd64_solaris) __asm__( ".text" "\n" "" "\n" -#if defined(VGP_amd64_linux) +#if defined(VGP_amd64_linux) || defined(VGP_amd64_solaris) ".global VG_MINIMAL_SETJMP" "\n" // rdi = jmp_buf "VG_MINIMAL_SETJMP:" "\n" @@ -422,7 +423,7 @@ __asm__( "" "\n" -#if defined(VGP_amd64_linux) +#if defined(VGP_amd64_linux) || defined(VGP_amd64_solaris) ".global VG_MINIMAL_LONGJMP" "\n" "VG_MINIMAL_LONGJMP:" "\n" // rdi = jmp_buf @@ -470,18 +471,19 @@ __asm__( #endif ); -#endif /* VGP_amd64_linux || VGP_amd64_darwin */ +#endif /* VGP_amd64_linux || VGP_amd64_darwin || VGP_amd64_solaris */ -/* ------------ x86-{linux,darwin} ------------ */ +/* -------- x86-{linux,darwin,solaris} -------- */ -#if defined(VGP_x86_linux) || defined(VGP_x86_darwin) +#if defined(VGP_x86_linux) || defined(VGP_x86_darwin) || \ + defined(VGP_x86_solaris) __asm__( ".text" "\n" "" "\n" -#if defined(VGP_x86_linux) +#if defined(VGP_x86_linux) || defined(VGP_x86_solaris) ".global VG_MINIMAL_SETJMP" "\n" // eax = jmp_buf "VG_MINIMAL_SETJMP:" "\n" @@ -512,7 +514,7 @@ __asm__( "" "\n" -#if defined(VGP_x86_linux) +#if defined(VGP_x86_linux) || defined(VGP_x86_solaris) ".global VG_MINIMAL_LONGJMP" "\n" "VG_MINIMAL_LONGJMP:" "\n" // eax = jmp_buf @@ -546,7 +548,7 @@ __asm__( #endif ); -#endif /* VGP_x86_linux || VGP_x86_darwin */ +#endif /* VGP_x86_linux || VGP_x86_darwin || VGP_x86_solaris */ #if defined(VGP_mips32_linux) diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h index bb94a59ab3..31d2b61d51 100644 --- a/include/pub_tool_libcsetjmp.h +++ b/include/pub_tool_libcsetjmp.h @@ -91,7 +91,8 @@ __attribute__((noreturn)) void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); -#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) +#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) || \ + defined(VGP_amd64_solaris) #define VG_MINIMAL_JMP_BUF(_name) ULong _name [16+1] __attribute__((returns_twice)) @@ -100,7 +101,8 @@ __attribute__((noreturn)) void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); -#elif defined(VGP_x86_linux) || defined(VGP_x86_darwin) +#elif defined(VGP_x86_linux) || defined(VGP_x86_darwin) || \ + defined(VGP_x86_solaris) #define VG_MINIMAL_JMP_BUF(_name) UInt _name [8+1] __attribute__((returns_twice))