Fix fnmatch wmemchr namespace (bug 18468).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 3 Jun 2015 13:57:40 +0000 (13:57 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 3 Jun 2015 13:57:40 +0000 (13:57 +0000)
fnmatch brings in references to wmemchr, which isn't in all the
standards that contain fnmatch, resulting in linknamespace test
failures.  This patch fixes this in the usual way, making wmemchr into
a weak alias for __wmemchr.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

[BZ #18468]
* wcsmbs/wmemchr.c (wmemchr): Rename to __wmemchr and define as
weak alias of __wmemchr.  Use libc_hidden_weak.
* include/wchar.h (__wmemchr): Declare.  Use libc_hidden_proto.
* posix/fnmatch.c [HANDLE_MULTIBYTE] (MEMCHR): Use __wmemchr
instead of wmemchr.

ChangeLog
NEWS
include/wchar.h
posix/fnmatch.c
wcsmbs/wmemchr.c

index a8d9658..0a3cc89 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-06-03  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #18468]
+       * wcsmbs/wmemchr.c (wmemchr): Rename to __wmemchr and define as
+       weak alias of __wmemchr.  Use libc_hidden_weak.
+       * include/wchar.h (__wmemchr): Declare.  Use libc_hidden_proto.
+       * posix/fnmatch.c [HANDLE_MULTIBYTE] (MEMCHR): Use __wmemchr
+       instead of wmemchr.
+
 2015-06-02  Roland McGrath  <roland@hack.frob.com>
 
        [BZ #18383]
diff --git a/NEWS b/NEWS
index ed02de0..1701e4a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,7 +19,7 @@ Version 2.22
   18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18116,
   18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217,
   18220, 18221, 18234, 18244, 18247, 18287, 18319, 18333, 18346, 18397,
-  18409, 18410, 18412, 18418, 18422, 18434, 18444, 18469.
+  18409, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 7b5e1a1..eb1cb0d 100644 (file)
@@ -87,7 +87,7 @@ libc_hidden_proto (wcsspn)
 libc_hidden_proto (wcschr)
 /* The C++ overloading of wcschr means we have to repeat the type to
    declare __wcschr instead of using typeof, to avoid errors in C++
-   tests.  */
+   tests.  The same applies to __wmemchr.  */
 extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
 libc_hidden_proto (__wcschr)
@@ -95,7 +95,10 @@ libc_hidden_proto (wcscoll)
 libc_hidden_proto (wcspbrk)
 
 extern typeof (wmemset) __wmemset;
+extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
+     __THROW __attribute_pure__;
 libc_hidden_proto (wmemchr)
+libc_hidden_proto (__wmemchr)
 libc_hidden_proto (wmemset)
 libc_hidden_proto (__wmemset)
 
index 7480ec7..760ccea 100644 (file)
@@ -245,7 +245,7 @@ __wcschrnul (s, c)
 #  define STRLEN(S) __wcslen (S)
 #  define STRCAT(D, S) __wcscat (D, S)
 #  define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
-#  define MEMCHR(S, C, N) wmemchr (S, C, N)
+#  define MEMCHR(S, C, N) __wmemchr (S, C, N)
 #  define STRCOLL(S1, S2) wcscoll (S1, S2)
 #  define WIDE_CHAR_VERSION 1
 /* Change the name the header defines so it doesn't conflict with
index 5c74d93..266950c 100644 (file)
@@ -19,7 +19,7 @@
 #include <wchar.h>
 
 wchar_t *
-wmemchr (s, c, n)
+__wmemchr (s, c, n)
      const wchar_t *s;
      wchar_t c;
      size_t n;
@@ -59,4 +59,6 @@ wmemchr (s, c, n)
 
   return NULL;
 }
-libc_hidden_def (wmemchr)
+libc_hidden_def (__wmemchr)
+weak_alias (__wmemchr, wmemchr)
+libc_hidden_weak (wmemchr)