]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Redirect strchr in dyld (the dynamic linker) on OS X 10.9, for
authorJulian Seward <jseward@acm.org>
Sat, 21 Jun 2014 09:34:22 +0000 (09:34 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 21 Jun 2014 09:34:22 +0000 (09:34 +0000)
the usual reason.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14070

coregrind/m_redir.c
coregrind/m_trampoline.S
coregrind/pub_core_trampoline.h

index e5dc248931c225e08157dce461037546573e312e..b13b3fba4de1f2716fee2a212da3adf523a8c52d 100644 (file)
@@ -1387,6 +1387,10 @@ void VG_(redir_initialise) ( void )
       // 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)
index a1c4dec4114693f63a1f8b265e858c157573a615..5dd362c402ca6ff9b9a13f7adaaf2fd9890d670e 100644 (file)
@@ -1081,6 +1081,29 @@ VG_(amd64_darwin_REDIR_FOR_arc4random):
        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):
 
index 755f8b90b26d67bb36f43e5553b158233669a194..96710fe8d04f92f59e5c7f3cf8902481987a54e2 100644 (file)
@@ -129,6 +129,9 @@ extern char* VG_(amd64_darwin_REDIR_FOR_strcpy)( char *s1, char *s2 );
 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)