about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-03 13:57:40 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-03 13:57:40 +0000
commitaca6ea6586fb2368e6659388f55ba3d374913a86 (patch)
tree5c260dd187f8733f706798009b340355d509ab34
parent1a1a6bde63e0af0d5f2f3465ba45338e7513c4e4 (diff)
downloadglibc-aca6ea6586fb2368e6659388f55ba3d374913a86.tar.gz
glibc-aca6ea6586fb2368e6659388f55ba3d374913a86.tar.xz
glibc-aca6ea6586fb2368e6659388f55ba3d374913a86.zip
Fix fnmatch wmemchr namespace (bug 18468).
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.
-rw-r--r--ChangeLog9
-rw-r--r--NEWS2
-rw-r--r--include/wchar.h5
-rw-r--r--posix/fnmatch.c2
-rw-r--r--wcsmbs/wmemchr.c6
5 files changed, 19 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a8d9658111..0a3cc895c4 100644
--- 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 ed02de066a..1701e4a8f6 100644
--- 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.
diff --git a/include/wchar.h b/include/wchar.h
index 7b5e1a16a3..eb1cb0da04 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -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)
 
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index 7480ec7f00..760cceae6b 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -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
diff --git a/wcsmbs/wmemchr.c b/wcsmbs/wmemchr.c
index 5c74d93258..266950c84b 100644
--- a/wcsmbs/wmemchr.c
+++ b/wcsmbs/wmemchr.c
@@ -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)