Blame SOURCES/valgrind-3.15.0-arm64-ld-stpcpy.patch

2a1fab
commit 89423f5d8ba05a099c2c62227a00a4f4eec59eb3
2a1fab
Author: Mark Wielaard <mark@klomp.org>
2a1fab
Date:   Tue May 7 21:20:04 2019 +0200
2a1fab
2a1fab
    Intercept stpcpy also in ld.so for arm64
2a1fab
    
2a1fab
    On other arches stpcpy () is intercepted for both libc.so and ld.so.
2a1fab
    But not on arm64, where it is only intercepted for libc.so.
2a1fab
    
2a1fab
    This can cause memcheck warnings about the use of stpcpy () in ld.so
2a1fab
    when called through dlopen () because ld.so contains its own copy of
2a1fab
    that functions.
2a1fab
    
2a1fab
    Fix by introducing VG_Z_LD_LINUX_AARCH64_SO_1 (the encoded name of
2a1fab
    ld.so on arm64) and using that in vg_replace_strmem.c to intercept
2a1fab
    stpcpy.
2a1fab
    
2a1fab
    https://bugs.kde.org/show_bug.cgi?id=407307
2a1fab
2a1fab
diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
2a1fab
index c97941f..15ba67f 100644
2a1fab
--- a/include/pub_tool_redir.h
2a1fab
+++ b/include/pub_tool_redir.h
2a1fab
@@ -313,7 +313,9 @@
2a1fab
 #define  VG_Z_LD_SO_1               ldZdsoZd1                  // ld.so.1
2a1fab
 #define  VG_U_LD_SO_1               "ld.so.1"
2a1fab
 
2a1fab
+#define  VG_Z_LD_LINUX_AARCH64_SO_1  ldZhlinuxZhaarch64ZdsoZd1
2a1fab
 #define  VG_U_LD_LINUX_AARCH64_SO_1 "ld-linux-aarch64.so.1"
2a1fab
+
2a1fab
 #define  VG_U_LD_LINUX_ARMHF_SO_3   "ld-linux-armhf.so.3"
2a1fab
 
2a1fab
 #endif
2a1fab
diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
2a1fab
index 89a7dcc..19143cf 100644
2a1fab
--- a/shared/vg_replace_strmem.c
2a1fab
+++ b/shared/vg_replace_strmem.c
2a1fab
@@ -1160,6 +1160,7 @@ static inline void my_exit ( int x )
2a1fab
  STPCPY(VG_Z_LIBC_SONAME,          __stpcpy_sse2_unaligned)
2a1fab
  STPCPY(VG_Z_LD_LINUX_SO_2,        stpcpy)
2a1fab
  STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
2a1fab
+ STPCPY(VG_Z_LD_LINUX_AARCH64_SO_1,stpcpy)
2a1fab
 
2a1fab
 #elif defined(VGO_darwin)
2a1fab
  //STPCPY(VG_Z_LIBC_SONAME,          stpcpy)