From bb4acb522c9206b8476a88be44606bf1bc1e96f6 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 2 Jun 2015 20:23:09 +0000 Subject: Fix fnmatch towlower namespace (bug 18469). fnmatch brings in references to towlower (and thereby towupper), which isn't in all the standards that contain fnmatch, resulting in linknamespace test failures. (This is contrary to glibc conventions, rather than a standards conformance issue, because of the to* reservation.) This patch fixes this in the usual way, making those functions into weak aliases. Tested for x86_64 and x86 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). This is on top of , but the two patches should be independent. (The __attribute_pure__ on the declarations in include/wctype.h comes from GCC's built-in attributes for towlower and towupper, and is needed to get the same code generation for fnmatch before and after the patch. It seems likely there are cases where the declaration of __foo in the internal headers is missing attributes from foo in the public headers, built-in to GCC or both, but I don't know a good way to detect such missing attributes.) [BZ #18469] * wctype/wcfuncs.c (towlower): Rename to __towlower and define as weak alias of __towlower. Use libc_hidden_weak. (towupper): Rename to __towupper and define as weak alias of __towupper. Use libc_hidden_weak. * include/wctype.h (__towlower): Declare. Use libc_hidden_proto. (__towupper): Likewise. * posix/fnmatch.c [HANDLE_MULTIBYTE && _LIBC] (FOLD): Use __towlower instead of towlower. --- wctype/wcfuncs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'wctype') diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c index 87bdcc5311..788fed9a6a 100644 --- a/wctype/wcfuncs.c +++ b/wctype/wcfuncs.c @@ -69,22 +69,26 @@ libc_hidden_weak (iswxdigit) #undef towlower wint_t -towlower (wc) +__towlower (wc) wint_t wc; { size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower; const char *desc = _NL_CURRENT (LC_CTYPE, i); return wctrans_table_lookup (desc, wc); } -libc_hidden_def (towlower) +libc_hidden_def (__towlower) +weak_alias (__towlower, towlower) +libc_hidden_weak (towlower) #undef towupper wint_t -towupper (wc) +__towupper (wc) wint_t wc; { size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper; const char *desc = _NL_CURRENT (LC_CTYPE, i); return wctrans_table_lookup (desc, wc); } -libc_hidden_def (towupper) +libc_hidden_def (__towupper) +weak_alias (__towupper, towupper) +libc_hidden_weak (towupper) -- cgit 1.4.1