xref: /OK3568_Linux_fs/buildroot/package/dc3dd/0003-fix-for-glibc-2.28.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFix build with glibc 2.28
2*4882a593Smuzhiyun
3*4882a593Smuzhiyunglibc 2.28 hides a number of internal macros that used to be visible. gnulib
4*4882a593Smuzhiyunrelied on these macros. Add a patch based on upstream gnulib commit
5*4882a593Smuzhiyun4af4a4a71827c0 (fflush: adjust to glibc 2.28 libio.h removal) to fix the
6*4882a593Smuzhiyunbuild.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunSigned-off-by: Baruch Siach <baruch@tkos.co.il>
9*4882a593Smuzhiyun---
10*4882a593SmuzhiyunUpstream status: gnulib commit 4af4a4a7182
11*4882a593Smuzhiyun
12*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/freadahead.c dc3dd-7.2.641/lib/freadahead.c
13*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/freadahead.c	2012-11-06 23:42:58.000000000 +0200
14*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/freadahead.c	2018-10-26 08:46:36.612492230 +0300
15*4882a593Smuzhiyun@@ -24,7 +24,7 @@
16*4882a593Smuzhiyun size_t
17*4882a593Smuzhiyun freadahead (FILE *fp)
18*4882a593Smuzhiyun {
19*4882a593Smuzhiyun-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
20*4882a593Smuzhiyun+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
21*4882a593Smuzhiyun   if (fp->_IO_write_ptr > fp->_IO_write_base)
22*4882a593Smuzhiyun     return 0;
23*4882a593Smuzhiyun   return (fp->_IO_read_end - fp->_IO_read_ptr)
24*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/freadptr.c dc3dd-7.2.641/lib/freadptr.c
25*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/freadptr.c	2012-11-06 23:42:58.000000000 +0200
26*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/freadptr.c	2018-10-26 08:36:53.965310494 +0300
27*4882a593Smuzhiyun@@ -29,7 +29,7 @@
28*4882a593Smuzhiyun   size_t size;
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun   /* Keep this code in sync with freadahead!  */
31*4882a593Smuzhiyun-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
32*4882a593Smuzhiyun+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
33*4882a593Smuzhiyun   if (fp->_IO_write_ptr > fp->_IO_write_base)
34*4882a593Smuzhiyun     return NULL;
35*4882a593Smuzhiyun   size = fp->_IO_read_end - fp->_IO_read_ptr;
36*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/freadseek.c dc3dd-7.2.641/lib/freadseek.c
37*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/freadseek.c	2012-11-06 23:42:58.000000000 +0200
38*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/freadseek.c	2018-10-26 08:49:35.387912087 +0300
39*4882a593Smuzhiyun@@ -34,7 +34,7 @@
40*4882a593Smuzhiyun freadptrinc (FILE *fp, size_t increment)
41*4882a593Smuzhiyun {
42*4882a593Smuzhiyun   /* Keep this code in sync with freadptr!  */
43*4882a593Smuzhiyun-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
44*4882a593Smuzhiyun+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
45*4882a593Smuzhiyun   fp->_IO_read_ptr += increment;
46*4882a593Smuzhiyun #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
47*4882a593Smuzhiyun   fp_->_p += increment;
48*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/fseeko.c dc3dd-7.2.641/lib/fseeko.c
49*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/fseeko.c	2012-11-06 23:42:58.000000000 +0200
50*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/fseeko.c	2018-10-26 08:51:02.841583936 +0300
51*4882a593Smuzhiyun@@ -44,7 +44,7 @@
52*4882a593Smuzhiyun #endif
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun   /* These tests are based on fpurge.c.  */
55*4882a593Smuzhiyun-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
56*4882a593Smuzhiyun+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
57*4882a593Smuzhiyun   if (fp->_IO_read_end == fp->_IO_read_ptr
58*4882a593Smuzhiyun       && fp->_IO_write_ptr == fp->_IO_write_base
59*4882a593Smuzhiyun       && fp->_IO_save_base == NULL)
60*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/fseterr.c dc3dd-7.2.641/lib/fseterr.c
61*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/fseterr.c	2012-11-06 23:42:58.000000000 +0200
62*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/fseterr.c	2018-10-26 08:47:51.209919605 +0300
63*4882a593Smuzhiyun@@ -29,7 +29,7 @@
64*4882a593Smuzhiyun   /* Most systems provide FILE as a struct and the necessary bitmask in
65*4882a593Smuzhiyun      <stdio.h>, because they need it for implementing getc() and putc() as
66*4882a593Smuzhiyun      fast macros.  */
67*4882a593Smuzhiyun-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
68*4882a593Smuzhiyun+#if defined _IO_EOF_SEEN || defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
69*4882a593Smuzhiyun   fp->_flags |= _IO_ERR_SEEN;
70*4882a593Smuzhiyun #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
71*4882a593Smuzhiyun   fp_->_flags |= __SERR;
72*4882a593Smuzhiyundiff -Nuar dc3dd-7.2.641.orig/lib/stdio-impl.h dc3dd-7.2.641/lib/stdio-impl.h
73*4882a593Smuzhiyun--- dc3dd-7.2.641.orig/lib/stdio-impl.h	2012-11-06 23:42:58.000000000 +0200
74*4882a593Smuzhiyun+++ dc3dd-7.2.641/lib/stdio-impl.h	2018-10-26 08:46:26.136291709 +0300
75*4882a593Smuzhiyun@@ -18,6 +18,12 @@
76*4882a593Smuzhiyun    the same implementation of stdio extension API, except that some fields
77*4882a593Smuzhiyun    have different naming conventions, or their access requires some casts.  */
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
80*4882a593Smuzhiyun+   problem by defining it ourselves.  FIXME: Do not rely on glibc
81*4882a593Smuzhiyun+   internals.  */
82*4882a593Smuzhiyun+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
83*4882a593Smuzhiyun+# define _IO_IN_BACKUP 0x100
84*4882a593Smuzhiyun+#endif
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun /* BSD stdio derived implementations.  */
87*4882a593Smuzhiyun
88