]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin: add a hardwired redir for bcmp
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 24 Mar 2026 12:57:31 +0000 (13:57 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 24 Mar 2026 12:57:31 +0000 (13:57 +0100)
This allows 2 suppressions to be removed.

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

index e705a767f402916109e3a7adca1b5d76abe8b51f..3c2bd87d4fb73d1a4ba741b922729336fa90cd4c 100644 (file)
@@ -1628,6 +1628,8 @@ void VG_(redir_initialise) ( void )
                          (Addr)&VG_(amd64_darwin_REDIR_FOR_strcpy), NULL);
       add_hardwired_spec("dyld", "strlcat",
                          (Addr)&VG_(amd64_darwin_REDIR_FOR_strlcat), NULL);
+      add_hardwired_spec("dyld", "bcmp",
+                         (Addr)&VG_(amd64_darwin_REDIR_FOR_bcmp), NULL);
       // DDD: #warning fixme rdar://6166275
       add_hardwired_spec("dyld", "arc4random",
                          (Addr)&VG_(amd64_darwin_REDIR_FOR_arc4random), NULL);
index ec25136ef596c6dddbcdfbdafb8e43a0bb5c7e00..cc6145a81f66b51e5ca84dfaa1903d2c32a6517d 100644 (file)
@@ -1381,6 +1381,21 @@ VG_(amd64_darwin_REDIR_FOR_strchr):
 2:
         popq    %rbp
         ret
+
+.globl VG_(amd64_darwin_REDIR_FOR_bcmp)
+VG_(amd64_darwin_REDIR_FOR_bcmp):
+        xorl    %eax, %eax
+        xorl    %ecx, %ecx
+1:
+        cmpq    %rcx, %rdx
+        je      2f
+        movzbl  (%rdi,%rcx), %r8d
+        cmpb    (%rsi,%rcx), %r8b
+        leaq    1(%rcx), %rcx
+        je      1b
+        movl    $1, %eax
+2:
+        ret
         
 .globl VG_(trampoline_stuff_end)
 VG_(trampoline_stuff_end):
index 2ca144211b02e784a6bc2a2b17d9e6eceb8a609b..67875ff4c63070d27ceea8fab5727ec0776c59d2 100644 (file)
@@ -143,6 +143,8 @@ extern void* VG_(amd64_darwin_REDIR_FOR_strcat)( void*, void * );
 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 SizeT VG_(amd64_darwin_REDIR_FOR_bcmp)( const void *s1, const void *s2,
+                                                  SizeT len );
 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 );
index 9d1e91e88941094b98a194f7b848b143c158ef70..e4d794f3a0cc7b08c2e561b6ceb9172784ae3e56 100644 (file)
    obj:*libdyld*dylib*
 }
 
-{
-   OSX1013:dyld-3
-   Memcheck:Cond
-   fun:bcmp
-   fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
-}
-
-{
-   OSX1013:dyld-4
-   Memcheck:Value8
-   fun:bcmp
-   fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
-}
-
 {
    OSX1013:dyld-5
    Memcheck:Cond