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