bootstrap: Add Mes bootstrap.

* gnu/packages/patches/mes-nyacc-0.86.0.patch: Support bootstrap build.
* gnu/packages/commencement.scm (%fake-bootstrap mes-boot0, mescc-tools-boot,
nyacc-boot, mes-boot, tcc-boot0, tcc-boot, make-mesboot0, diffutils-mesboot,
binutils-mesboot0, gcc-core-mesboot, mesboot-headers, glibc-mesboot0,
gcc-mesboot0, binutils-mesboot, make-mesboot, gmp-boot, mpfr-boot, mpc-boot,
gcc-mesboot1, gcc-mesboot1-wrapper, glibc-headers-mesboot, glibc-mesboot,
gcc-mesboot, gcc-mesboot-wrapper, m4-mesboot): New variable.
* gnu/packages/patches/binutils-boot-2.20.1a.patch: New file. New file.
* gnu/packages/patches/gcc-boot-2.95.3.patch: New file.
* gnu/packages/patches/gcc-boot-4.7.4.patch: New file.
* gnu/packages/patches/glibc-boot-2.16.0.patch: New file.
* gnu/packages/patches/glibc-boot-2.2.5.patch: New file.
* gnu/packages/patches/glibc-bootstrap-system-2.16.0.patch: New file.
* gnu/packages/patches/tcc-boot-0.9.27.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add them.
master
Jan Nieuwenhuizen 2018-09-09 14:52:00 +02:00
parent aec77e8695
commit 0b652851b1
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
10 changed files with 2546 additions and 0 deletions

View File

