From: Pasi =?iso-8859-1?Q?K=E4rkk=E4inen?= Subject: [PATCH] xen-unstable: fix stubdom newlib SIZE_MAX definition in stdint.h Date: Tue, 25 Aug 2009 17:57:02 +0300 Message-ID: <20090825145702.GA19938@edu.joroinen.fi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3MMMIZFJzhAsRj/+" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --3MMMIZFJzhAsRj/+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, While working on adding bzip2/lzma decompression support into stubdom/pvgrub I noticed a problem in newlib 1.16.0 (current version in xen-unstable) libc/include/stdint.h. It defines SIZE_MAX like this: #define SIZE_MAX __STDINT_EXP(LONG_MAX) Which is an incorrect signed value. This problem is fixed in upstream newlib 1.17.0. The correct definition is this: #ifdef __SIZE_MAX__ #define SIZE_MAX __SIZE_MAX__ #else #define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) #endif The attached patches fix this problem. These are needed for being able to build lzma (xz) libs for stubdom/pvgrub. -- Pasi --3MMMIZFJzhAsRj/+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="stubdom-Makefile-add-newlib-size_max-patch.patch" --- xen-unstable.hg/stubdom/Makefile.orig 2009-08-25 17:35:26.000000000 +0300 +++ xen-unstable.hg/stubdom/Makefile 2009-08-25 17:37:01.000000000 +0300 @@ -101,6 +101,7 @@ tar xzf $< patch -d $@ -p0 < newlib.patch patch -d $@ -p0 < newlib-chk.patch + patch -d $@ -p1 < newlib-stdint-size_max-fix-from-1.17.0.patch touch $@ NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a --3MMMIZFJzhAsRj/+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="newlib-stdint-size_max-fix-from-1.17.0.patch" --- newlib-1.16.0/newlib/libc/include/stdint.h.orig 2006-08-17 00:39:43.000000000 +0300 +++ newlib-1.16.0/newlib/libc/include/stdint.h 2009-08-25 17:33:23.000000000 +0300 @@ -348,8 +348,11 @@ #endif /* This must match size_t in stddef.h, currently long unsigned int */ -#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L) -#define SIZE_MAX __STDINT_EXP(LONG_MAX) +#ifdef __SIZE_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#else +#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) +#endif /* This must match sig_atomic_t in (currently int) */ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1) --3MMMIZFJzhAsRj/+ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --3MMMIZFJzhAsRj/+--