This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Newlib _ctype_ alias kludge now invalid due to PR middle-end/15700fix.


Corinna Vinschen wrote:
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.


This is introducing machine-specific code into a shared file. I would rather see you add a new ctype_.c file in libc/machine/i386 which uses the .asm method and avoids the array aliasing altogether. That should solve your problem and remove the need for Cygwin flag checks in the shared ctype_.c file.


-- Jeff J.

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) */




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]