[PATCH] Make string _chk functions available for glibc tests
H.J. Lu
hjl.tools@gmail.com
Mon Dec 16 21:49:31 GMT 2024
String _chk functions are exported in libc.so.6, but their prototypes
aren't provided since they can be used by GCC directly without prototypes.
But some glibc tests are using them and Clang issues an error:
./tst-gnuglob-skeleton.c:225:3: error: call to undeclared function '__strcpy_chk'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
225 | __strcpy_chk (dir->d.d_name, filesystem[dir->idx].name, NAME_MAX);
| ^
Make string _chk function prototypes available for glibc tests to avoid
Clang error.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
include/string.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/string.h b/include/string.h
index 3b4c6007d7..cfeea9a403 100644
--- a/include/string.h
+++ b/include/string.h
@@ -183,6 +183,8 @@ extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
#endif
+#endif /* _ISOMAC */
+
extern void *__memcpy_chk (void *__restrict __dest,
const void *__restrict __src, size_t __len,
size_t __destlen) __THROW;
@@ -209,6 +211,8 @@ extern char *__strncat_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __len, size_t __destlen) __THROW;
+#ifndef _ISOMAC
+
libc_hidden_builtin_proto (__memcpy_chk)
libc_hidden_builtin_proto (__memmove_chk)
libc_hidden_builtin_proto (__mempcpy_chk)
--
2.47.1
More information about the Libc-alpha
mailing list