@ -593,6 +593,7 @@ dist_patch_DATA = \
%D%/packages/patches/bash-completion-directories.patch \
%D%/packages/patches/bazaar-CVE-2017-14176.patch \
%D%/packages/patches/beignet-correct-file-names.patch \
%D%/packages/patches/binutils-boot-2.20.1a.patch \
%D%/packages/patches/binutils-loongson-workaround.patch \
%D%/packages/patches/blast+-fix-makefile.patch \
%D%/packages/patches/boost-fix-icu-build.patch \
@ -697,6 +698,7 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-arm-bug-71399.patch \
%D%/packages/patches/gcc-arm-link-spec-fix.patch \
%D%/packages/patches/gcc-asan-missing-include.patch \
%D%/packages/patches/gcc-boot-2.95.3.patch \
%D%/packages/patches/gcc-cross-environment-variables.patch \
%D%/packages/patches/gcc-fix-texi2pod.patch \
%D%/packages/patches/gcc-4.8-libsanitizer-fix.patch \
@ -745,6 +747,9 @@ dist_patch_DATA = \
%D%/packages/patches/glibc-CVE-2017-1000366-pt2.patch \
%D%/packages/patches/glibc-CVE-2017-1000366-pt3.patch \
%D%/packages/patches/glibc-allow-kernel-2.6.32.patch \
%D%/packages/patches/glibc-boot-2.16.0.patch \
%D%/packages/patches/glibc-boot-2.2.5.patch \
%D%/packages/patches/glibc-bootstrap-system-2.16.0.patch \
%D%/packages/patches/glibc-bootstrap-system.patch \
%D%/packages/patches/glibc-hidden-visibility-ldconfig.patch \
%D%/packages/patches/glibc-ldd-x86_64.patch \
@ -1155,6 +1160,7 @@ dist_patch_DATA = \
%D%/packages/patches/t1lib-CVE-2011-1552+.patch \
%D%/packages/patches/tar-remove-wholesparse-check.patch \
%D%/packages/patches/tar-skip-unreliable-tests.patch \
%D%/packages/patches/tcc-boot-0.9.27.patch \
%D%/packages/patches/tclxml-3.2-install.patch \
%D%/packages/patches/tcsh-fix-autotest.patch \
%D%/packages/patches/tcsh-fix-out-of-bounds-read.patch \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,157 @@
This patch enables building binutils using TCC and Mes C Library
* disable building DOC
* remove signed int trickery that does not work with TCC
* fixe the malloc prototype to use size_t
* add missing includes
* remove C99'isms to avoid of mixing code and variable declaration
* [MES_BOOTSTRAP]: remove strncmp to avoid duplicat symbol
Upstream status: Not presented upstream.
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/elf32-i386.c binutils-2.20.1a/bfd/elf32-i386.c
--- ../binutils-2.20.1a/bfd/elf32-i386.c 2009-09-10 13:47:12.000000000 +0200
+++ binutils-2.20.1a/bfd/elf32-i386.c 2018-06-23 19:33:20.068134411 +0200
@@ -4254,6 +4254,7 @@ elf_i386_finish_dynamic_symbol (bfd *out
if (!h->pointer_equality_needed)
abort ();
+ {
/* For non-shared object, we can't use .got.plt, which
contains the real function addres if we need pointer
equality. We load the GOT entry with the PLT entry. */
@@ -4262,6 +4263,7 @@ elf_i386_finish_dynamic_symbol (bfd *out
(plt->output_section->vma
+ plt->output_offset + h->plt.offset),
htab->elf.sgot->contents + h->got.offset);
+ }
return TRUE;
}
}
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/elfcode.h binutils-2.20.1a/bfd/elfcode.h
--- ../binutils-2.20.1a/bfd/elfcode.h 2009-09-10 13:47:12.000000000 +0200
+++ binutils-2.20.1a/bfd/elfcode.h 2018-06-19 19:07:16.647627075 +0200
@@ -73,6 +73,7 @@
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
+#include <limits.h>
/* Renaming structures, typedefs, macros and functions to be size-specific. */
#define Elf_External_Ehdr NAME(Elf,External_Ehdr)
@@ -706,8 +707,8 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_shnum != 1)
{
/* Check that we don't have a totally silly number of sections. */
- if (i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (x_shdr)
- || i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (i_shdr))
+ if (i_ehdrp->e_shnum > INT_MAX / sizeof (x_shdr)
+ || i_ehdrp->e_shnum > INT_MAX / sizeof (i_shdr))
goto got_wrong_format_error;
where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr);
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/bfd/Makefile.in binutils-2.20.1a/bfd/Makefile.in
--- ../binutils-2.20.1a/bfd/Makefile.in 2010-03-03 14:59:15.000000000 +0100
+++ binutils-2.20.1a/bfd/Makefile.in 2018-06-16 14:00:46.297724081 +0200
@@ -320,7 +320,7 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../confi
# RELEASE=y
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-SUBDIRS = doc po
+SUBDIRS = # these fail to build: doc po
bfddocdir = doc
libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \
@SHARED_LDFLAGS@ $(am__empty)
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/arparse.c binutils-2.20.1a/binutils/arparse.c
--- ../binutils-2.20.1a/binutils/arparse.c 2009-10-16 13:52:16.000000000 +0200
+++ binutils-2.20.1a/binutils/arparse.c 2018-06-19 01:30:00.576219981 +0200
@@ -330,7 +330,7 @@ YYID (i)
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/dwarf.c binutils-2.20.1a/binutils/dwarf.c
--- ../binutils-2.20.1a/binutils/dwarf.c 2009-09-14 13:43:26.000000000 +0200
+++ binutils-2.20.1a/binutils/dwarf.c 2018-06-16 14:01:45.162684662 +0200
@@ -27,6 +27,10 @@
#include "dwarf2.h"
#include "dwarf.h"
+#if MES_BOOTSTRAP
+#include "getopt.h"
+#endif
+
static int have_frame_base;
static int need_base_address;
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/binutils/sysinfo.c binutils-2.20.1a/binutils/sysinfo.c
--- ../binutils-2.20.1a/binutils/sysinfo.c 2009-10-16 13:52:17.000000000 +0200
+++ binutils-2.20.1a/binutils/sysinfo.c 2018-06-19 01:29:23.823612807 +0200
@@ -286,7 +286,7 @@ YYID (i)
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/gas/config/tc-i386.c binutils-2.20.1a/gas/config/tc-i386.c
--- ../binutils-2.20.1a/gas/config/tc-i386.c 2009-09-14 13:43:27.000000000 +0200
+++ binutils-2.20.1a/gas/config/tc-i386.c 2018-06-23 19:39:37.546254752 +0200
@@ -4869,6 +4869,7 @@ build_modrm_byte (void)
if (vex_3_sources)
{
unsigned int nds, reg;
+ expressionS *exp;
if (i.tm.opcode_modifier.veximmext
&& i.tm.opcode_modifier.immext)
@@ -4892,7 +4893,7 @@ build_modrm_byte (void)
/* Generate an 8bit immediate operand to encode the register
operand. */
- expressionS *exp = &im_expressions[i.imm_operands++];
+ exp = &im_expressions[i.imm_operands++];
i.op[i.operands].imms = exp;
i.types[i.operands] = imm8;
i.operands++;
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/ld/ldgram.c binutils-2.20.1a/ld/ldgram.c
--- ../binutils-2.20.1a/ld/ldgram.c 2009-10-16 13:52:15.000000000 +0200
+++ binutils-2.20.1a/ld/ldgram.c 2018-06-19 01:30:57.809165437 +0200
@@ -561,7 +561,7 @@ YYID (i)
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
diff -purN -x config.status -x config.h -x BOOT ../binutils-2.20.1a/libiberty/strncmp.c binutils-2.20.1a/libiberty/strncmp.c
--- ../binutils-2.20.1a/libiberty/strncmp.c 2005-03-28 04:09:01.000000000 +0200
+++ binutils-2.20.1a/libiberty/strncmp.c 2018-06-23 19:19:50.038992482 +0200
@@ -15,6 +15,13 @@ Compares the first @var{n} bytes of two
#include <ansidecl.h>
#include <stddef.h>
+#if !MES_BOOTSTRAP
+
+/*
+ libtool: link: /gnu/store/rgwjixk5zl7s2d3xsb2ws2z2q3m0xjm4-tcc-boot-0.9.26-0.97196ce/bin/tcc -D __GLIBC_MINOR__=6 -D MES_BOOTSTRAP=1 -g -o size size.o bucomm.o version.o filemode.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a ./../intl/libintl.a
+ /gnu/store/rgwjixk5zl7s2d3xsb2ws2z2q3m0xjm4-tcc-boot-0.9.26-0.97196ce/lib/libc.a: error: 'strncmp' defined twice
+*/
+
int
strncmp(const char *s1, const char *s2, register size_t n)
{
@@ -31,3 +38,5 @@ strncmp(const char *s1, const char *s2,
}
return 0;
}
+
+#endif // !MES_BOOTSTRAP

View File

@ -0,0 +1,137 @@
This patch enables building gcc-2.95.3 using TCC and Mes C Library.
* Disable building DOC
* Avoid running `fixproto'.
* Force running `fixinc'.
* Replace Makefile trickery of creating an libgcc1.a archive, then
extracting the .o files later to create a new libgcc2.a archive.
Instead, keep temporary .o files.
Upstream status: Not presented upstream.
diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in
--- ../gcc-2.95.3/gcc/Makefile.in 2001-01-25 15:02:58.000000000 +0100
+++ gcc-2.95.3/gcc/Makefile.in 2018-06-23 11:46:03.525159181 +0200
@@ -221,7 +221,7 @@ RANLIB_TEST_FOR_TARGET = \
SYSTEM_HEADER_DIR = /usr/include
# Control whether to run fixproto.
-STMP_FIXPROTO = stmp-fixproto
+# STMP_FIXPROTO = stmp-fixproto
# Test to see whether <limits.h> exists in the system header files.
LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
@@ -958,6 +958,7 @@ libgcc1.cross:
# fragments.
libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
-rm -f tmplibgcc1.a
+ mkdir -p libgcc1-o
# Actually build it in tmplibgcc1.a, then rename at end,
# so that libgcc1.a itself remains nonexistent if compilation is aborted.
# -e causes any failing command to make this rule fail.
@@ -974,6 +975,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
mv libgcc1$(objext) $${name}$(objext); \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
+ mv $${name}$(objext) libgcc1-o; \
rm -f $${name}$(objext); \
done
# Some shells crash when a loop has no items.
@@ -994,6 +996,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ mv $${name}$(objext) libgcc1-o; \
rm -f $${name}.s $${name}$(objext); \
else true; \
fi; \
@@ -1024,6 +1027,7 @@ libgcc1-asm.a: libgcc2.ready config.stat
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
mv libgcc1$(objext) $${name}$(objext); \
$(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \
+ mv $${name}$(objext) libgcc1-o; \
rm -f $${name}$(objext); \
done
-rm -f libgcc1.S
@@ -1062,6 +1066,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON
# Actually build it in tmplibgcc2.a, then rename at end,
# so that libgcc2.a itself remains nonexistent if compilation is aborted.
-rm -f tmplibgcc2.a
+ mkdir -p libgcc2-o
# -e causes any failing command to make this rule fail.
# -e doesn't work in certain shells, so we test $$? as well.
# lynx has a broken ar, it always complains when the initial library is
@@ -1139,6 +1144,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
$(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \
+ mv $${oname}$(objext) libgcc2-o;\
rm -f $${name}.s $${oname}$(objext); \
fi; \
done
@@ -1156,7 +1162,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
-rm -rf tmplibgcc.a libgcc.a tmpcopy
mkdir tmpcopy
-if [ x$(LIBGCC1) != x ]; \
- then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \
+ then cp -v libgcc1-o/*.o tmpcopy; \
else true; \
fi
# Some versions of ar (specifically the one in RISC/os 5.x), create an
@@ -1164,7 +1170,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
# the second ar command tries to overwrite this file. To avoid the error
# message from ar, we make sure all files are writable.
-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
- (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
+ cp -v libgcc2-o/*.o tmpcopy
(cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
rm -rf tmpcopy
-if $(RANLIB_TEST_FOR_TARGET) ; then \
@@ -2093,14 +2099,18 @@ gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
# s-* so that mostlyclean does not force the include directory to
# be rebuilt.
+# STMP_FIXINC = @STMP_FIXINC@
+STMP_FIXINC = stmp-fixinc
+
# Build the include directory including float.h (which no longer depends upon
# enquire).
-stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
+stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h
# Copy in the headers provided with gcc.
# The sed command gets just the last file name component;
# this is necessary because VPATH could add a dirname.
# Using basename would be simpler, but some systems don't have it.
# The touch command is here to workaround an AIX/Linux NFS bug.
+ -if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
for file in .. $(USER_H); do \
if [ X$$file != X.. ]; then \
realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
@@ -2265,16 +2275,17 @@ stmp-fixproto: fixhdr.ready fixproto stm
#
# Remake the info files.
-doc: info
-info: cpp.info gcc.info lang.info
-
-cpp.info: $(srcdir)/cpp.texi
- $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
-
-gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
- $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
- $(srcdir)/tm.texi $(srcdir)/gcov.texi
- $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
+doc:
+# doc: info
+# info: cpp.info gcc.info lang.info
+
+# cpp.info: $(srcdir)/cpp.texi
+# $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
+
+# gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
+# $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
+# $(srcdir)/tm.texi $(srcdir)/gcov.texi
+# $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
dvi: gcc.dvi cpp.dvi lang.dvi

View File

@ -0,0 +1,68 @@
This patch enables building gcc-4.7.4 using gcc-2.95.3 and glibc-2.2.5
* Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags
* Add missing limits.h include.
* Add SSIZE_MAX define. The SSIZE_MAX define has been added to Mes
upstream and can be removed with the next Mes release.
* Remove -fbuilding-libgcc flag, it assumes features being present from a
newer gcc or glibc.
* [MES_BOOTSTRAP_GCC]: Disable threads harder.
Upstream status: not presented upstream.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f3cc49fdb18..bc5718fc9a6 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -458,7 +458,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+# NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
diff --git a/gcc/config/host-linux.c b/gcc/config/host-linux.c
index 94b7a0b89a7..ab2baab55ca 100644
--- a/gcc/config/host-linux.c
+++ b/gcc/config/host-linux.c
@@ -23,6 +23,12 @@
#include "hosthooks.h"
#include "hosthooks-def.h"
+// ../.././gcc/config/host-linux.c:213: `SSIZE_MAX' undeclared (first
+// use in this function)
+#include <limits.h>
+#ifndef SSIZE_MAX
+# define SSIZE_MAX LONG_MAX
+#endif
/* Linux has a feature called exec-shield-randomize that perturbs the
address of non-fixed mapped segments by a (relatively) small amount.
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index c301ff03cae..f86318c3bd5 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -225,7 +225,7 @@ endif
LIBGCC2_DEBUG_CFLAGS = -g
LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
$(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
- -fbuilding-libgcc -fno-stack-protector \
+ -fno-stack-protector \
$(INHIBIT_LIBC_CFLAGS)
# Additional options to use when compiling libgcc2.a.
diff --git a/libgcc/generic-morestack-thread.c b/libgcc/generic-morestack-thread.c
index bbe6dd12b5a..1d1d48223d7 100644
--- a/libgcc/generic-morestack-thread.c
+++ b/libgcc/generic-morestack-thread.c
@@ -35,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
will want to define inhibit_libc while building a compiler which
can build glibc. */
-#ifndef inhibit_libc
+#if 0 //!defined (inhibit_libc) && !MES_BOOTSTRAP_GCC
#include <errno.h>
#include <pthread.h>

View File

@ -0,0 +1,352 @@
This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
* Makefile: Do not link with (non-existent) libgc_eh.
* Makefile: Add SHELL variable, ready for substitution, export it.
* Makefile: Do not build or assume librpc_compat_pic.
* Makefile: Do not build libmesusage.
* gen-as-const: Always add preamble.
* [BOOTSTRAP_GLIBC]: Really disable rpc.
Upstream status: Not presented upstream.
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/elf/Makefile glibc-2.16.0/elf/Makefile
--- /home/janneke/src/glibc-2.16.0/elf/Makefile 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/elf/Makefile 2018-09-02 12:54:44.616962543 +0200
@@ -17,6 +17,8 @@
# Makefile for elf subdirectory of GNU C Library.
+SHELL := /bin/sh
+
subdir := elf
headers = elf.h bits/elfclass.h link.h bits/link.h
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/include/libc-symbols.h glibc-2.16.0/include/libc-symbols.h
--- /home/janneke/src/glibc-2.16.0/include/libc-symbols.h 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/include/libc-symbols.h 2018-09-02 22:41:00.798467803 +0200
@@ -558,9 +558,9 @@ for linking")
# define libc_hidden_weak(name) hidden_weak (name)
# ifdef LINK_OBSOLETE_RPC
/* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
-# define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
+# define libc_hidden_nolink_sunrpc(name, version)
# else
-# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
+# define libc_hidden_nolink_sunrpc(name, version)
# endif
# define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name)
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makeconfig glibc-2.16.0/Makeconfig
--- /home/janneke/src/glibc-2.16.0/Makeconfig 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/Makeconfig 2018-09-03 00:00:25.290357414 +0200
@@ -23,6 +23,9 @@ ifneq (,)
This makefile requires GNU Make.
endif
+SHELL := /bin/sh
+export SHELL
+
all: # Make this the default goal
ifneq "$(origin +included-Makeconfig)" "file"
@@ -521,9 +524,9 @@ ifneq ($(have-cc-with-libunwind),yes)
else
libunwind = -lunwind
endif
-libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
+libgcc_eh := #-Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
gnulib := -lgcc $(libgcc_eh)
-static-gnulib := -lgcc -lgcc_eh $(libunwind)
+static-gnulib := -lgcc $(libunwind)
libc.so-gnulib := -lgcc
endif
+preinit = $(addprefix $(csu-objpfx),crti.o)
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile glibc-2.16.0/Makefile
--- /home/janneke/src/glibc-2.16.0/Makefile 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/Makefile 2018-09-02 23:01:10.485803965 +0200
@@ -22,6 +22,9 @@ ifneq (,)
This makefile requires GNU Make.
endif
+SHELL := /bin/sh
+export SHELL
+
include Makeconfig
@@ -135,13 +138,10 @@ $(common-objpfx)linkobj/libc.so: $(elfob
$(shlib-lds)
$(build-shlib)
-$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
- $(common-objpfx)sunrpc/librpc_compat_pic.a
+$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
$(..)./scripts/mkinstalldirs $(common-objpfx)linkobj
(cd $(common-objpfx)linkobj; \
$(AR) x ../libc_pic.a; \
- rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
- $(AR) x ../sunrpc/librpc_compat_pic.a; \
$(AR) cr libc_pic.a *.os; \
rm *.os)
endif
@@ -151,7 +151,7 @@ endif
# the current libc build for testing.
$(common-objpfx)testrun.sh: $(common-objpfx)config.make \
$(..)Makeconfig $(..)Makefile
- (echo '#!/bin/sh'; \
+ (echo '#! $(SHELL)'; \
echo 'builddir=`dirname "$$0"`'; \
echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
echo 'exec $(subst $(common-objdir),"$${builddir}",\
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Makefile.in glibc-2.16.0/Makefile.in
--- /home/janneke/src/glibc-2.16.0/Makefile.in 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/Makefile.in 2018-09-02 13:03:01.892962551 +0200
@@ -9,3 +9,6 @@ all .DEFAULT:
install:
LANGUAGE=C LC_ALL=C; export LANGUAGE LC_ALL; \
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+
+export SHELL
+export BASH
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/malloc/Makefile glibc-2.16.0/malloc/Makefile
--- /home/janneke/src/glibc-2.16.0/malloc/Makefile 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/malloc/Makefile 2018-09-02 17:11:33.461547394 +0200
@@ -35,7 +35,7 @@ install-lib := libmcheck.a
non-lib.a := libmcheck.a
# Additional library.
-extra-libs = libmemusage
+extra-libs = #libmemusage
extra-libs-others = $(extra-libs)
libmemusage-routines = memusage
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/cache.c glibc-2.16.0/nscd/cache.c
--- /home/janneke/src/glibc-2.16.0/nscd/cache.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/nscd/cache.c 2018-09-02 23:38:31.757616750 +0200
@@ -74,7 +74,11 @@ struct datahead *
cache_search (request_type type, const void *key, size_t len,
struct database_dyn *table, uid_t owner)
{
+#if !BOOTSTRAP_GLIBC
unsigned long int hash = __nis_hash (key, len) % table->head->module;
+#else
+ unsigned long int hash = 0;
+#endif
unsigned long int nsearched = 0;
struct datahead *result = NULL;
@@ -153,7 +153,11 @@ cache_add (int type, const void *key, si
first ? _(" (first)") : "");
}
+#if !BOOTSTRAP_GLIBC
unsigned long int hash = __nis_hash (key, len) % table->head->module;
+#else
+ unsigned long int hash = 0;
+#endif
struct hashentry *newp;
newp = mempool_alloc (table, sizeof (struct hashentry), 0);
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/Makefile glibc-2.16.0/nscd/Makefile
--- /home/janneke/src/glibc-2.16.0/nscd/Makefile 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/nscd/Makefile 2018-09-02 23:49:29.948031787 +0200
@@ -126,9 +126,7 @@ include $(patsubst %,$(..)cppflags-itera
$(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
ifeq ($(build-shared),yes)
-$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \
- $(common-objpfx)nis/libnsl.so
+$(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library)
else
-$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \
- $(common-objpfx)nis/libnsl.a
+$(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library)
endif
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c glibc-2.16.0/nscd/nscd_helper.c
--- /home/janneke/src/glibc-2.16.0/nscd/nscd_helper.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/nscd/nscd_helper.c 2018-09-02 23:38:04.941189464 +0200
@@ -474,7 +474,7 @@ struct datahead *
__nscd_cache_search (request_type type, const char *key, size_t keylen,
const struct mapped_database *mapped, size_t datalen)
{
- unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
+ unsigned long int hash = 0;
size_t datasize = mapped->datasize;
ref_t trail = mapped->head->array[hash];
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c
--- /home/janneke/src/glibc-2.16.0/nss/function.def 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/nss/function.def 2018-09-18 13:54:49.582060539 +0200
@@ -63,10 +63,12 @@
DEFINE_GET (files, pwnam)
DEFINE_GET (files, pwuid)
+#if !BOOTSTRAP_GLIBC
/* rpc */
DEFINE_ENT (files, rpc)
DEFINE_GETBY (files, rpc, name)
DEFINE_GETBY (files, rpc, number)
+#endif
/* services */
DEFINE_ENT (files, serv)
diff -u ~/src/glibc-2.16.0/nss/getent.c glibc-2.16.0/nss/getent.c
--- /home/janneke/src/glibc-2.16.0/nss/getent.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/nss/getent.c 2018-09-18 13:57:41.856849140 +0200
@@ -700,6 +700,7 @@
return result;
}
+#if !BOOTSTRAP_GLIBC
/* Now is all for rpc */
static inline void
print_rpc (struct rpcent *rpc)
@@ -745,6 +746,7 @@
return result;
}
+#endif //rpc
/* for services */
static void
@@ -880,7 +882,9 @@
D(networks)
D(passwd)
D(protocols)
+#if !BOOTSTRAP_GLIBC
D(rpc)
+#endif
D(services)
D(shadow)
#undef D
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/resolv/netdb.h glibc-2.16.0/resolv/netdb.h
--- /home/janneke/src/glibc-2.16.0/resolv/netdb.h 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/resolv/netdb.h 2018-09-08 08:49:30.537811219 +0200
@@ -26,11 +26,13 @@
#include <netinet/in.h>
#include <stdint.h>
+#if 0 //!BOOTSTRAP_GLIBC
#ifdef __USE_MISC
/* This is necessary to make this include file properly replace the
Sun version. */
# include <rpc/netdb.h>
#endif
+#endif
#ifdef __USE_GNU
# define __need_sigevent_t
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/Rules glibc-2.16.0/Rules
--- /home/janneke/src/glibc-2.16.0/Rules 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/Rules 2018-09-02 10:52:06.927362861 +0200
@@ -24,6 +24,9 @@ ifneq (,)
This makefile requires GNU Make.
endif
+export SHELL
+export BASH
+
all: # Don't let the default goal come from Makeconfig.
include $(firstword $(..) ../)Makeconfig
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
--- /home/janneke/src/glibc-2.16.0/scripts/gen-as-const.awk 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/scripts/gen-as-const.awk 2018-09-01 18:08:37.266516330 +0200
@@ -14,6 +14,12 @@ BEGIN { started = 0 }
NF >= 1 && !started {
if (test) {
+ print "\n#include <stddef.h>";
+ print "\n#include <stdint.h>";
+# print "\ntypedef unsigned long size_t;";
+ print "\n#ifndef offsetof";
+ print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)";
+ print "\n#endif";
print "\n#include <inttypes.h>";
print "\n#include <stdio.h>";
print "\n#include <bits/wordsize.h>";
@@ -33,8 +39,15 @@ NF >= 1 && !started {
" source, #name, U (asconst_##name), #expr, (c_t) (expr));" \
" } else ++good;\n";
}
- else
+ else {
+ print "\n#include <stddef.h>";
+ print "\n#include <stdint.h>";
+# print "\ntypedef unsigned long size_t;";
+ print "\n#ifndef offsetof";
+ print "\n#define offsetof(type, field) ((size_t)&((type *)0)->field)";
+ print "\n#endif";
print "void dummy(void) {";
+ }
started = 1;
}
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c glibc-2.16.0/sunrpc/auth_none.c
--- /home/janneke/src/glibc-2.16.0/sunrpc/auth_none.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/sunrpc/auth_none.c 2018-09-02 22:09:21.629007932 +0200
@@ -95,7 +95,9 @@ authnone_create (void)
__libc_once (authnone_private_guard, authnone_create_once);
return &authnone_private.no_client;
}
+#if !BOOTSTRAP_GLIBC
libc_hidden_nolink_sunrpc (authnone_create, GLIBC_2_0)
+#endif
static bool_t
authnone_marshal (AUTH *client, XDR *xdrs)
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c glibc-2.16.0/sunrpc/authuxprot.c
--- /home/janneke/src/glibc-2.16.0/sunrpc/authuxprot.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/sunrpc/authuxprot.c 2018-09-02 22:15:51.927158451 +0200
@@ -63,4 +63,6 @@ xdr_authunix_parms (XDR * xdrs, struct a
}
return FALSE;
}
+#if !BOOTSTRAP_GLIBC
libc_hidden_nolink_sunrpc (xdr_authunix_parms, GLIBC_2_0)
+#endif
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c glibc-2.16.0/sunrpc/bindrsvprt.c
--- /home/janneke/src/glibc-2.16.0/sunrpc/bindrsvprt.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/sunrpc/bindrsvprt.c 2018-09-02 22:24:32.687187675 +0200
@@ -96,4 +96,7 @@ bindresvport (int sd, struct sockaddr_in
return res;
}
+#if !BOOTSTRAP_GLIBC
libc_hidden_def (bindresvport)
+#endif
+
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c glibc-2.16.0/sunrpc/clnt_raw.c
--- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_raw.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/sunrpc/clnt_raw.c 2018-09-02 22:33:21.151343826 +0200
@@ -40,6 +40,7 @@
#include <rpc/svc.h>
#include <rpc/xdr.h>
#include <libintl.h>
+#include <stddef.h>
#define MCALL_MSG_SIZE 24
@@ -129,7 +130,9 @@ clntraw_create (u_long prog, u_long vers
client->cl_auth = authnone_create ();
return client;
}
+#if !BOOTSTRAP_GLIBC
libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0)
+#endif
static enum clnt_stat
clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout)
diff '--exclude=*.orig' -purN /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c glibc-2.16.0/sunrpc/clnt_simp.c
--- /home/janneke/src/glibc-2.16.0/sunrpc/clnt_simp.c 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/sunrpc/clnt_simp.c 2018-09-02 22:34:14.884175251 +0200
@@ -139,7 +139,9 @@ callrpc (const char *host, u_long prognu
crp->valid = 0;
return (int) clnt_stat;
}
+#if !BOOTSTRAP_GLIBC
libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0)
+#endif
#ifdef _RPC_THREAD_SAFE_
void

