Newlib _ctype_ alias kludge now invalid due to PR middle-end/15700 fix.
Corinna Vinschen
vinschen@redhat.com
Fri Mar 18 12:49:00 GMT 2005
On Mar 18 10:34, Corinna Vinschen wrote:
> On Mar 17 15:21, Jeff Johnston wrote:
> > Corinna, if this causes any Cygwin issues, please let me know.
>
> The change will break Cygwin's backward compatibility as soon as we start
> building Cygwin with gcc 4.0. [...]
Following a hint I got from Richard Henderson, I'll propose the following
patch, which keeps binary backward compatibility. He suggested to use
direct assembler directives instead of abusing the alias directive.
Corinna
* libc/ctype/ctype_.c (_ctype_): For Cygwin, define using assembler
so to not break binary backward compatibilty.
Index: libc/ctype/ctype_.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/ctype/ctype_.c,v
retrieving revision 1.4
diff -u -p -r1.4 ctype_.c
--- libc/ctype/ctype_.c 17 Mar 2005 20:11:22 -0000 1.4
+++ libc/ctype/ctype_.c 18 Mar 2005 12:32:40 -0000
@@ -90,26 +90,24 @@ _CONST char __declspec(dllexport) *__cty
_CONST char *__ctype_ptr = _ctype_b + 128;
# endif
-# if defined(_HAVE_ARRAY_ALIASING)
+# if defined(__CYGWIN__)
+ __asm__ (
+ ".data \n\t"
+ ".globl __ctype_ \n\t"
+ ".set __ctype_,__ctype_b+127");
+# else
-# if defined(__CYGWIN__)
-extern _CONST char __declspec(dllexport) _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127")));
-# else
+# if defined(_HAVE_ARRAY_ALIASING)
extern _CONST char _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127")));
-# endif
-
-# else /* !_HAVE_ARRAY_ALIASING */
-
-# if defined(__CYGWIN__)
-_CONST char __declspec(dllexport) _ctype_[1 + 256] = {
-# else
+# else /* !_HAVE_ARRAY_ALIASING */
_CONST char _ctype_[1 + 256] = {
-# endif
0,
_CTYPE_DATA_0_127,
_CTYPE_DATA_128_256
};
-# endif /* !_HAVE_ARRAY_ALIASING */
+# endif /* !_HAVE_ARRAY_ALIASING */
+
+# endif /* !__CYGWIN__ */
#else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.
More information about the Newlib
mailing list