From: Julian Seward Date: Thu, 29 Sep 2011 18:29:41 +0000 (+0000) Subject: Make {amd64,x86}-darwin use the direct implementations of X-Git-Tag: svn/VALGRIND_3_7_0~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc16ea641222b3697f5ecc308c2a4fa2d9d53092;p=thirdparty%2Fvalgrind.git Make {amd64,x86}-darwin use the direct implementations of VG_MINIMAL_SETJMP and VG_MINIMAL_LONGJMP introduced in r12067. With this commit, it should be possible to build a working 64 bit Valgrind using the default gcc as supplied with Xcode 4.1 on OSX 10.7. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12070 --- diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c index 4d19e681ed..470ef732cb 100644 --- a/coregrind/m_libcsetjmp.c +++ b/coregrind/m_libcsetjmp.c @@ -36,8 +36,10 @@ /* See include/pub_tool_libcsetjmp.h for background and rationale. */ -/* The only alternative implementations are for ppc{32,64}-linux. See - #259977. */ +/* The alternative implementations are for ppc{32,64}-linux and + {amd64,x86}-{linux,darwin}. See #259977. That leaves only + {arm,s390x}-linux using the gcc builtins now. +*/ /* ------------ ppc32-linux ------------ */ @@ -271,15 +273,26 @@ __asm__( #endif /* VGP_ppc64_linux */ -/* ------------ amd64-linux ------------ */ +/* ------------ amd64-{linux,darwin} ------------ */ -#if defined(VGP_amd64_linux) +#if defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) __asm__( ".text" "\n" "" "\n" + +#if defined(VGP_amd64_linux) ".global VG_MINIMAL_SETJMP" "\n" // rdi = jmp_buf "VG_MINIMAL_SETJMP:" "\n" + +#elif defined(VGP_amd64_darwin) +".globl _VG_MINIMAL_SETJMP" "\n" // rdi = jmp_buf +"_VG_MINIMAL_SETJMP:" "\n" + +#else +# error "Huh?" +#endif + " movq %rax, 0(%rdi)" "\n" " movq %rbx, 8(%rdi)" "\n" " movq %rcx, 16(%rdi)" "\n" @@ -304,8 +317,18 @@ __asm__( " ret" "\n" "" "\n" -".globl VG_MINIMAL_LONGJMP" "\n" + +#if defined(VGP_amd64_linux) +".global VG_MINIMAL_LONGJMP" "\n" "VG_MINIMAL_LONGJMP:" "\n" // rdi = jmp_buf + +#elif defined(VGP_amd64_darwin) +".globl _VG_MINIMAL_LONGJMP" "\n" +"_VG_MINIMAL_LONGJMP:" "\n" // rdi = jmp_buf + +#else +# error "Huh?" +#endif // skip restoring rax; it's pointless " movq 8(%rdi), %rbx" "\n" " movq 16(%rdi), %rcx" "\n" @@ -338,21 +361,34 @@ __asm__( " jmp *%rax" "\n" "" "\n" +#if !defined(VGP_amd64_darwin) ".previous" "\n" +#endif ); -#endif /* VGP_amd64_linux */ +#endif /* VGP_amd64_linux || VGP_amd64_darwin */ -/* ------------ x86-linux ------------ */ +/* ------------ x86-{linux,darwin} ------------ */ -#if defined(VGP_x86_linux) +#if defined(VGP_x86_linux) || defined(VGP_x86_darwin) __asm__( ".text" "\n" "" "\n" + +#if defined(VGP_x86_linux) ".global VG_MINIMAL_SETJMP" "\n" // eax = jmp_buf "VG_MINIMAL_SETJMP:" "\n" + +#elif defined(VGP_x86_darwin) +".globl _VG_MINIMAL_SETJMP" "\n" // eax = jmp_buf +"_VG_MINIMAL_SETJMP:" "\n" + +#else +# error "Huh?" +#endif + " movl %eax, 0(%eax)" "\n" " movl %ebx, 4(%eax)" "\n" " movl %ecx, 8(%eax)" "\n" @@ -371,8 +407,19 @@ __asm__( " ret" "\n" "" "\n" -".globl VG_MINIMAL_LONGJMP" "\n" + +#if defined(VGP_x86_linux) +".global VG_MINIMAL_LONGJMP" "\n" "VG_MINIMAL_LONGJMP:" "\n" // eax = jmp_buf + +#elif defined(VGP_x86_darwin) +".globl _VG_MINIMAL_LONGJMP" "\n" +"_VG_MINIMAL_LONGJMP:" "\n" // eax = jmp_buf + +#else +# error "Huh?" +#endif + // skip restoring eax; it's pointless " movl 4(%eax), %ebx" "\n" " movl 8(%eax), %ecx" "\n" @@ -390,10 +437,12 @@ __asm__( " jmp *%eax" "\n" "" "\n" +#if !defined(VGP_x86_darwin) ".previous" "\n" +#endif ); -#endif /* VGP_x86_linux */ +#endif /* VGP_x86_linux || VGP_x86_darwin */ /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h index 889a1e3232..f37b8595d8 100644 --- a/include/pub_tool_libcsetjmp.h +++ b/include/pub_tool_libcsetjmp.h @@ -89,7 +89,7 @@ __attribute__((noreturn)) void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); -#elif defined(VGP_amd64_linux) +#elif defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) #define VG_MINIMAL_JMP_BUF(_name) ULong _name [16+1] __attribute__((returns_twice)) @@ -98,7 +98,7 @@ __attribute__((noreturn)) void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); -#elif defined(VGP_x86_linux) +#elif defined(VGP_x86_linux) || defined(VGP_x86_darwin) #define VG_MINIMAL_JMP_BUF(_name) UInt _name [8+1] __attribute__((returns_twice))