View File

@ -0,0 +1,251 @@
This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
* Makefile: Do not assemble from stdin, use file indirection.
* Makefile: Add new target: install-lib-all.
* Makefile: Avoid building stub DOC.
* [_LIBC_REENTRANT]: Add missing guarding.
* [MES_BOOTSTRAP]: Disable some GCC extensions.
* [MES_BOOTSTRAP]: Add missing GCC div/mod defines.
Upstream status: Not presented upstream.
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
--- ../glibc-2.2.5/config.h.in 2001-11-16 02:02:56.000000000 +0100
+++ glibc-2.2.5/config.h.in 2018-06-17 21:30:02.313029074 +0200
@@ -1,3 +1,10 @@
+#if MES_BOOTSTRAP && BOOTSTRAP_GLIBC
+#undef __umoddi3
+#define __umoddi3(a,b) ((a)%(b))
+#undef __udivdi3
+#define __udivdi3(a,b) ((a)/(b))
+#endif
+
#if !defined ASSEMBLER && !defined _ISOMAC && !defined __OPTIMIZE__
# error "glibc cannot be compiled without optimization"
#endif
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
--- ../glibc-2.2.5/configure 2002-01-08 23:16:44.000000000 +0100
+++ glibc-2.2.5/configure 2018-06-07 20:47:26.608895319 +0200
@@ -1530,7 +1530,7 @@ echo "configure:1530: checking version o
ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 3.79* | 3.[89]*)
+ 3.79* | 3.[89]* | 4.*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
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
--- ../glibc-2.2.5/Makeconfig 2001-09-12 20:49:45.000000000 +0200
+++ glibc-2.2.5/Makeconfig 2018-06-20 16:33:35.472167202 +0200
@@ -400,7 +400,7 @@ ifndef +link
$(start-installed-name))\
$(+preinit) $(link-extra-libs) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
+ $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) -lc -lgcc2
endif
# Command for statically linking programs with the C library.
ifndef +link-static
@@ -412,7 +412,7 @@ ifndef +link-static
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
+ $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) -lc -lgcc2
endif
# Command for statically linking bounded-pointer programs with the C library.
ifndef +link-bounded
@@ -424,7 +424,7 @@ ifndef +link-bounded
$(start-installed-name))\
$(+preinit) $(link-extra-libs-bounded) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+ $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit) -lc -lgcc2
endif
ifndef config-LDFLAGS
ifeq (yesyes,$(build-shared)$(elf))
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
--- ../glibc-2.2.5/Makerules 2001-11-16 02:02:19.000000000 +0100
+++ glibc-2.2.5/Makerules 2018-06-10 15:03:42.390329860 +0200
@@ -748,6 +748,18 @@ endef
installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
$(inst_libdir)/$(patsubst %,$(libtype$o),\
$(libprefix)$(libc-name)))
+
+ifeq (yes,$(build-shared))
+install-lib-all: $(inst_libdir)/libc.a \
+ $(inst_slibdir)/libc.so$(libc.so-version) \
+ $(inst_slibdir)/libc-$(version).so \
+ $(inst_libdir)/libc.so \
+ install-lib
+else
+install-lib-all: $(inst_libdir)/libc.a \
+ install-lib
+endif
+
install: $(installed-libcs)
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
$(make-target-directory)
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
--- ../glibc-2.2.5/misc/syslog.c 2001-08-31 01:13:49.000000000 +0200
+++ glibc-2.2.5/misc/syslog.c 2018-06-09 09:01:20.008918690 +0200
@@ -216,9 +216,11 @@ vsyslog(pri, fmt, ap)
/* Prepare for multiple users. We have to take care: open and
write are cancellation points. */
+#if _LIBC_REENTRANT
__libc_cleanup_region_start (1, (void (*) (void *)) cancel_handler,
&oldaction_ptr);
__libc_lock_lock (syslog_lock);
+#endif
/* Prepare for a broken connection. */
memset (&action, 0, sizeof (action));
@@ -268,9 +270,11 @@ vsyslog(pri, fmt, ap)
if (sigpipe == 0)
__sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+#if _LIBC_REENTRANT
/* End of critical section. */
__libc_cleanup_region_end (0);
__libc_lock_unlock (syslog_lock);
+#endif
free (buf);
}
@@ -326,16 +330,20 @@ openlog_internal(const char *ident, int
void
openlog (const char *ident, int logstat, int logfac)
{
+#if _LIBC_REENTRANT
/* Protect against multiple users. */
__libc_cleanup_region_start (1,
(void (*) __P ((void *))) __libc_mutex_unlock,
&syslog_lock);
__libc_lock_lock (syslog_lock);
+#endif
openlog_internal (ident, logstat, logfac);
+#if _LIBC_REENTRANT
/* Free the lock. */
__libc_cleanup_region_end (1);
+#endif
}
static void
@@ -358,18 +366,22 @@ closelog_internal()
void
closelog ()
{
+#if _LIBC_REENTRANT
/* Protect against multiple users. */
__libc_cleanup_region_start (1,
(void (*) __P ((void *))) __libc_mutex_unlock,
&syslog_lock);
__libc_lock_lock (syslog_lock);
+#endif
closelog_internal ();
LogTag = NULL;
LogType = SOCK_DGRAM; /* this is the default */
+#if _LIBC_REENTRANT
/* Free the lock. */
__libc_cleanup_region_end (1);
+#endif
}
#ifdef _LIBC_REENTRANT
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
--- ../glibc-2.2.5/Rules 2001-08-30 00:44:35.000000000 +0200
+++ glibc-2.2.5/Rules 2018-06-09 08:15:54.880683675 +0200
@@ -218,7 +218,7 @@ endif
fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
- fopen_max=$${fopen_max:-16}; \
+ fopen_max=$${fu_fopen_max:-16}; \
filename_max=$${filename_max:-1024}; \
if [ -z $$iov_max ]; then \
define_iov_max="# undef IOV_MAX"; \
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
--- ../glibc-2.2.5/stdio-common/perror.c 2001-09-01 07:33:01.000000000 +0200
+++ glibc-2.2.5/stdio-common/perror.c 2018-06-09 10:42:25.909899529 +0200
@@ -48,6 +48,9 @@ perror_internal (FILE *fp, const char *s
}
+#if MES_BOOTSTRAP
+#define fileno_unlocked(x) 1
+#endif
/* Print a line on stderr consisting of the text in S, a colon, a space,
a message describing the meaning of the contents of `errno' and a newline.
If S is NULL or "", the colon and space are omitted. */
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
--- ../glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c 2001-07-06 06:55:53.000000000 +0200
+++ glibc-2.2.5/sysdeps/i386/fpu/ftestexcept.c 2018-06-09 09:45:13.363031424 +0200
@@ -25,8 +25,10 @@ fetestexcept (int excepts)
{
int temp;
+#if !MES_BOOTSTRAP
/* Get current exceptions. */
__asm__ ("fnstsw %0" : "=a" (temp));
+#endif
return temp & excepts & FE_ALL_EXCEPT;
}
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
--- ../glibc-2.2.5/sysdeps/unix/make-syscalls.sh 2001-09-13 00:19:30.000000000 +0200
+++ glibc-2.2.5/sysdeps/unix/make-syscalls.sh 2018-06-20 15:16:01.813004453 +0200
@@ -173,7 +173,7 @@ shared-only-routines += $file
done
# And finally, pipe this all into the compiler.
- echo ' ) | $(COMPILE.S) -x assembler-with-cpp -o $@ -'
+ echo ' ) > stdin.c; $(COMPILE.S) -x assembler-with-cpp -o $@ stdin.c'
case $weak in
*@*)
@@ -284,7 +284,7 @@ shared-only-routines += $file
echo "\
echo ''; \\
echo '#include <bp-thunks.h>'; \\
- ) | \$(COMPILE.c) -x c -o \$@ -"
+ ) > stdin.c; \$(COMPILE.c) -x c -o \$@ stdin.c"
### Use this for debugging intermediate output:
### ) >\$(@:.ob=.c)
### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c)
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
--- ../glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h 2001-07-06 06:56:21.000000000 +0200
+++ glibc-2.2.5/sysdeps/unix/sysv/linux/sys/timex.h 2018-06-09 20:09:07.713806647 +0200
@@ -54,10 +54,12 @@ struct timex
long int errcnt; /* calibration errors (ro) */
long int stbcnt; /* stability limit exceeded (ro) */
+#if !MES_BOOTSTRAP
/* ??? */
int :32; int :32; int :32; int :32;
int :32; int :32; int :32; int :32;
int :32; int :32; int :32; int :32;
+#endif
};
/* Mode codes (timex.mode) */
--- ../glibc-2.2.5/manual/Makefile 2001-08-28 10:05:40.000000000 +0200
+++ glibc-2.2.5/manual/Makefile 2018-06-09 10:13:03.093633660 +0200
@@ -247,7 +247,11 @@
.PHONY: stubs
stubs: $(objpfx)stubs
endif
-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
+po/manual.pot $(objpfx)stubs:
+ $(make-target-directory)
+ touch $@
+
+$(objpfx)stamp%:
$(make-target-directory)
touch $@

