gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / glibc-boot-2.2.5.patch
1 This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
2
3 * Makefile: Do not assemble from stdin, use file indirection.
4 * Makefile: Add new target: install-lib-all.
5 * Makefile: Avoid building stub DOC.
6 * [_LIBC_REENTRANT]: Add missing guarding.
7 * [MES_BOOTSTRAP]: Disable some GCC extensions.
8 * [MES_BOOTSTRAP]: Add missing GCC div/mod defines.
9
10 Upstream status: Not presented upstream.
11
12 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/config.h.in glibc-2.2.5/config.h.in
13 --- ../glibc-2.2.5/config.h.in 2001-11-16 02:02:56.000000000 +0100
14 +++ glibc-2.2.5/config.h.in 2018-06-17 21:30:02.313029074 +0200
15 @@ -1,3 +1,10 @@
16 +#if MES_BOOTSTRAP && BOOTSTRAP_GLIBC
17 +#undef __umoddi3
18 +#define __umoddi3(a,b) ((a)%(b))
19 +#undef __udivdi3
20 +#define __udivdi3(a,b) ((a)/(b))
21 +#endif
22 +
23 #if !defined ASSEMBLER && !defined _ISOMAC && !defined __OPTIMIZE__
24 # error "glibc cannot be compiled without optimization"
25 #endif
26 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/configure glibc-2.2.5/configure
27 --- ../glibc-2.2.5/configure 2002-01-08 23:16:44.000000000 +0100
28 +++ glibc-2.2.5/configure 2018-06-07 20:47:26.608895319 +0200
29 @@ -1530,7 +1530,7 @@ echo "configure:1530: checking version o
30 ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
31 case $ac_prog_version in
32 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
33 - 3.79* | 3.[89]*)
34 + 3.79* | 3.[89]* | 4.*)
35 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
36 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
37
38 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Makeconfig glibc-2.2.5/Makeconfig
39 --- ../glibc-2.2.5/Makeconfig 2001-09-12 20:49:45.000000000 +0200
40 +++ glibc-2.2.5/Makeconfig 2018-06-20 16:33:35.472167202 +0200
41 @@ -400,7 +400,7 @@ ifndef +link
42 $(start-installed-name))\
43 $(+preinit) $(link-extra-libs) \
44 $(common-objpfx)libc% $(+postinit),$^) \
45 - $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
46 + $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) -lc -lgcc2
47 endif
48 # Command for statically linking programs with the C library.
49 ifndef +link-static
50 @@ -412,7 +412,7 @@ ifndef +link-static
51 $(start-installed-name))\
52 $(+preinit) $(link-extra-libs-static) \
53 $(common-objpfx)libc% $(+postinit),$^) \
54 - $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
55 + $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) -lc -lgcc2
56 endif
57 # Command for statically linking bounded-pointer programs with the C library.
58 ifndef +link-bounded
59 @@ -424,7 +424,7 @@ ifndef +link-bounded
60 $(start-installed-name))\
61 $(+preinit) $(link-extra-libs-bounded) \
62 $(common-objpfx)libc% $(+postinit),$^) \
63 - $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
64 + $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit) -lc -lgcc2
65 endif
66 ifndef config-LDFLAGS
67 ifeq (yesyes,$(build-shared)$(elf))
68 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Makerules glibc-2.2.5/Makerules
69 --- ../glibc-2.2.5/Makerules 2001-11-16 02:02:19.000000000 +0100
70 +++ glibc-2.2.5/Makerules 2018-06-10 15:03:42.390329860 +0200
71 @@ -748,6 +748,18 @@ endef
72 installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
73 $(inst_libdir)/$(patsubst %,$(libtype$o),\
74 $(libprefix)$(libc-name)))
75 +
76 +ifeq (yes,$(build-shared))
77 +install-lib-all: $(inst_libdir)/libc.a \
78 + $(inst_slibdir)/libc.so$(libc.so-version) \
79 + $(inst_slibdir)/libc-$(version).so \
80 + $(inst_libdir)/libc.so \
81 + install-lib
82 +else
83 +install-lib-all: $(inst_libdir)/libc.a \
84 + install-lib
85 +endif
86 +
87 install: $(installed-libcs)
88 $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
89 $(make-target-directory)
90 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/misc/syslog.c glibc-2.2.5/misc/syslog.c
91 --- ../glibc-2.2.5/misc/syslog.c 2001-08-31 01:13:49.000000000 +0200
92 +++ glibc-2.2.5/misc/syslog.c 2018-06-09 09:01:20.008918690 +0200
93 @@ -216,9 +216,11 @@ vsyslog(pri, fmt, ap)
94
95 /* Prepare for multiple users. We have to take care: open and
96 write are cancellation points. */
97 +#if _LIBC_REENTRANT
98 __libc_cleanup_region_start (1, (void (*) (void *)) cancel_handler,
99 &oldaction_ptr);
100 __libc_lock_lock (syslog_lock);
101 +#endif
102
103 /* Prepare for a broken connection. */
104 memset (&action, 0, sizeof (action));
105 @@ -268,9 +270,11 @@ vsyslog(pri, fmt, ap)
106 if (sigpipe == 0)
107 __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
108
109 +#if _LIBC_REENTRANT
110 /* End of critical section. */
111 __libc_cleanup_region_end (0);
112 __libc_lock_unlock (syslog_lock);
113 +#endif
114
115 free (buf);
116 }
117 @@ -326,16 +330,20 @@ openlog_internal(const char *ident, int
118 void
119 openlog (const char *ident, int logstat, int logfac)
120 {
121 +#if _LIBC_REENTRANT
122 /* Protect against multiple users. */
123 __libc_cleanup_region_start (1,
124 (void (*) __P ((void *))) __libc_mutex_unlock,
125 &syslog_lock);
126 __libc_lock_lock (syslog_lock);
127 +#endif
128
129 openlog_internal (ident, logstat, logfac);
130
131 +#if _LIBC_REENTRANT
132 /* Free the lock. */
133 __libc_cleanup_region_end (1);
134 +#endif
135 }
136
137 static void
138 @@ -358,18 +366,22 @@ closelog_internal()
139 void
140 closelog ()
141 {
142 +#if _LIBC_REENTRANT
143 /* Protect against multiple users. */
144 __libc_cleanup_region_start (1,
145 (void (*) __P ((void *))) __libc_mutex_unlock,
146 &syslog_lock);
147 __libc_lock_lock (syslog_lock);
148 +#endif
149
150 closelog_internal ();
151 LogTag = NULL;
152 LogType = SOCK_DGRAM; /* this is the default */
153
154 +#if _LIBC_REENTRANT
155 /* Free the lock. */
156 __libc_cleanup_region_end (1);
157 +#endif
158 }
159
160 #ifdef _LIBC_REENTRANT
161 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/Rules glibc-2.2.5/Rules
162 --- ../glibc-2.2.5/Rules 2001-08-30 00:44:35.000000000 +0200
163 +++ glibc-2.2.5/Rules 2018-06-09 08:15:54.880683675 +0200
164 @@ -218,7 +218,7 @@ endif
165 fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
166 filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
167 iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
168 - fopen_max=$${fopen_max:-16}; \
169 + fopen_max=$${fu_fopen_max:-16}; \
170 filename_max=$${filename_max:-1024}; \
171 if [ -z $$iov_max ]; then \
172 define_iov_max="# undef IOV_MAX"; \
173 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/stdio-common/perror.c glibc-2.2.5/stdio-common/perror.c
174 --- ../glibc-2.2.5/stdio-common/perror.c 2001-09-01 07:33:01.000000000 +0200
175 +++ glibc-2.2.5/stdio-common/perror.c 2018-06-09 10:42:25.909899529 +0200
176 @@ -48,6 +48,9 @@ perror_internal (FILE *fp, const char *s
177 }
178
179
180 +#if MES_BOOTSTRAP
181 +#define fileno_unlocked(x) 1
182 +#endif
183 /* Print a line on stderr consisting of the text in S, a colon, a space,
184 a message describing the meaning of the contents of `errno' and a newline.
185 If S is NULL or "", the colon and space are omitted. */
186 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c
187 --- ../glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c 2001-07-06 06:55:53.000000000 +0200
188 +++ glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c 2018-06-09 09:45:13.363031424 +0200
189 @@ -25,8 +25,10 @@ fetestexcept (int excepts)
190 {
191 int temp;
192
193 +#if !MES_BOOTSTRAP
194 /* Get current exceptions. */
195 __asm__ ("fnstsw %0" : "=a" (temp));
196 +#endif
197
198 return temp & excepts & FE_ALL_EXCEPT;
199 }
200 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/unix/make-syscalls.sh glibc-2.2.5/sysdeps/unix/make-syscalls.sh
201 --- ../glibc-2.2.5/sysdeps/unix/make-syscalls.sh 2001-09-13 00:19:30.000000000 +0200
202 +++ glibc-2.2.5/sysdeps/unix/make-syscalls.sh 2018-06-20 15:16:01.813004453 +0200
203 @@ -173,7 +173,7 @@ shared-only-routines += $file
204 done
205
206 # And finally, pipe this all into the compiler.
207 - echo ' ) | $(COMPILE.S) -x assembler-with-cpp -o $@ -'
208 + echo ' ) > stdin.c; $(COMPILE.S) -x assembler-with-cpp -o $@ stdin.c'
209
210 case $weak in
211 *@*)
212 @@ -284,7 +284,7 @@ shared-only-routines += $file
213 echo "\
214 echo ''; \\
215 echo '#include <bp-thunks.h>'; \\
216 - ) | \$(COMPILE.c) -x c -o \$@ -"
217 + ) > stdin.c; \$(COMPILE.c) -x c -o \$@ stdin.c"
218 ### Use this for debugging intermediate output:
219 ### ) >\$(@:.ob=.c)
220 ### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c)
221 diff -purN -x .git -x fubar -x fubar.c -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC -x texis -x '*.info*' ../glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h
222 --- ../glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h 2001-07-06 06:56:21.000000000 +0200
223 +++ glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h 2018-06-09 20:09:07.713806647 +0200
224 @@ -54,10 +54,12 @@ struct timex
225 long int errcnt; /* calibration errors (ro) */
226 long int stbcnt; /* stability limit exceeded (ro) */
227
228 +#if !MES_BOOTSTRAP
229 /* ??? */
230 int :32; int :32; int :32; int :32;
231 int :32; int :32; int :32; int :32;
232 int :32; int :32; int :32; int :32;
233 +#endif
234 };
235
236 /* Mode codes (timex.mode) */
237 --- ../glibc-2.2.5/manual/Makefile 2001-08-28 10:05:40.000000000 +0200
238 +++ glibc-2.2.5/manual/Makefile 2018-06-09 10:13:03.093633660 +0200
239 @@ -247,7 +247,11 @@
240 .PHONY: stubs
241 stubs: $(objpfx)stubs
242 endif
243 -$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
244 +po/manual.pot $(objpfx)stubs:
245 + $(make-target-directory)
246 + touch $@
247 +
248 +$(objpfx)stamp%:
249 $(make-target-directory)
250 touch $@
251