|
From: <sv...@va...> - 2014-06-21 09:34:52
|
Author: sewardj
Date: Sat Jun 21 09:34:22 2014
New Revision: 14070
Log:
Redirect strchr in dyld (the dynamic linker) on OS X 10.9, for
the usual reason.
Modified:
trunk/coregrind/m_redir.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/coregrind/m_redir.c
==============================================================================
--- trunk/coregrind/m_redir.c (original)
+++ trunk/coregrind/m_redir.c Sat Jun 21 09:34:22 2014
@@ -1387,6 +1387,10 @@
// DDD: #warning fixme rdar://6166275
add_hardwired_spec("dyld", "arc4random",
(Addr)&VG_(amd64_darwin_REDIR_FOR_arc4random), NULL);
+# if DARWIN_VERS == DARWIN_10_9
+ add_hardwired_spec("dyld", "strchr",
+ (Addr)&VG_(amd64_darwin_REDIR_FOR_strchr), NULL);
+# endif
}
# elif defined(VGP_s390x_linux)
Modified: trunk/coregrind/m_trampoline.S
==============================================================================
--- trunk/coregrind/m_trampoline.S (original)
+++ trunk/coregrind/m_trampoline.S Sat Jun 21 09:34:22 2014
@@ -1081,6 +1081,29 @@
movq $0x76616c6772696e64, %rax
ret
+.globl VG_(amd64_darwin_REDIR_FOR_strchr)
+VG_(amd64_darwin_REDIR_FOR_strchr):
+ pushq %rbp
+ movq %rsp, %rbp
+ movb (%rdi), %cl
+ cmpb %sil, %cl
+ jne 1f
+ movq %rdi, %rax
+ popq %rbp
+ ret
+1:
+ testb %cl, %cl
+ movl $0, %eax
+ je 2f
+ movb 1(%rdi), %cl
+ incq %rdi
+ cmpb %sil, %cl
+ movq %rdi, %rax
+ jne 1b
+2:
+ popq %rbp
+ ret
+
.globl VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
Modified: trunk/coregrind/pub_core_trampoline.h
==============================================================================
--- trunk/coregrind/pub_core_trampoline.h (original)
+++ trunk/coregrind/pub_core_trampoline.h Sat Jun 21 09:34:22 2014
@@ -129,6 +129,9 @@
extern SizeT VG_(amd64_darwin_REDIR_FOR_strlcat)( char *s1, const char *s2,
SizeT size );
extern UInt VG_(amd64_darwin_REDIR_FOR_arc4random)( void );
+# if DARWIN_VERS == DARWIN_10_9
+ extern char* VG_(amd64_darwin_REDIR_FOR_strchr)( const char*, int );
+# endif
#endif
#if defined(VGP_s390x_linux)
|