View File

@ -0,0 +1,30 @@
We want to allow builds in chroots that lack /bin/sh. Thus, system(3)
and popen(3) need to be tweaked to use the right shell. For the bootstrap
glibc, we just use whatever `sh' can be found in $PATH. The final glibc
instead uses the hard-coded absolute file name of `bash'.
--- a/sysdeps/posix/system.c
+++ b/sysdeps/posix/system.c
@@ -134,7 +134,7 @@ do_system (const char *line)
INIT_LOCK ();
/* Exec the shell. */
- (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
+ (void) __execvpe (SHELL_NAME, (char *const *) new_argv, __environ);
_exit (127);
}
else if (pid < (pid_t) 0)
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -145,7 +145,7 @@ _IO_new_proc_open (fp, command, mode)
_IO_close (fd);
}
- _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+ execlp ("sh", "sh", "-c", command, (char *) 0);
_IO__exit (127);
}
_IO_close (child_end);

View File

@ -1,3 +1,6 @@
Two small patches off the current Mes `wip' branch, that enable using
Nyacc-0.86.0; and a fix for running ./check.sh.
From 9e610736bf779f3295c1192e748cd19cbbe3be28 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Wed, 5 Sep 2018 20:28:06 +0200
@ -195,3 +198,28 @@ index 9e341cba..c2efb32c 100644
--
2.18.0
From 20deefe6ea0d62a3338a8e2a9552d2a20b0f607e Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sun, 9 Sep 2018 07:11:50 +0200
Subject: [PATCH] build: Oops, fix ./check.sh for bootstrap build.
* build-aux/config.sh (top_builddir): Set default to `.'.
---
build-aux/config.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/build-aux/config.sh b/build-aux/config.sh
index a4b9fdef..4fa84441 100644
--- a/build-aux/config.sh
+++ b/build-aux/config.sh
@@ -17,6 +17,7 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
srcdir=${srcdir-.}
+top_builddir=${top_builddir-.}
if [ "$V" = 2 ]; then
echo $0
echo srcdest=${srcdest}
--
2.18.0

View File

@ -0,0 +1,26 @@
From 1431ba3a99582e4c3d2693ac37e57f361858affd Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Mon, 11 Jun 2018 18:39:44 +0200
Subject: [PATCH] bootstrappable: Force static link.
---
libtcc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libtcc.c b/libtcc.c
index 3448f44..02ab850 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -735,6 +735,9 @@ LIBTCCAPI TCCState *tcc_new(void)
tcc_state = s;
++nb_states;
+#if BOOTSTRAP
+ s->static_link = 1;
+#endif
s->alacarte_link = 1;
s->nocommon = 1;
s->warn_implicit_function_declaration = 1;
--
2.16.2