mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-19 13:40:59 +08:00
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.
This commit is contained in:
parent
d3ab671c94
commit
2f44ee08db
30
ChangeLog
30
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
|
||||
|
2
NEWS
2
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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user