From 1875ee55d31d3673059373c8f9837bf98f93c713 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 23 Apr 2013 09:42:25 +0000 Subject: Port newlib to x86_64-pc-cygwin. * libc/include/sys/features.h: Redefine compilation environment definitions for Cygwin to cover 64 bit Cygwin. * libc/ctype/ctype_.c (_ctype_): Fix definition for 64 bit Cygwin. * libc/include/machine/setjmp.h: Change definition of _JBLEN to allow different values for 32 bit and 64 bit Cygwin. * libc/include/reent.h (stat64): Define as stat under Cygwin, instead of as __stat64. Undef stat64 if not building Newlib. * libc/include/sys/stat.h (stat64): Define as stat under Cygwin. --- newlib/ChangeLog | 12 ++++++++++++ newlib/libc/ctype/ctype_.c | 11 +++++++++-- newlib/libc/include/machine/setjmp.h | 25 +++++++++++++++---------- newlib/libc/include/reent.h | 12 +++++++++--- newlib/libc/include/sys/features.h | 12 +++++++++--- newlib/libc/include/sys/stat.h | 2 +- 6 files changed, 55 insertions(+), 19 deletions(-) (limited to 'newlib') diff --git a/newlib/ChangeLog b/newlib/ChangeLog index c6add4514..ce4dda4fe 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,15 @@ +2013-04-23 Corinna Vinschen + + Port newlib to x86_64-pc-cygwin. + * libc/include/sys/features.h: Redefine compilation environment + definitions for Cygwin to cover 64 bit Cygwin. + * libc/ctype/ctype_.c (_ctype_): Fix definition for 64 bit Cygwin. + * libc/include/machine/setjmp.h: Change definition of _JBLEN to allow + different values for 32 bit and 64 bit Cygwin. + * libc/include/reent.h (stat64): Define as stat under Cygwin, instead + of as __stat64. Undef stat64 if not building Newlib. + * libc/include/sys/stat.h (stat64): Define as stat under Cygwin. + 2013-04-22 Sebastian Huber * libc/include/sys/cdefs.h: Align with latest FreeBSD file header. diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index c3615d2a1..164a8eed7 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -111,14 +111,21 @@ _CONST char __EXPORT *__ctype_ptr__ = (char *) _ctype_b + 127; # ifdef __CYGWIN__ - +# ifdef __x86_64__ +__asm__ (" \n\ + .data \n\ + .globl _ctype_ \n\ + .set _ctype_,_ctype_b+127 \n\ + .text \n\ +"); +# else __asm__ (" \n\ .data \n\ .globl __ctype_ \n\ .set __ctype_,__ctype_b+127 \n\ .text \n\ "); - +# endif # else /* !__CYGWIN__ */ _CONST char _ctype_[1 + 256] = { diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h index 31a8032d8..97749c0cb 100644 --- a/newlib/libc/include/machine/setjmp.h +++ b/newlib/libc/include/machine/setjmp.h @@ -68,19 +68,24 @@ _BEGIN_STD_C #define _JBLEN 9 #endif -#if defined(__CYGWIN__) && !defined (_JBLEN) -#define _JBLEN (13 * 4) -#elif defined (__i386__) -#if defined(__unix__) || defined(__rtems__) -# define _JBLEN 9 -#else -#include "setjmp-dj.h" -#endif +#ifdef __i386__ +# if defined(__CYGWIN__) && !defined (_JBLEN) +# define _JBLEN (13 * 4) +# elif defined(__unix__) || defined(__rtems__) +# define _JBLEN 9 +# else +# include "setjmp-dj.h" +# endif #endif #ifdef __x86_64__ -#define _JBTYPE long long -#define _JBLEN 8 +# ifdef __CYGWIN__ +# define _JBTYPE long +# define _JBLEN 32 +# else +# define _JBTYPE long long +# define _JBLEN 8 +# endif #endif #ifdef __i960__ diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h index 4617c0d96..861be71d3 100644 --- a/newlib/libc/include/reent.h +++ b/newlib/libc/include/reent.h @@ -163,16 +163,22 @@ extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *__tp, void #ifdef __LARGE64_FILES -#if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB) -#define stat64 __stat64 -#endif +#if defined(__CYGWIN__) +#define stat64 stat +#endif struct stat64; extern _off64_t _lseek64_r _PARAMS ((struct _reent *, int, _off64_t, int)); extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *)); extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int)); extern int _stat64_r _PARAMS ((struct _reent *, const char *, struct stat64 *)); + +/* Don't pollute namespace if not building newlib. */ +#if defined (__CYGWIN__) && !defined (_COMPILING_NEWLIB) +#undef stat64 +#endif + #endif #endif diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index b5e003b5f..a3ba513bf 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -173,12 +173,18 @@ extern "C" { #define _POSIX2_SW_DEV 200112L #define _POSIX2_UPE 200112L #define _POSIX_V6_ILP32_OFF32 -1 -#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 +#ifdef __LP64__ +#define _POSIX_V6_ILP32_OFFBIG -1 +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V6_LPBIG_OFFBIG 1 +#else #define _POSIX_V6_ILP32_OFFBIG 1 -#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG #define _POSIX_V6_LP64_OFF64 -1 -#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64 #define _POSIX_V6_LPBIG_OFFBIG -1 +#endif +#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 +#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG +#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64 #define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG #define _XOPEN_CRYPT 1 #define _XOPEN_ENH_I18N 1 diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index fa2036dd3..937bcacd2 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -19,7 +19,7 @@ extern "C" { #ifdef __CYGWIN__ #include #ifdef _COMPILING_NEWLIB -#define stat64 __stat64 +#define stat64 stat #endif #else struct stat -- cgit v1.2.3