aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-04-20 14:07:52 +0200
committerFrédéric Bérat <fberat@redhat.com>2023-07-05 16:59:48 +0200
commitdd8486ffc195f5fe150b2d3724c7712686cfddb0 (patch)
tree8c6a24a94d1884b92f9b48536b39847110a23564
parentba96ff24b253d0321508b8b462103bbaa2975bb5 (diff)
downloadglibc-dd8486ffc195f5fe150b2d3724c7712686cfddb0.zip
glibc-dd8486ffc195f5fe150b2d3724c7712686cfddb0.tar.gz
glibc-dd8486ffc195f5fe150b2d3724c7712686cfddb0.tar.bz2
string: Ensure *_chk routines have their hidden builtin definition available
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>
-rw-r--r--debug/memcpy_chk.c1
-rw-r--r--debug/memmove_chk.c1
-rw-r--r--debug/mempcpy_chk.c1
-rw-r--r--debug/memset_chk.c1
-rw-r--r--debug/stpcpy_chk.c1
-rw-r--r--include/string.h7
-rw-r--r--sysdeps/i386/i586/memcpy.S1
-rw-r--r--sysdeps/i386/i586/memset.S1
-rw-r--r--sysdeps/i386/i686/memcpy.S1
-rw-r--r--sysdeps/i386/i686/memmove.S1
-rw-r--r--sysdeps/i386/i686/mempcpy.S1
-rw-r--r--sysdeps/i386/i686/memset.S1
-rw-r--r--sysdeps/i386/i686/multiarch/memcpy_chk.c4
-rw-r--r--sysdeps/i386/i686/multiarch/memmove_chk.c4
-rw-r--r--sysdeps/i386/i686/multiarch/mempcpy_chk.c4
-rw-r--r--sysdeps/i386/i686/multiarch/memset_chk.c5
-rw-r--r--sysdeps/i386/memcpy_chk.S1
-rw-r--r--sysdeps/i386/memmove_chk.S1
-rw-r--r--sysdeps/i386/mempcpy_chk.S1
-rw-r--r--sysdeps/i386/memset_chk.S1
-rw-r--r--sysdeps/x86_64/memcpy_chk.S1
-rw-r--r--sysdeps/x86_64/memmove_chk.S1
-rw-r--r--sysdeps/x86_64/mempcpy_chk.S1
-rw-r--r--sysdeps/x86_64/memset_chk.S1
-rw-r--r--sysdeps/x86_64/multiarch/memcpy_chk.c4
-rw-r--r--sysdeps/x86_64/multiarch/memmove_chk.c4
-rw-r--r--sysdeps/x86_64/multiarch/mempcpy_chk.c4
-rw-r--r--sysdeps/x86_64/multiarch/memset_chk.c4
28 files changed, 58 insertions, 1 deletions
diff --git a/debug/memcpy_chk.c b/debug/memcpy_chk.c
index c6dd94c..1e4a82c 100644
--- a/debug/memcpy_chk.c
+++ b/debug/memcpy_chk.c
@@ -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)
diff --git a/debug/memmove_chk.c b/debug/memmove_chk.c
index 8922a1b..b714aa4 100644
--- a/debug/memmove_chk.c
+++ b/debug/memmove_chk.c
@@ -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)
diff --git a/debug/mempcpy_chk.c b/debug/mempcpy_chk.c
index 17a46a3..b47b14e 100644
--- a/debug/mempcpy_chk.c
+++ b/debug/mempcpy_chk.c
@@ -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)
diff --git a/debug/memset_chk.c b/debug/memset_chk.c
index 4fc0b55..93901f5 100644
--- a/debug/memset_chk.c
+++ b/debug/memset_chk.c
@@ -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)
diff --git a/debug/stpcpy_chk.c b/debug/stpcpy_chk.c
index 230b52b..518dd78 100644
--- a/debug/stpcpy_chk.c
+++ b/debug/stpcpy_chk.c
@@ -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)
diff --git a/include/string.h b/include/string.h
index 0c78ad2..659530d 100644
--- a/include/string.h
+++ b/include/string.h
@@ -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
diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S
index 58061d5..e3405e5 100644
--- a/sysdeps/i386/i586/memcpy.S
+++ b/sysdeps/i386/i586/memcpy.S
@@ -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)
diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S
index 413e8ec..f1f0e1a 100644
--- a/sysdeps/i386/i586/memset.S
+++ b/sysdeps/i386/i586/memset.S
@@ -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)
diff --git a/sysdeps/i386/i686/memcpy.S b/sysdeps/i386/i686/memcpy.S
index 604d308..9b48ec0 100644
--- a/sysdeps/i386/i686/memcpy.S
+++ b/sysdeps/i386/i686/memcpy.S
@@ -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)
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
index cff06c2..06fe2a7 100644
--- a/sysdeps/i386/i686/memmove.S
+++ b/sysdeps/i386/i686/memmove.S
@@ -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)
diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S
index af3f2cc..26f8501 100644
--- a/sysdeps/i386/i686/mempcpy.S
+++ b/sysdeps/i386/i686/mempcpy.S
@@ -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)
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
index d489188..0b5e671 100644
--- a/sysdeps/i386/i686/memset.S
+++ b/sysdeps/i386/i686/memset.S
@@ -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)
diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk.c b/sysdeps/i386/i686/multiarch/memcpy_chk.c
index 5ac5cb1..ec945dc 100644
--- a/sysdeps/i386/i686/multiarch/memcpy_chk.c
+++ b/sysdeps/i386/i686/multiarch/memcpy_chk.c
@@ -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
diff --git a/sysdeps/i386/i686/multiarch/memmove_chk.c b/sysdeps/i386/i686/multiarch/memmove_chk.c
index 28161d3..55c7601 100644
--- a/sysdeps/i386/i686/multiarch/memmove_chk.c
+++ b/sysdeps/i386/i686/multiarch/memmove_chk.c
@@ -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
diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk.c b/sysdeps/i386/i686/multiarch/mempcpy_chk.c
index 36c81ae..83569cf 100644
--- a/sysdeps/i386/i686/multiarch/mempcpy_chk.c
+++ b/sysdeps/i386/i686/multiarch/mempcpy_chk.c
@@ -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
diff --git a/sysdeps/i386/i686/multiarch/memset_chk.c b/sysdeps/i386/i686/multiarch/memset_chk.c
index cf3e811..1a75038 100644
--- a/sysdeps/i386/i686/multiarch/memset_chk.c
+++ b/sysdeps/i386/i686/multiarch/memset_chk.c
@@ -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
diff --git a/sysdeps/i386/memcpy_chk.S b/sysdeps/i386/memcpy_chk.S
index b5244cc..7b12c12 100644
--- a/sysdeps/i386/memcpy_chk.S
+++ b/sysdeps/i386/memcpy_chk.S
@@ -31,4 +31,5 @@ ENTRY (__memcpy_chk)
jb __chk_fail
jmp memcpy
END (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
diff --git a/sysdeps/i386/memmove_chk.S b/sysdeps/i386/memmove_chk.S
index 517d8cb..604aea8 100644
--- a/sysdeps/i386/memmove_chk.S
+++ b/sysdeps/i386/memmove_chk.S
@@ -30,4 +30,5 @@ ENTRY (__memmove_chk)
jb __chk_fail
jmp memmove
END (__memmove_chk)
+libc_hidden_builtin_def (MEMMOVE_CHK)
#endif
diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S
index 1e9bf71..276eab1 100644
--- a/sysdeps/i386/mempcpy_chk.S
+++ b/sysdeps/i386/mempcpy_chk.S
@@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk)
jb __chk_fail
jmp __mempcpy
END (__mempcpy_chk)
+libc_hidden_builtin_def (__mempcpy_chk)
#endif
diff --git a/sysdeps/i386/memset_chk.S b/sysdeps/i386/memset_chk.S
index 0e6060a..a2e9208 100644
--- a/sysdeps/i386/memset_chk.S
+++ b/sysdeps/i386/memset_chk.S
@@ -30,4 +30,5 @@ ENTRY (__memset_chk)
jb __chk_fail
jmp memset
END (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
diff --git a/sysdeps/x86_64/memcpy_chk.S b/sysdeps/x86_64/memcpy_chk.S
index 25cbeb3..43843a7 100644
--- a/sysdeps/x86_64/memcpy_chk.S
+++ b/sysdeps/x86_64/memcpy_chk.S
@@ -30,4 +30,5 @@ ENTRY (__memcpy_chk)
jb __chk_fail
jmp memcpy
END (__memcpy_chk)
+libc_hidden_builtin_def (__memcpy_chk)
#endif
diff --git a/sysdeps/x86_64/memmove_chk.S b/sysdeps/x86_64/memmove_chk.S
index 165d42c..37e2c30 100644
--- a/sysdeps/x86_64/memmove_chk.S
+++ b/sysdeps/x86_64/memmove_chk.S
@@ -30,4 +30,5 @@ ENTRY (__memmove_chk)
jb __chk_fail
jmp memmove
END (__memmove_chk)
+libc_hidden_builtin_def (MEMMOVE_CHK)
#endif
diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S
index b60ee4f..facdac5 100644
--- a/sysdeps/x86_64/mempcpy_chk.S
+++ b/sysdeps/x86_64/mempcpy_chk.S
@@ -30,4 +30,5 @@ ENTRY (__mempcpy_chk)
jb __chk_fail
jmp __mempcpy
END (__mempcpy_chk)
+libc_hidden_builtin_def (__mempcpy_chk)
#endif
diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S
index ed53b89..c927884 100644
--- a/sysdeps/x86_64/memset_chk.S
+++ b/sysdeps/x86_64/memset_chk.S
@@ -30,4 +30,5 @@ ENTRY (__memset_chk)
jb __chk_fail
jmp memset
END (__memset_chk)
+libc_hidden_builtin_def (__memset_chk)
#endif
diff --git a/sysdeps/x86_64/multiarch/memcpy_chk.c b/sysdeps/x86_64/multiarch/memcpy_chk.c
index 5ac5cb1..ec945dc 100644
--- a/sysdeps/x86_64/multiarch/memcpy_chk.c
+++ b/sysdeps/x86_64/multiarch/memcpy_chk.c
@@ -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
diff --git a/sysdeps/x86_64/multiarch/memmove_chk.c b/sysdeps/x86_64/multiarch/memmove_chk.c
index 28161d3..55c7601 100644
--- a/sysdeps/x86_64/multiarch/memmove_chk.c
+++ b/sysdeps/x86_64/multiarch/memmove_chk.c
@@ -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
diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.c b/sysdeps/x86_64/multiarch/mempcpy_chk.c
index 36c81ae..83569cf 100644
--- a/sysdeps/x86_64/multiarch/mempcpy_chk.c
+++ b/sysdeps/x86_64/multiarch/mempcpy_chk.c
@@ -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
diff --git a/sysdeps/x86_64/multiarch/memset_chk.c b/sysdeps/x86_64/multiarch/memset_chk.c
index d81147a..1a75038 100644
--- a/sysdeps/x86_64/multiarch/memset_chk.c
+++ b/sysdeps/x86_64/multiarch/memset_chk.c
@@ -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