From 64f9857507f6dbf9715350b75e83b465be9b8f03 Mon Sep 17 00:00:00 2001 From: Frédéric Bérat Date: Wed, 7 Jun 2023 11:06:50 +0200 Subject: wchar: Avoid PLT entries with _FORTIFY_SOURCE The change is meant to avoid unwanted PLT entries for the wmemset and wcrtomb routines when _FORTIFY_SOURCE is set. On top of that, ensure that *_chk routines have their hidden builtin definitions available. Reviewed-by: Siddhesh Poyarekar --- include/wchar.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/wchar.h b/include/wchar.h index 7b763bc24f..484e6b3fef 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -166,6 +166,8 @@ libc_hidden_proto (putwc) libc_hidden_proto (mbrtowc) libc_hidden_proto (wcrtomb) +libc_hidden_proto (__wcrtomb_chk) + extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2) __THROW __attribute_pure__; libc_hidden_proto (__wcscmp) @@ -260,16 +262,25 @@ extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc) extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns) __THROW; +libc_hidden_builtin_proto (__wmemset_chk) extern int __vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) attribute_hidden /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */; + +extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n, + int __flag, size_t __s_len, + const wchar_t *__restrict __format, ...) + __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */; + extern int __fwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, ...) attribute_hidden /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; +extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, + ...); extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, const wchar_t *__restrict __format, __gnuc_va_list __arg) @@ -279,6 +290,10 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; +extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag, + const wchar_t *__restrict __format, ...); +extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, + __gnuc_va_list __ap); extern int __isoc99_fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...); -- cgit 1.4.1