From 44af8a32c341672b5160fdc2839767e9a837ad26 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 1 Oct 2017 15:14:17 -0700 Subject: Mark internal wchar functions with attribute_hidden [BZ #18822] Mark internal wchar functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/wchar.h (__wcsnlen): Add attribute_hidden. (__wcscat): Likewise. (__btowc): Likewise. (__wcrtomb): Likewise. (__mbsrtowcs): Likewise. (__wcsrtombs): Likewise. (__mbsnrtowcs): Likewise. (__wcsnrtombs): Likewise. (__wcsncpy): Likewise. (__wcpncpy): Likewise. (__wmemcpy): Likewise. (__wmempcpy): Likewise. (__wmemmove): Likewise. (__wcschrnul): Likewise. (__vfwscanf): Likewise. (__vswprintf): Likewise. (__fwprintf): Likewise. (__vfwprintf): Likewise. --- ChangeLog | 22 ++++++++++++++++++++++ include/wchar.h | 38 ++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index f626ba48a9..c168da16a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-10-01 H.J. Lu + + [BZ #18822] + * include/wchar.h (__wcsnlen): Add attribute_hidden. + (__wcscat): Likewise. + (__btowc): Likewise. + (__wcrtomb): Likewise. + (__mbsrtowcs): Likewise. + (__wcsrtombs): Likewise. + (__mbsnrtowcs): Likewise. + (__wcsnrtombs): Likewise. + (__wcsncpy): Likewise. + (__wcpncpy): Likewise. + (__wmemcpy): Likewise. + (__wmempcpy): Likewise. + (__wmemmove): Likewise. + (__wcschrnul): Likewise. + (__vfwscanf): Likewise. + (__vswprintf): Likewise. + (__fwprintf): Likewise. + (__vfwprintf): Likewise. + 2017-10-01 H.J. Lu [BZ #18822] diff --git a/include/wchar.h b/include/wchar.h index eb472daefb..24b2eaa5f9 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -152,9 +152,10 @@ extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, __attribute_pure__; extern size_t __wcslen (const wchar_t *__s) __attribute_pure__; extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen) - __attribute_pure__; -extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src); -extern wint_t __btowc (int __c); + attribute_hidden __attribute_pure__; +extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src) + attribute_hidden; +extern wint_t __btowc (int __c) attribute_hidden; extern int __mbsinit (const __mbstate_t *__ps); extern size_t __mbrtowc (wchar_t *__restrict __pwc, const char *__restrict __s, size_t __n, @@ -162,34 +163,39 @@ extern size_t __mbrtowc (wchar_t *__restrict __pwc, libc_hidden_proto (__mbrtowc) libc_hidden_proto (__mbrlen) extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, - __mbstate_t *__restrict __ps); + __mbstate_t *__restrict __ps) attribute_hidden; extern size_t __mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, - size_t __len, __mbstate_t *__restrict __ps); + size_t __len, __mbstate_t *__restrict __ps) + attribute_hidden; extern size_t __wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, - size_t __len, __mbstate_t *__restrict __ps); + size_t __len, __mbstate_t *__restrict __ps) + attribute_hidden; extern size_t __mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, - size_t __len, __mbstate_t *__restrict __ps); + size_t __len, __mbstate_t *__restrict __ps) + attribute_hidden; extern size_t __wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, - __mbstate_t *__restrict __ps); + __mbstate_t *__restrict __ps) + attribute_hidden; extern wchar_t *__wcsncpy (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, size_t __n); + const wchar_t *__restrict __src, size_t __n) + attribute_hidden; extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src); extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src, - size_t __n); + size_t __n) attribute_hidden; extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2, - size_t __n); + size_t __n) attribute_hidden; extern wchar_t *__wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, - size_t __n); + size_t __n) attribute_hidden; extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2, - size_t __n); + size_t __n) attribute_hidden; extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc) - __attribute_pure__; + attribute_hidden __attribute_pure__; extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns) __THROW; @@ -197,17 +203,21 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, extern int __vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) + attribute_hidden /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */; extern int __vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, __gnuc_va_list __arg) + attribute_hidden /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; extern int __fwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, ...) + attribute_hidden /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; extern int __vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) + attribute_hidden /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, const wchar_t *__restrict __format, -- cgit v1.2.3