aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-09 21:07:30 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-09 21:07:30 +0000
commit2f44ee08dbf51d39ef5692699cc35f93faf64db1 (patch)
treeb913fa3ca4962e28816eaf8a2d9fa03db0620ff2
parentd3ab671c942ba15a5b20f383ce71e387f17ae2c4 (diff)
downloadglibc-2f44ee08dbf51d39ef5692699cc35f93faf64db1.zip
glibc-2f44ee08dbf51d39ef5692699cc35f93faf64db1.tar.gz
glibc-2f44ee08dbf51d39ef5692699cc35f93faf64db1.tar.bz2
Fix regcomp wcscoll, wcscmp namespace (bug 18497).
regcomp brings in references to wcscoll, which isn't in all the standards that contain regcomp. In turn, wcscoll brings in references to wcscmp, also not in all those standards. This patch fixes this by making those functions into weak aliases of __wcscoll and __wcscmp and calling those names instead as needed. Tested for x86_64 and x86 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #18497] * wcsmbs/wcscmp.c [!WCSCMP] (WCSCMP): Define as __wcscmp instead of wcscmp. (wcscmp): Define as weak alias of WCSCMP. * wcsmbs/wcscoll.c (STRCOLL): Define as __wcscoll instead of wcscoll. (USE_HIDDEN_DEF): Define. [!USE_IN_EXTENDED_LOCALE_MODEL] (wcscoll): Define as weak alias of __wcscoll. Don't use libc_hidden_weak. * wcsmbs/wcscoll_l.c (STRCMP): Define as __wcscmp instead of wcscmp. * sysdeps/i386/i686/multiarch/wcscmp-c.c [SHARED] (libc_hidden_def): Define __GI___wcscmp instead of __GI_wcscmp. (weak_alias): Undefine and redefine. * sysdeps/i386/i686/multiarch/wcscmp.S (wcscmp): Rename to __wcscmp and define as weak alias of __wcscmp. * sysdeps/x86_64/wcscmp.S (wcscmp): Likewise. * include/wchar.h (__wcscmp): Declare. Use libc_hidden_proto. (__wcscoll): Likewise. (wcscmp): Don't use libc_hidden_proto. (wcscoll): Likewise. * posix/regcomp.c (build_range_exp): Call __wcscoll instead of wcscoll. * posix/regexec.c (check_node_accept_bytes): Likewise. * conform/Makefile (test-xfail-XPG3/regex.h/linknamespace): Remove variable. (test-xfail-XPG4/regex.h/linknamespace): Likewise. (test-xfail-POSIX/regex.h/linknamespace): Likewise.
-rw-r--r--ChangeLog30
-rw-r--r--NEWS2
-rw-r--r--conform/Makefile3
-rw-r--r--include/wchar.h11
-rw-r--r--posix/regcomp.c6
-rw-r--r--posix/regexec.c4
-rw-r--r--sysdeps/i386/i686/multiarch/wcscmp-c.c4
-rw-r--r--sysdeps/i386/i686/multiarch/wcscmp.S7
-rw-r--r--sysdeps/x86_64/wcscmp.S7
-rw-r--r--wcsmbs/wcscmp.c3
-rw-r--r--wcsmbs/wcscoll.c5
-rw-r--r--wcsmbs/wcscoll_l.c2
12 files changed, 61 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 39622d6..2501f45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,35 @@
2015-06-09 Joseph Myers <joseph@codesourcery.com>
+ [BZ #18497]
+ * wcsmbs/wcscmp.c [!WCSCMP] (WCSCMP): Define as __wcscmp instead
+ of wcscmp.
+ (wcscmp): Define as weak alias of WCSCMP.
+ * wcsmbs/wcscoll.c (STRCOLL): Define as __wcscoll instead of
+ wcscoll.
+ (USE_HIDDEN_DEF): Define.
+ [!USE_IN_EXTENDED_LOCALE_MODEL] (wcscoll): Define as weak alias of
+ __wcscoll. Don't use libc_hidden_weak.
+ * wcsmbs/wcscoll_l.c (STRCMP): Define as __wcscmp instead of
+ wcscmp.
+ * sysdeps/i386/i686/multiarch/wcscmp-c.c
+ [SHARED] (libc_hidden_def): Define __GI___wcscmp instead of
+ __GI_wcscmp.
+ (weak_alias): Undefine and redefine.
+ * sysdeps/i386/i686/multiarch/wcscmp.S (wcscmp): Rename to
+ __wcscmp and define as weak alias of __wcscmp.
+ * sysdeps/x86_64/wcscmp.S (wcscmp): Likewise.
+ * include/wchar.h (__wcscmp): Declare. Use libc_hidden_proto.
+ (__wcscoll): Likewise.
+ (wcscmp): Don't use libc_hidden_proto.
+ (wcscoll): Likewise.
+ * posix/regcomp.c (build_range_exp): Call __wcscoll instead of
+ wcscoll.
+ * posix/regexec.c (check_node_accept_bytes): Likewise.
+ * conform/Makefile (test-xfail-XPG3/regex.h/linknamespace): Remove
+ variable.
+ (test-xfail-XPG4/regex.h/linknamespace): Likewise.
+ (test-xfail-POSIX/regex.h/linknamespace): Likewise.
+
[BZ #18507]
* sysdeps/unix/sysv/linux/fstatvfs.c (fstatvfs): Rename to
__fstatvfs and define as weak alias of __fstatvfs. Use
diff --git a/NEWS b/NEWS
index 03afc5f..221ec2f 100644
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.22
18111, 18116, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210,
18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324,
18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444,
- 18468, 18469, 18470, 18483, 18495, 18496, 18498, 18507.
+ 18468, 18469, 18470, 18483, 18495, 18496, 18497, 18498, 18507.
* Cache information can be queried via sysconf() function on s390 e.g. with
_SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/conform/Makefile b/conform/Makefile
index 12ccc64..8e76bcb 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -346,20 +346,17 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
# Unsorted expected failures.
test-xfail-XPG3/glob.h/linknamespace = yes
-test-xfail-XPG3/regex.h/linknamespace = yes
test-xfail-XPG3/unistd.h/linknamespace = yes
test-xfail-XPG3/wordexp.h/linknamespace = yes
test-xfail-XPG4/fmtmsg.h/linknamespace = yes
test-xfail-XPG4/glob.h/linknamespace = yes
test-xfail-XPG4/netdb.h/linknamespace = yes
-test-xfail-XPG4/regex.h/linknamespace = yes
test-xfail-XPG4/stdlib.h/linknamespace = yes
test-xfail-XPG4/syslog.h/linknamespace = yes
test-xfail-XPG4/unistd.h/linknamespace = yes
test-xfail-XPG4/wordexp.h/linknamespace = yes
test-xfail-POSIX/aio.h/linknamespace = yes
test-xfail-POSIX/mqueue.h/linknamespace = yes
-test-xfail-POSIX/regex.h/linknamespace = yes
test-xfail-POSIX/semaphore.h/linknamespace = yes
test-xfail-UNIX98/fmtmsg.h/linknamespace = yes
test-xfail-UNIX98/mqueue.h/linknamespace = yes
diff --git a/include/wchar.h b/include/wchar.h
index eb1cb0d..449ad1d 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -81,17 +81,22 @@ libc_hidden_proto (vswscanf)
libc_hidden_proto (mbrtowc)
libc_hidden_proto (wcrtomb)
-libc_hidden_proto (wcscmp)
+extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2)
+ __THROW __attribute_pure__;
+libc_hidden_proto (__wcscmp)
libc_hidden_proto (wcsftime)
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. The same applies to __wmemchr. */
+ tests; in addition, __THROW cannot be used with a function type
+ from typeof in C++. The same applies to __wmemchr and, as regards
+ __THROW, to __wcscmp and __wcscoll. */
extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
__THROW __attribute_pure__;
libc_hidden_proto (__wcschr)
-libc_hidden_proto (wcscoll)
+extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
+libc_hidden_proto (__wcscoll)
libc_hidden_proto (wcspbrk)
extern typeof (wmemset) __wmemset;
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 728c482..bf8aa16 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2683,7 +2683,7 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
return REG_ECOLLATE;
cmp_buf[0] = start_wc;
cmp_buf[4] = end_wc;
- if (wcscoll (cmp_buf, cmp_buf + 4) > 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 4) > 0)
return REG_ERANGE;
/* Got valid collation sequence values, add them as a new entry.
@@ -2725,8 +2725,8 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
for (wc = 0; wc < SBC_MAX; ++wc)
{
cmp_buf[2] = wc;
- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 2) <= 0
+ && __wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
bitset_set (sbcset, wc);
}
}
diff --git a/posix/regexec.c b/posix/regexec.c
index 7022581..70cd606 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -3968,8 +3968,8 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
{
cmp_buf[0] = cset->range_starts[i];
cmp_buf[4] = cset->range_ends[i];
- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 2) <= 0
+ && __wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
{
match_len = char_len;
goto check_node_accept_bytes_match;
diff --git a/sysdeps/i386/i686/multiarch/wcscmp-c.c b/sysdeps/i386/i686/multiarch/wcscmp-c.c
index 165c56a..e3337d7 100644
--- a/sysdeps/i386/i686/multiarch/wcscmp-c.c
+++ b/sysdeps/i386/i686/multiarch/wcscmp-c.c
@@ -4,8 +4,10 @@
#ifdef SHARED
# undef libc_hidden_def
# define libc_hidden_def(name) \
- __hidden_ver1 (__wcscmp_ia32, __GI_wcscmp, __wcscmp_ia32);
+ __hidden_ver1 (__wcscmp_ia32, __GI___wcscmp, __wcscmp_ia32);
#endif
+#undef weak_alias
+#define weak_alias(name, alias)
extern __typeof (wcscmp) __wcscmp_ia32;
diff --git a/sysdeps/i386/i686/multiarch/wcscmp.S b/sysdeps/i386/i686/multiarch/wcscmp.S
index 43fe0a3..92c2c84 100644
--- a/sysdeps/i386/i686/multiarch/wcscmp.S
+++ b/sysdeps/i386/i686/multiarch/wcscmp.S
@@ -26,8 +26,8 @@
happened. */
#if IS_IN (libc)
.text
-ENTRY(wcscmp)
- .type wcscmp, @gnu_indirect_function
+ENTRY(__wcscmp)
+ .type __wcscmp, @gnu_indirect_function
pushl %ebx
cfi_adjust_cfa_offset (4)
cfi_rel_offset (ebx, 0)
@@ -43,5 +43,6 @@ ENTRY(wcscmp)
cfi_adjust_cfa_offset (-4);
cfi_restore (ebx)
ret
-END(wcscmp)
+END(__wcscmp)
+weak_alias (__wcscmp, wcscmp)
#endif
diff --git a/sysdeps/x86_64/wcscmp.S b/sysdeps/x86_64/wcscmp.S
index 5d6806c..bd36d9f 100644
--- a/sysdeps/x86_64/wcscmp.S
+++ b/sysdeps/x86_64/wcscmp.S
@@ -22,7 +22,7 @@
/* Note: wcscmp uses signed comparison, not unsighed as in strcmp function. */
.text
-ENTRY (wcscmp)
+ENTRY (__wcscmp)
/*
* This implementation uses SSE to compare up to 16 bytes at a time.
*/
@@ -945,5 +945,6 @@ L(equal):
xor %rax, %rax
ret
-END (wcscmp)
-libc_hidden_def (wcscmp)
+END (__wcscmp)
+libc_hidden_def (__wcscmp)
+weak_alias (__wcscmp, wcscmp)
diff --git a/wcsmbs/wcscmp.c b/wcsmbs/wcscmp.c
index 88efc5b..fcfe0c5 100644
--- a/wcsmbs/wcscmp.c
+++ b/wcsmbs/wcscmp.c
@@ -19,7 +19,7 @@
#include <wchar.h>
#ifndef WCSCMP
-# define WCSCMP wcscmp
+# define WCSCMP __wcscmp
#endif
/* Compare S1 and S2, returning less than, equal to or
@@ -44,3 +44,4 @@ WCSCMP (s1, s2)
return c1 < c2 ? -1 : 1;
}
libc_hidden_def (WCSCMP)
+weak_alias (WCSCMP, wcscmp)
diff --git a/wcsmbs/wcscoll.c b/wcsmbs/wcscoll.c
index c64dd24..7176930 100644
--- a/wcsmbs/wcscoll.c
+++ b/wcsmbs/wcscoll.c
@@ -21,11 +21,12 @@
#define STRING_TYPE wchar_t
#define USTRING_TYPE wint_t
-#define STRCOLL wcscoll
+#define STRCOLL __wcscoll
#define STRCOLL_L __wcscoll_l
+#define USE_HIDDEN_DEF
#include "../string/strcoll.c"
#ifndef USE_IN_EXTENDED_LOCALE_MODEL
-libc_hidden_weak (wcscoll)
+weak_alias (__wcscoll, wcscoll)
#endif
diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
index 9f60cee..6d9384a 100644
--- a/wcsmbs/wcscoll_l.c
+++ b/wcsmbs/wcscoll_l.c
@@ -24,7 +24,7 @@
#define USTRING_TYPE wint_t
#define STRCOLL __wcscoll_l
#define STRDIFF __wcsdiff
-#define STRCMP wcscmp
+#define STRCMP __wcscmp
#define WEIGHT_H "../locale/weightwc.h"
#define SUFFIX WC
#define L(arg) L##arg