@@ -28,3 +28,4 @@ __memcpy_chk (void *dstpp, const void *srcpp, size_t len, size_t dstlen)
return memcpy (dstpp, srcpp, len);
}
+libc_hidden_builtin_def (__memcpy_chk)
@@ -32,3 +32,4 @@ MEMMOVE_CHK (void *dest, const void *src, size_t len, size_t destlen)
return memmove (dest, src, len);
}
+libc_hidden_builtin_def (MEMMOVE_CHK)
@@ -29,3 +29,4 @@ __mempcpy_chk (void *dstpp, const void *srcpp, size_t len, size_t dstlen)
return __mempcpy (dstpp, srcpp, len);
}
+libc_hidden_builtin_def (__mempcpy_chk)
@@ -26,3 +26,4 @@ __memset_chk (void *dstpp, int c, size_t len, size_t dstlen)
return memset (dstpp, c, len);
}
+libc_hidden_builtin_def (__memset_chk)
@@ -32,3 +32,4 @@ __stpcpy_chk (char *dest, const char *src, size_t destlen)
return memcpy (dest, src, len + 1) + len;
}
+libc_hidden_builtin_def (__stpcpy_chk)
@@ -208,6 +208,13 @@ extern char *__strcat_chk (char *__restrict __dest,
extern char *__strncat_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __len, size_t __destlen) __THROW;
+
+libc_hidden_builtin_proto (__memcpy_chk)
+libc_hidden_builtin_proto (__memmove_chk)
+libc_hidden_builtin_proto (__mempcpy_chk)
+libc_hidden_builtin_proto (__memset_chk)
+libc_hidden_builtin_proto (__stpcpy_chk)
+
#endif
#endif
@@ -32,6 +32,7 @@ ENTRY (__memcpy_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
ENTRY (memcpy)
@@ -33,6 +33,7 @@ ENTRY (__memset_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
ENTRY (memset)
@@ -33,6 +33,7 @@ ENTRY_CHK (__memcpy_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
ENTRY (memcpy)
@@ -35,6 +35,7 @@ ENTRY_CHK (__memmove_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (__memmove_chk)
+libc_hidden_builtin_def (__memmove_chk)
#endif
ENTRY (memmove)
@@ -33,6 +33,7 @@ ENTRY_CHK (__mempcpy_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (__mempcpy_chk)
+libc_hidden_builtin_def (__mempcpy_chk)
#endif
ENTRY (__mempcpy)
@@ -33,6 +33,7 @@ ENTRY_CHK (__memset_chk)
cmpl %eax, 16(%esp)
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
ENTRY (memset)
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_memcpy_chk, __memcpy_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__memcpy_chk, __GI___memcpy_chk, __redirect_memcpy_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memcpy_chk);
+# endif
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_memmove_chk, __memmove_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__memmove_chk, __GI___memmove_chk, __redirect_memmove_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memmove_chk);
+# endif
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_mempcpy_chk, __mempcpy_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__mempcpy_chk, __GI___mempcpy_chk, __redirect_mempcpy_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__mempcpy_chk);
+# endif
#endif
@@ -28,5 +28,8 @@
libc_ifunc_redirected (__redirect_memset_chk, __memset_chk,
IFUNC_SELECTOR ());
-
+# ifdef SHARED
+__hidden_ver1 (__memset_chk, __GI___memset_chk, __redirect_memset_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memset_chk);
+# endif
#endif
@@ -31,4 +31,5 @@ ENTRY (__memcpy_chk)
jb __chk_fail
jmp memcpy
END (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
@@ -30,4 +30,5 @@ ENTRY (__memmove_chk)
jb __chk_fail
jmp memmove
END (__memmove_chk)
+libc_hidden_builtin_def (MEMMOVE_CHK)
#endif
@@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk)
jb __chk_fail
jmp __mempcpy
END (__mempcpy_chk)
+libc_hidden_builtin_def (__mempcpy_chk)
#endif
@@ -30,4 +30,5 @@ ENTRY (__memset_chk)
jb __chk_fail
jmp memset
END (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
@@ -30,4 +30,5 @@ ENTRY (__memcpy_chk)
jb __chk_fail
jmp memcpy
END (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
@@ -30,4 +30,5 @@ ENTRY (__memmove_chk)
jb __chk_fail
jmp memmove
END (__memmove_chk)
+libc_hidden_builtin_def (MEMMOVE_CHK)
#endif
@@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk)
jb __chk_fail
jmp __mempcpy
END (__mempcpy_chk)
+libc_hidden_builtin_def (__mempcpy_chk)
#endif
@@ -30,4 +30,5 @@ ENTRY (__memset_chk)
jb __chk_fail
jmp memset
END (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_memcpy_chk, __memcpy_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__memcpy_chk, __GI___memcpy_chk, __redirect_memcpy_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memcpy_chk);
+# endif
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_memmove_chk, __memmove_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__memmove_chk, __GI___memmove_chk, __redirect_memmove_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memmove_chk);
+# endif
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_mempcpy_chk, __mempcpy_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__mempcpy_chk, __GI___mempcpy_chk, __redirect_mempcpy_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__mempcpy_chk);
+# endif
#endif
@@ -28,4 +28,8 @@
libc_ifunc_redirected (__redirect_memset_chk, __memset_chk,
IFUNC_SELECTOR ());
+# ifdef SHARED
+__hidden_ver1 (__memset_chk, __GI___memset_chk, __redirect_memset_chk)
+ __attribute__ ((visibility ("hidden"))) __attribute_copy__ (__memset_chk);
+# endif
#endif
If libc_hidden_builtin_{def,proto} isn't properly set for *_chk routines, there are unwanted PLT entries in libc.so. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> --- debug/memcpy_chk.c | 1 + debug/memmove_chk.c | 1 + debug/mempcpy_chk.c | 1 + debug/memset_chk.c | 1 + debug/stpcpy_chk.c | 1 + include/string.h | 7 +++++++ sysdeps/i386/i586/memcpy.S | 1 + sysdeps/i386/i586/memset.S | 1 + sysdeps/i386/i686/memcpy.S | 1 + sysdeps/i386/i686/memmove.S | 1 + sysdeps/i386/i686/mempcpy.S | 1 + sysdeps/i386/i686/memset.S | 1 + sysdeps/i386/i686/multiarch/memcpy_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/memmove_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/mempcpy_chk.c | 4 ++++ sysdeps/i386/i686/multiarch/memset_chk.c | 5 ++++- sysdeps/i386/memcpy_chk.S | 1 + sysdeps/i386/memmove_chk.S | 1 + sysdeps/i386/mempcpy_chk.S | 1 + sysdeps/i386/memset_chk.S | 1 + sysdeps/x86_64/memcpy_chk.S | 1 + sysdeps/x86_64/memmove_chk.S | 1 + sysdeps/x86_64/mempcpy_chk.S | 1 + sysdeps/x86_64/memset_chk.S | 1 + sysdeps/x86_64/multiarch/memcpy_chk.c | 4 ++++ sysdeps/x86_64/multiarch/memmove_chk.c | 4 ++++ sysdeps/x86_64/multiarch/mempcpy_chk.c | 4 ++++ sysdeps/x86_64/multiarch/memset_chk.c | 4 ++++ 28 files changed, 58 insertions(+), 1 deletion(-)