Commit | Line | Data |
---|---|---|
0b652851 JN |
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 link with (non-existent) libgc_eh. | |
4 | * Makefile: Add SHELL variable, ready for substitution, export it. | |
5 | * Makefile: Do not build or assume librpc_compat_pic. | |
6 | * Makefile: Do not build libmesusage. | |
7 | * gen-as-const: Always add preamble. | |
8 | * [BOOTSTRAP_GLIBC]: Really disable rpc. | |
9 | ||
10 | Upstream status: Not presented upstream. | |
11 | ||
12 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/elf/Makefile glibc-2.16.0/elf/Makefile | |
13 | --- /home/janneke/src/glibc-2.16.0/elf/Makefile 2012-06-30 21:12:34.000000000 +0200 | |
14 | +++ glibc-2.16.0/elf/Makefile 2018-09-02 12:54:44.616962543 +0200 | |
15 | @@ -17,6 +17,8 @@ | |
16 | ||
17 | # Makefile for elf subdirectory of GNU C Library. | |
18 | ||
19 | +SHELL := /bin/sh | |
20 | + | |
21 | subdir := elf | |
22 | ||
23 | headers = elf.h bits/elfclass.h link.h bits/link.h | |
24 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/include/libc-symbols.h glibc-2.16.0/include/libc-symbols.h | |
25 | --- /home/janneke/src/glibc-2.16.0/include/libc-symbols.h 2012-06-30 21:12:34.000000000 +0200 | |
26 | +++ glibc-2.16.0/include/libc-symbols.h 2018-09-02 22:41:00.798467803 +0200 | |
27 | @@ -558,9 +558,9 @@ for linking") | |
28 | # define libc_hidden_weak(name) hidden_weak (name) | |
29 | # ifdef LINK_OBSOLETE_RPC | |
30 | /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */ | |
31 | -# define libc_hidden_nolink_sunrpc(name, version) hidden_def (name) | |
32 | +# define libc_hidden_nolink_sunrpc(name, version) | |
33 | # else | |
34 | -# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) | |
35 | +# define libc_hidden_nolink_sunrpc(name, version) | |
36 | # endif | |
37 | # define libc_hidden_ver(local, name) hidden_ver (local, name) | |
38 | # define libc_hidden_data_def(name) hidden_data_def (name) | |
39 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makeconfig glibc-2.16.0/Makeconfig | |
40 | --- /home/janneke/src/glibc-2.16.0/Makeconfig 2012-06-30 21:12:34.000000000 +0200 | |
41 | +++ glibc-2.16.0/Makeconfig 2018-09-03 00:00:25.290357414 +0200 | |
42 | @@ -23,6 +23,9 @@ ifneq (,) | |
43 | This makefile requires GNU Make. | |
44 | endif | |
45 | ||
46 | +SHELL := /bin/sh | |
47 | +export SHELL | |
48 | + | |
49 | all: # Make this the default goal | |
50 | ||
51 | ifneq "$(origin +included-Makeconfig)" "file" | |
52 | @@ -521,9 +524,9 @@ ifneq ($(have-cc-with-libunwind),yes) | |
53 | else | |
54 | libunwind = -lunwind | |
55 | endif | |
56 | -libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed | |
57 | +libgcc_eh := #-Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed | |
58 | gnulib := -lgcc $(libgcc_eh) | |
59 | -static-gnulib := -lgcc -lgcc_eh $(libunwind) | |
60 | +static-gnulib := -lgcc $(libunwind) | |
61 | libc.so-gnulib := -lgcc | |
62 | endif | |
63 | +preinit = $(addprefix $(csu-objpfx),crti.o) | |
64 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile glibc-2.16.0/Makefile | |
65 | --- /home/janneke/src/glibc-2.16.0/Makefile 2012-06-30 21:12:34.000000000 +0200 | |
66 | +++ glibc-2.16.0/Makefile 2018-09-02 23:01:10.485803965 +0200 | |
67 | @@ -22,6 +22,9 @@ ifneq (,) | |
68 | This makefile requires GNU Make. | |
69 | endif | |
70 | ||
71 | +SHELL := /bin/sh | |
72 | +export SHELL | |
73 | + | |
74 | include Makeconfig | |
75 | ||
76 | ||
77 | @@ -135,13 +138,10 @@ $(common-objpfx)linkobj/libc.so: $(elfob | |
78 | $(shlib-lds) | |
79 | $(build-shlib) | |
80 | ||
81 | -$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \ | |
82 | - $(common-objpfx)sunrpc/librpc_compat_pic.a | |
83 | +$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a | |
84 | $(..)./scripts/mkinstalldirs $(common-objpfx)linkobj | |
85 | (cd $(common-objpfx)linkobj; \ | |
86 | $(AR) x ../libc_pic.a; \ | |
87 | - rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \ | |
88 | - $(AR) x ../sunrpc/librpc_compat_pic.a; \ | |
89 | $(AR) cr libc_pic.a *.os; \ | |
90 | rm *.os) | |
91 | endif | |
92 | @@ -151,7 +151,7 @@ endif | |
93 | # the current libc build for testing. | |
94 | $(common-objpfx)testrun.sh: $(common-objpfx)config.make \ | |
95 | $(..)Makeconfig $(..)Makefile | |
96 | - (echo '#!/bin/sh'; \ | |
97 | + (echo '#! $(SHELL)'; \ | |
98 | echo 'builddir=`dirname "$$0"`'; \ | |
99 | echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \ | |
100 | echo 'exec $(subst $(common-objdir),"$${builddir}",\ | |
101 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile.in glibc-2.16.0/Makefile.in | |
102 | --- /home/janneke/src/glibc-2.16.0/Makefile.in 2012-06-30 21:12:34.000000000 +0200 | |
103 | +++ glibc-2.16.0/Makefile.in 2018-09-02 13:03:01.892962551 +0200 | |
104 | @@ -9,3 +9,6 @@ all .DEFAULT: | |
105 | install: | |
106 | LANGUAGE=C LC_ALL=C; export LANGUAGE LC_ALL; \ | |
107 | $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@ | |
108 | + | |
109 | +export SHELL | |
110 | +export BASH | |
111 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/malloc/Makefile glibc-2.16.0/malloc/Makefile | |
112 | --- /home/janneke/src/glibc-2.16.0/malloc/Makefile 2012-06-30 21:12:34.000000000 +0200 | |
113 | +++ glibc-2.16.0/malloc/Makefile 2018-09-02 17:11:33.461547394 +0200 | |
114 | @@ -35,7 +35,7 @@ install-lib := libmcheck.a | |
115 | non-lib.a := libmcheck.a | |
116 | ||
117 | # Additional library. | |
118 | -extra-libs = libmemusage | |
119 | +extra-libs = #libmemusage | |
120 | extra-libs-others = $(extra-libs) | |
121 | ||
122 | libmemusage-routines = memusage | |
123 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/cache.c glibc-2.16.0/nscd/cache.c | |
124 | --- /home/janneke/src/glibc-2.16.0/nscd/cache.c 2012-06-30 21:12:34.000000000 +0200 | |
125 | +++ glibc-2.16.0/nscd/cache.c 2018-09-02 23:38:31.757616750 +0200 | |
126 | @@ -74,7 +74,11 @@ struct datahead * | |
127 | cache_search (request_type type, const void *key, size_t len, | |
128 | struct database_dyn *table, uid_t owner) | |
129 | { | |
130 | +#if !BOOTSTRAP_GLIBC | |
131 | unsigned long int hash = __nis_hash (key, len) % table->head->module; | |
132 | +#else | |
133 | + unsigned long int hash = 0; | |
134 | +#endif | |
135 | ||
136 | unsigned long int nsearched = 0; | |
137 | struct datahead *result = NULL; | |
138 | @@ -153,7 +153,11 @@ cache_add (int type, const void *key, si | |
139 | first ? _(" (first)") : ""); | |
140 | } | |
141 | ||
142 | +#if !BOOTSTRAP_GLIBC | |
143 | unsigned long int hash = __nis_hash (key, len) % table->head->module; | |
144 | +#else | |
145 | + unsigned long int hash = 0; | |
146 | +#endif | |
147 | struct hashentry *newp; | |
148 | ||
149 | newp = mempool_alloc (table, sizeof (struct hashentry), 0); | |
150 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/Makefile glibc-2.16.0/nscd/Makefile | |
151 | --- /home/janneke/src/glibc-2.16.0/nscd/Makefile 2012-06-30 21:12:34.000000000 +0200 | |
152 | +++ glibc-2.16.0/nscd/Makefile 2018-09-02 23:49:29.948031787 +0200 | |
153 | @@ -126,9 +126,7 @@ include $(patsubst %,$(..)cppflags-itera | |
154 | $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o) | |
155 | ||
156 | ifeq ($(build-shared),yes) | |
157 | -$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \ | |
158 | - $(common-objpfx)nis/libnsl.so | |
159 | +$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) | |
160 | else | |
161 | -$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \ | |
162 | - $(common-objpfx)nis/libnsl.a | |
163 | +$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) | |
164 | endif | |
165 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c glibc-2.16.0/nscd/nscd_helper.c | |
166 | --- /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c 2012-06-30 21:12:34.000000000 +0200 | |
167 | +++ glibc-2.16.0/nscd/nscd_helper.c 2018-09-02 23:38:04.941189464 +0200 | |
168 | @@ -474,7 +474,7 @@ struct datahead * | |
169 | __nscd_cache_search (request_type type, const char *key, size_t keylen, | |
170 | const struct mapped_database *mapped, size_t datalen) | |
171 | { | |
172 | - unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module; | |
173 | + unsigned long int hash = 0; | |
174 | size_t datasize = mapped->datasize; | |
175 | ||
176 | ref_t trail = mapped->head->array[hash]; | |
177 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c | |
178 | --- /home/janneke/src/glibc-2.16.0/nss/function.def 2012-06-30 21:12:34.000000000 +0200 | |
179 | +++ glibc-2.16.0/nss/function.def 2018-09-18 13:54:49.582060539 +0200 | |
180 | @@ -63,10 +63,12 @@ | |
181 | DEFINE_GET (files, pwnam) | |
182 | DEFINE_GET (files, pwuid) | |
183 | ||
184 | +#if !BOOTSTRAP_GLIBC | |
185 | /* rpc */ | |
186 | DEFINE_ENT (files, rpc) | |
187 | DEFINE_GETBY (files, rpc, name) | |
188 | DEFINE_GETBY (files, rpc, number) | |
189 | +#endif | |
190 | ||
191 | /* services */ | |
192 | DEFINE_ENT (files, serv) | |
193 | diff -u ~/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c | |
194 | --- /home/janneke/src/glibc-2.16.0/nss/getent.c 2012-06-30 21:12:34.000000000 +0200 | |
195 | +++ glibc-2.16.0/nss/getent.c 2018-09-18 13:57:41.856849140 +0200 | |
196 | @@ -700,6 +700,7 @@ | |
197 | return result; | |
198 | } | |
199 | ||
200 | +#if !BOOTSTRAP_GLIBC | |
201 | /* Now is all for rpc */ | |
202 | static inline void | |
203 | print_rpc (struct rpcent *rpc) | |
204 | @@ -745,6 +746,7 @@ | |
205 | ||
206 | return result; | |
207 | } | |
208 | +#endif //rpc | |
209 | ||
210 | /* for services */ | |
211 | static void | |
212 | @@ -880,7 +882,9 @@ | |
213 | D(networks) | |
214 | D(passwd) | |
215 | D(protocols) | |
216 | +#if !BOOTSTRAP_GLIBC | |
217 | D(rpc) | |
218 | +#endif | |
219 | D(services) | |
220 | D(shadow) | |
221 | #undef D | |
222 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/resolv/netdb.h glibc-2.16.0/resolv/netdb.h | |
223 | --- /home/janneke/src/glibc-2.16.0/resolv/netdb.h 2012-06-30 21:12:34.000000000 +0200 | |
224 | +++ glibc-2.16.0/resolv/netdb.h 2018-09-08 08:49:30.537811219 +0200 | |
225 | @@ -26,11 +26,13 @@ | |
226 | ||
227 | #include <netinet/in.h> | |
228 | #include <stdint.h> | |
229 | +#if 0 //!BOOTSTRAP_GLIBC | |
230 | #ifdef __USE_MISC | |
231 | /* This is necessary to make this include file properly replace the | |
232 | Sun version. */ | |
233 | # include <rpc/netdb.h> | |
234 | #endif | |
235 | +#endif | |
236 | ||
237 | #ifdef __USE_GNU | |
238 | # define __need_sigevent_t | |
239 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Rules glibc-2.16.0/Rules | |
240 | --- /home/janneke/src/glibc-2.16.0/Rules 2012-06-30 21:12:34.000000000 +0200 | |
241 | +++ glibc-2.16.0/Rules 2018-09-02 10:52:06.927362861 +0200 | |
242 | @@ -24,6 +24,9 @@ ifneq (,) | |
243 | This makefile requires GNU Make. | |
244 | endif | |
245 | ||
246 | +export SHELL | |
247 | +export BASH | |
248 | + | |
249 | all: # Don't let the default goal come from Makeconfig. | |
250 | ||
251 | include $(firstword $(..) ../)Makeconfig | |
252 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/scripts/gen-as-const.awk glibc-2.16.0/scripts/gen-as-const.awk | |
253 | --- /home/janneke/src/glibc-2.16.0/scripts/gen-as-const.awk 2012-06-30 21:12:34.000000000 +0200 | |
254 | +++ glibc-2.16.0/scripts/gen-as-const.awk 2018-09-01 18:08:37.266516330 +0200 | |
255 | @@ -14,6 +14,12 @@ BEGIN { started = 0 } | |
256 | ||
257 | NF >= 1 && !started { | |
258 | if (test) { | |
259 | + print "\n#include <stddef.h>"; | |
260 | + print "\n#include <stdint.h>"; | |
261 | +# print "\ntypedef unsigned long size_t;"; | |
262 | + print "\n#ifndef offsetof"; | |
263 | + print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)"; | |
264 | + print "\n#endif"; | |
265 | print "\n#include <inttypes.h>"; | |
266 | print "\n#include <stdio.h>"; | |
267 | print "\n#include <bits/wordsize.h>"; | |
268 | @@ -33,8 +39,15 @@ NF >= 1 && !started { | |
269 | " source, #name, U (asconst_##name), #expr, (c_t) (expr));" \ | |
270 | " } else ++good;\n"; | |
271 | } | |
272 | - else | |
273 | + else { | |
274 | + print "\n#include <stddef.h>"; | |
275 | + print "\n#include <stdint.h>"; | |
276 | +# print "\ntypedef unsigned long size_t;"; | |
277 | + print "\n#ifndef offsetof"; | |
278 | + print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)"; | |
279 | + print "\n#endif"; | |
280 | print "void dummy(void) {"; | |
281 | + } | |
282 | started = 1; | |
283 | } | |
284 | ||
285 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c glibc-2.16.0/sunrpc/auth_none.c | |
286 | --- /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c 2012-06-30 21:12:34.000000000 +0200 | |
287 | +++ glibc-2.16.0/sunrpc/auth_none.c 2018-09-02 22:09:21.629007932 +0200 | |
288 | @@ -95,7 +95,9 @@ authnone_create (void) | |
289 | __libc_once (authnone_private_guard, authnone_create_once); | |
290 | return &authnone_private.no_client; | |
291 | } | |
292 | +#if !BOOTSTRAP_GLIBC | |
293 | libc_hidden_nolink_sunrpc (authnone_create, GLIBC_2_0) | |
294 | +#endif | |
295 | ||
296 | static bool_t | |
297 | authnone_marshal (AUTH *client, XDR *xdrs) | |
298 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c glibc-2.16.0/sunrpc/authuxprot.c | |
299 | --- /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c 2012-06-30 21:12:34.000000000 +0200 | |
300 | +++ glibc-2.16.0/sunrpc/authuxprot.c 2018-09-02 22:15:51.927158451 +0200 | |
301 | @@ -63,4 +63,6 @@ xdr_authunix_parms (XDR * xdrs, struct a | |
302 | } | |
303 | return FALSE; | |
304 | } | |
305 | +#if !BOOTSTRAP_GLIBC | |
306 | libc_hidden_nolink_sunrpc (xdr_authunix_parms, GLIBC_2_0) | |
307 | +#endif | |
308 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c glibc-2.16.0/sunrpc/bindrsvprt.c | |
309 | --- /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c 2012-06-30 21:12:34.000000000 +0200 | |
310 | +++ glibc-2.16.0/sunrpc/bindrsvprt.c 2018-09-02 22:24:32.687187675 +0200 | |
311 | @@ -96,4 +96,7 @@ bindresvport (int sd, struct sockaddr_in | |
312 | ||
313 | return res; | |
314 | } | |
315 | +#if !BOOTSTRAP_GLIBC | |
316 | libc_hidden_def (bindresvport) | |
317 | +#endif | |
318 | + | |
319 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c glibc-2.16.0/sunrpc/clnt_raw.c | |
320 | --- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c 2012-06-30 21:12:34.000000000 +0200 | |
321 | +++ glibc-2.16.0/sunrpc/clnt_raw.c 2018-09-02 22:33:21.151343826 +0200 | |
322 | @@ -40,6 +40,7 @@ | |
323 | #include <rpc/svc.h> | |
324 | #include <rpc/xdr.h> | |
325 | #include <libintl.h> | |
326 | +#include <stddef.h> | |
327 | ||
328 | #define MCALL_MSG_SIZE 24 | |
329 | ||
330 | @@ -129,7 +130,9 @@ clntraw_create (u_long prog, u_long vers | |
331 | client->cl_auth = authnone_create (); | |
332 | return client; | |
333 | } | |
334 | +#if !BOOTSTRAP_GLIBC | |
335 | libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0) | |
336 | +#endif | |
337 | ||
338 | static enum clnt_stat | |
339 | clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout) | |
340 | diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c glibc-2.16.0/sunrpc/clnt_simp.c | |
341 | --- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c 2012-06-30 21:12:34.000000000 +0200 | |
342 | +++ glibc-2.16.0/sunrpc/clnt_simp.c 2018-09-02 22:34:14.884175251 +0200 | |
343 | @@ -139,7 +139,9 @@ callrpc (const char *host, u_long prognu | |
344 | crp->valid = 0; | |
345 | return (int) clnt_stat; | |
346 | } | |
347 | +#if !BOOTSTRAP_GLIBC | |
348 | libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0) | |
349 | +#endif | |
350 | ||
351 | #ifdef _RPC_THREAD_SAFE_ | |
352 | void |