xen-unstable: fix stubdom newlib SIZE_MAX definition in stdint.h
PATCH 1/1 xen-unstable: fix stubdom newlib SIZE_MAX definition in stdint.h
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
stubdom/Makefile renamed from stubdom/Makefile.orig +1 -0
@@ -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
newlib/libc/include/stdint.h renamed from newlib/libc/include/stdint.h.orig +5 -2
@@ -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 <signal.h> (currently int) */ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel