aboutsummaryrefslogtreecommitdiffstats
path: root/glibc
diff options
context:
space:
mode:
Diffstat (limited to 'glibc')
-rw-r--r--glibc/Makefile436
-rw-r--r--glibc/README13
-rwxr-xr-xglibc/finalize.sh31
-rw-r--r--glibc/hashes/binutils-2.33.1.tar.xz.sha11
-rw-r--r--glibc/hashes/binutils-2.34.tar.xz.sha11
-rw-r--r--glibc/hashes/config.guess.1912ca50411bb77fb2c610ef55dd91e332663de9.sha11
-rw-r--r--glibc/hashes/config.sub.1912ca50411bb77fb2c610ef55dd91e332663de9.sha11
-rw-r--r--glibc/hashes/gcc-9.2.0.tar.xz.sha11
-rw-r--r--glibc/hashes/gcc-9.3.0.tar.xz.sha11
-rw-r--r--glibc/hashes/gdb-8.3.1.tar.xz.sha11
-rw-r--r--glibc/hashes/glibc-2.30.tar.xz.sha11
-rw-r--r--glibc/hashes/glibc-2.31.tar.xz.sha11
-rw-r--r--glibc/hashes/gmp-6.1.2.tar.xz.sha11
-rw-r--r--glibc/hashes/isl-0.21.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.3.8.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.3.9.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.4.11.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.5.1.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.5.10.tar.xz.sha11
-rw-r--r--glibc/hashes/linux-5.7.6.tar.xz.sha11
-rw-r--r--glibc/hashes/mpc-1.1.0.tar.gz.sha11
-rw-r--r--glibc/hashes/mpfr-4.0.2.tar.xz.sha11
-rw-r--r--glibc/hashes/musl-1.2.0.tar.gz.sha11
-rw-r--r--glibc/patches/gcc-9.2.0/cxx_for_build.patch11
-rw-r--r--glibc/patches/gcc-9.2.0/find_limits_h.patch12
-rw-r--r--glibc/patches/gcc-9.2.0/libsanitizer_ipcperm_mode.patch44
-rw-r--r--glibc/patches/gcc-9.3.0/cxx_for_build.patch11
-rw-r--r--glibc/patches/gcc-9.3.0/find_limits_h.patch12
-rw-r--r--glibc/patches/gdb-8.3.1/arm64.diff40
-rw-r--r--glibc/patches/gdb-8.3.1/ppc-musl.diff93
-rw-r--r--glibc/patches/gdb-8.3.1/ppc-ptregs.diff10
-rw-r--r--glibc/patches/gdb-8.3.1/remove-extraneous-include.diff12
-rw-r--r--glibc/patches/gdb-8.3.1/s390x-use-elf-gdb_fpregset_t.diff156
-rw-r--r--glibc/targets/genericv7a/options1
-rw-r--r--glibc/targets/genericv7a/triplet1
-rw-r--r--glibc/targets/h3/options1
-rw-r--r--glibc/targets/h3/triplet1
-rw-r--r--glibc/targets/i486/options1
-rw-r--r--glibc/targets/i486/triplet1
-rw-r--r--glibc/targets/i686/options1
-rw-r--r--glibc/targets/i686/triplet1
-rw-r--r--glibc/targets/kryo485/options1
-rw-r--r--glibc/targets/kryo485/triplet1
-rw-r--r--glibc/targets/o3/options1
-rw-r--r--glibc/targets/o3/triplet1
-rw-r--r--glibc/targets/p7/options1
-rw-r--r--glibc/targets/p7/triplet1
-rw-r--r--glibc/targets/pc/options1
-rw-r--r--glibc/targets/pc/triplet1
-rw-r--r--glibc/targets/pi3/options1
-rw-r--r--glibc/targets/pi3/triplet1
51 files changed, 919 insertions, 0 deletions
diff --git a/glibc/Makefile b/glibc/Makefile
new file mode 100644
index 0000000..13a2b29
--- /dev/null
+++ b/glibc/Makefile
@@ -0,0 +1,436 @@
+it: all
+
+include ../config
+
+O ?= $(CURDIR)/out
+
+MIN_KERNEL_VER := 4.14.86
+LINUX_URL := https://cdn.kernel.org/pub/linux/kernel/v$(firstword $(subst ., ,$(LINUX_VER))).x
+GLIBC_URL := https://ftp.gnu.org/pub/gnu/glibc
+GMP_URL := https://gmplib.org/download/gmp
+MPFR_URL := https://www.mpfr.org/mpfr-$(MPFR_VER)
+MPC_URL := https://ftp.gnu.org/gnu/mpc
+ISL_URL := http://isl.gforge.inria.fr
+BINUTILS_URL := https://ftp.gnu.org/gnu/binutils
+GCC_URL := https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VER)
+GDB_URL := https://ftp.gnu.org/gnu/gdb
+
+GMP_OPTIONS := --disable-assembly --enable-cxx
+MPFR_OPTIONS := --enable-warnings --enable-shared-cache --disable-decimal-float --disable-float128 --with-gmp=$(O)/build/pc/BUILD
+MPC_OPTIONS := --with-gmp=$(O)/build/pc/BUILD --with-mpfr=$(O)/build/pc/BUILD
+ISL_OPTIONS := --with-gmp-prefix=$(O)/build/pc/BUILD
+
+PACKAGES := LINUX GLIBC GMP MPFR MPC ISL BINUTILS GCC GDB
+BPACKAGES := GMP MPFR MPC ISL
+XTARGETS := pc $(filter-out pc,$(subst targets/,,$(wildcard targets/*)))
+XTARGETS_DONE := $(patsubst %,$(O)/mk/%-deb.done,$(XTARGETS))
+ALL_PACKAGES :=
+
+MAKE += MULTILIB_OSDIRNAMES=
+MAKE += ac_cv_prog_lex_root=lex.yy
+
+PATH := $(O)/build/pc/ROOT/bin:$(PATH)
+
+define sources_download_and_unpack
+
+$(1)_NAME := $(shell echo $(1) | tr A-Z a-z)
+ALL_PACKAGES += $$($(1)_NAME)
+
+ifeq ($(1),MPC)
+$(1)_EXT := gz
+$(1)_J := z
+else
+$(1)_EXT := xz
+$(1)_J := J
+endif
+
+$(O)/mk/$$($(1)_NAME).downloaded: $(O)/mk/pc-0
+ exec curl -o $(O)/sources/$$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT) $$($(1)_URL)/$$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT)
+ exec touch $$@
+
+$(O)/mk/$$($(1)_NAME).unpacked: $(O)/mk/$$($(1)_NAME).downloaded hashes/$$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT).sha1
+ cd $(O)/sources && sha1sum $$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT) | cmp - $(CURDIR)/hashes/$$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT).sha1
+ cd $(O)/sources && rm -rf $$($(1)_NAME)-$$($(1)_VER) && tar -$$($(1)_J) -xpvf $$($(1)_NAME)-$$($(1)_VER).tar.$$($(1)_EXT)
+ if test -d $(CURDIR)/patches/$$($(1)_NAME)-$$($(1)_VER) ; then cd $(O)/sources/$$($(1)_NAME)-$$($(1)_VER) && for i in $(CURDIR)/patches/$$($(1)_NAME)-$$($(1)_VER)/* ; do patch -p1 < $$$$i ; done ; fi
+ exec touch $$@
+
+endef
+
+$(foreach pkg,$(PACKAGES),$(eval $(call sources_download_and_unpack,$(pkg))))
+
+define build_configure_make_install
+
+$(O)/mk/$$($(1)_NAME).configured: $(O)/mk/$$($(1)_NAME).unpacked
+ exec mkdir -p $(O)/build/pc/$$($(1)_NAME)
+ cd $(O)/build/pc/$$($(1)_NAME) && \
+ $(O)/sources/$$($(1)_NAME)-$$($(1)_VER)/configure --prefix=$(O)/build/pc/BUILD --disable-shared --with-gnu-ld --with-pic $$($(1)_OPTIONS)
+ exec touch $$@
+
+$(O)/mk/$$($(1)_NAME).built: $(O)/mk/$$($(1)_NAME).configured
+ cd $(O)/build/pc/$$($(1)_NAME) && $$(MAKE)
+ exec touch $$@
+
+$(O)/mk/$$($(1)_NAME).installed: $(O)/mk/$$($(1)_NAME).built
+ cd $(O)/build/pc/$$($(1)_NAME) && $$(MAKE) install
+ exec touch $$@
+
+endef
+
+$(foreach pkg,$(BPACKAGES),$(eval $(call build_configure_make_install,$(pkg))))
+
+define targets_definition
+
+$(1)_TRIPLET := $(shell cat targets/$(1)/triplet)
+$(1)_ARCH := $$(firstword $$(subst -, ,$$($(1)_TRIPLET)))
+$(1)_KARCH := $$(patsubst i%86,x86,$$(patsubst powerpc%,powerpc,$$(patsubst mips%,mips,$$(subst aarch64,arm64,$$($(1)_ARCH)))))
+$(1)_OPTIONS := $(shell cat targets/$(1)/options 2>/dev/null)
+$(1)_SYSROOT := $(O)/build/$(1)/SYSROOT/$$($(1)_TRIPLET)
+$(1)_OUTPUT := $(O)/cross/$(1).tmp
+$(1)_FINAL := $(O)/cross/$$($(1)_TRIPLET)_$(1)-$(GCC_VER)
+$(1)_PATH := $(O)/build/$(1)/SYSROOT/bin:$(PATH)
+
+$(1): $(O)/mk/$(1)-deb.done
+
+ifneq ($(strip $(GDB_VER)),)
+$(O)/mk/$(1)-cross.done: $(O)/mk/$(1)-gdb.done $(O)/mk/$(1)-gdbserver.done
+endif
+
+$(O)/mk/$(1)-0: $(O)/mk/0
+ exec mkdir -p $$($(1)_SYSROOT)/share $$($(1)_SYSROOT)/include $$($(1)_OUTPUT)/$$($(1)_TRIPLET)/share $$(patsubst %,$(O)/build/$(1)/%,$(ALL_PACKAGES) gdbserver)
+ exec ln -sf . $$($(1)_SYSROOT)/usr
+ exec ln -sf . $$($(1)_OUTPUT)/$$($(1)_TRIPLET)/usr
+ exec touch $$@
+
+$(O)/mk/$(1)-cross.archived: $(O)/mk/$(1)-cross.done
+ exec rm -f $(O)/cross/$$($(1)_TRIPLET)_$(1)-$(GCC_VER).tar.xz
+ exec tar --owner=0 --group=0 --numeric-owner -C $(O)/cross -Jcvf $$($(1)_FINAL).tar.xz $$($(1)_TRIPLET)_$(1)-$(GCC_VER)
+ exec touch $$@
+
+$(O)/mk/$(1)-cross.done: $(O)/mk/$(1)-binutils.done $(O)/mk/$(1)-gcc.done $(O)/mk/$(1)-glibc.done $(O)/mk/$(1)-linuxheaders.done
+ exec $(CURDIR)/finalize.sh $(1)
+ exec touch $$@
+
+$(O)/mk/$(1)-deb.done: $(O)/mk/$(1)-cross.archived
+ exec $(CURDIR)/../deb/builddeb.sh $(O) $(1) glibc $(PACKAGE_VER)
+ exec touch $$@
+
+# gdb
+
+$(O)/mk/$(1)-gdb.configured: $(O)/mk/gdb.unpacked $(O)/mk/gmp.installed $(O)/mk/mpfr.installed $(O)/mk/mpc.installed $(O)/mk/isl.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gdb && \
+ env PATH=$$(PATH) \
+ $(O)/sources/gdb-$(GDB_VER)/configure \
+ --prefix= \
+ --build=$(pc_TRIPLET) \
+ --host=$(pc_TRIPLET) \
+ --target=$$($(1)_TRIPLET) \
+ --enable-gold=no \
+ --disable-nls \
+ --disable-libquadmath \
+ --disable-libquadmath-support \
+ --disable-bootstrap \
+ --disable-gdbserver \
+ --enable-stage1-languages=c,c++ \
+ --with-gmp=$(O)/build/pc/BUILD \
+ --with-mpfr=$(O)/build/pc/BUILD \
+ --with-mpc=$(O)/build/pc/BUILD \
+ --with-isl=$(O)/build/pc/BUILD
+ exec touch $$@
+
+$(O)/mk/$(1)-gdb.built: $(O)/mk/$(1)-gdb.configured | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gdb && \
+ env PATH=$$(PATH) \
+ $$(MAKE) all-gdb
+ exec touch $$@
+
+$(O)/mk/$(1)-gdb.done: $(O)/mk/$(1)-gdb.built | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gdb && \
+ env PATH=$$(PATH) \
+ $$(MAKE) install-gdb DESTDIR=$$($(1)_OUTPUT)
+ exec touch $$@
+
+$(O)/mk/$(1)-gdbserver.configured: $(O)/mk/gdb.unpacked $(O)/mk/$(1)-gcc.installed
+ cd $(O)/build/$(1)/gdbserver && \
+ env PATH=$$($(1)_PATH) \
+ $(O)/sources/gdb-$(GDB_VER)/gdb/gdbserver/configure \
+ --prefix= \
+ --host=$$($(1)_TRIPLET) \
+ --without-ust \
+ --disable-inprocess-agent
+ exec touch $$@
+
+$(O)/mk/$(1)-gdbserver.built: $(O)/mk/$(1)-gdbserver.configured
+ cd $(O)/build/$(1)/gdbserver && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE)
+ exec touch $$@
+
+$(O)/mk/$(1)-gdbserver.done: $(O)/mk/$(1)-gdbserver.built
+ cd $(O)/build/$(1)/gdbserver && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) install DESTDIR=$$($(1)_OUTPUT)/$$($(1)_TRIPLET)
+ exec $$($(1)_OUTPUT)/bin/$$($(1)_TRIPLET)-strip -R .note -R .comment $$($(1)_OUTPUT)/$$($(1)_TRIPLET)/bin/gdbserver
+ exec touch $$@
+
+
+# binutils
+
+$(O)/mk/$(1)-binutils.configured: $(O)/mk/binutils.unpacked | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/binutils && \
+ env PATH=$$(PATH) \
+ $(O)/sources/binutils-$(BINUTILS_VER)/configure --disable-multilib --disable-werror --target=$$($(1)_TRIPLET) \
+ --prefix= \
+ --disable-nls \
+ --disable-separate-code \
+ --enable-deterministic-archives
+ exec touch $$@
+
+$(O)/mk/$(1)-binutils.built: $(O)/mk/$(1)-binutils.configured | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/binutils && \
+ env PATH=$$(PATH) \
+ $$(MAKE) all
+ exec touch $$@
+
+$(O)/mk/$(1)-binutils.installed: $(O)/mk/$(1)-binutils.built | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/binutils && \
+ env PATH=$$(PATH) \
+ $$(MAKE) install DESTDIR=$(O)/build/$(1)/SYSROOT
+ exec touch $$@
+
+$(O)/mk/$(1)-binutils.done: $(O)/mk/$(1)-binutils.built | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/binutils && \
+ env PATH=$$(PATH) \
+ $$(MAKE) install DESTDIR=$$($(1)_OUTPUT)
+ exec touch $$@
+
+
+# linux headers
+
+$(O)/mk/$(1)-linuxheaders.built: $(O)/mk/linux.unpacked | $(O)/mk/$(1)-0
+ exec mkdir -p $(O)/build/$(1)/linux-staging/build $(O)/build/$(1)/linux-staging/headers
+ cd $(O)/sources/linux-$(LINUX_VER) && \
+ env PATH=$$(PATH) \
+ $$(MAKE) ARCH=$$($(1)_KARCH) O=$(O)/build/$(1)/linux-staging/build INSTALL_HDR_PATH=$(O)/build/$(1)/linux-staging/headers headers_install
+ exec find $(O)/build/$(1)/linux-staging/headers/include '(' -name '*.cmd' -o -name '*.chk' ')' -exec rm {} +
+ exec touch $$@
+
+$(O)/mk/$(1)-linuxheaders.installed: $(O)/mk/$(1)-linuxheaders.built | $(O)/mk/$(1)-0
+ exec cp -a $(O)/build/$(1)/linux-staging/headers/include $$($(1)_SYSROOT)
+ exec touch $$@
+
+$(O)/mk/$(1)-linuxheaders.done: $(O)/mk/$(1)-linuxheaders.built | $(O)/mk/$(1)-0
+ exec cp -a $(O)/build/$(1)/linux-staging/headers/include $$($(1)_OUTPUT)/$$($(1)_TRIPLET)/
+ exec touch $$@
+
+
+# gcc and glibc, in several steps
+
+$(O)/mk/$(1)-gcc.configured: $(O)/mk/gcc.ready $(O)/mk/pc-nativegcc.installed $(O)/mk/$(1)-binutils.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gcc && \
+ env PATH=$$($(1)_PATH) \
+ $(O)/sources/gcc/configure --prefix= --with-gnu-ld --with-gnu-as --target=$$($(1)_TRIPLET) \
+ --enable-languages=c,c++ \
+ --enable-c99 \
+ --disable-werror \
+ --libdir=/lib \
+ --disable-multilib \
+ --with-sysroot=/$$($(1)_TRIPLET) \
+ --with-build-sysroot=$$($(1)_SYSROOT) \
+ --enable-tls \
+ --disable-libmudflap \
+ --disable-libmpx \
+ --enable-libstdcxx-time \
+ --enable-clocale=gnu \
+ --enable-threads=posix \
+ --disable-libquadmath \
+ --disable-decimal-float \
+ --with-cloog=no \
+ --with-ppl=no \
+ --disable-libstdcxx-pch \
+ --enable-gnu-unique-object \
+ --enable-linker-build-id \
+ --disable-sjlj-exceptions \
+ --enable-libssp \
+ CFLAGS="-g0 -O2" CXXFLAGS="-g0 -O2" \
+ $$($(1)_OPTIONS)
+ exec touch $$@
+
+$(O)/mk/$(1)-gcc.bootstrapped: $(O)/mk/$(1)-gcc.configured | $(O)/mk/$(1)-0
+ env PATH=$$($(1)_PATH) \
+ $(SHELL) -c 'cd $(O)/build/$(1)/gcc && \
+ $$(MAKE) all-gcc LIMITS_H_TEST=true && \
+ $$(MAKE) install-gcc LIMITS_H_TEST=true DESTDIR=$(O)/build/$(1)/SYSROOT'
+ exec touch $$@
+
+$(O)/mk/$(1)-glibc.configured: $(O)/mk/glibc.unpacked $(O)/mk/$(1)-gcc.bootstrapped $(O)/mk/$(1)-binutils.installed $(O)/mk/$(1)-linuxheaders.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/glibc && \
+ env \
+ PATH=$$($(1)_PATH) \
+ CFLAGS="-O2" \
+ $(O)/sources/glibc-$(GLIBC_VER)/configure \
+ --build=$(pc_TRIPLET) \
+ --host=$$($(1)_TRIPLET) \
+ --target=$$($(1)_TRIPLET) \
+ --prefix= \
+ --enable-shared \
+ --disable-profile \
+ --enable-bind-now \
+ --enable-kernel=$(MIN_KERNEL_VER) \
+ --disable-werror \
+ --disable-experimental-malloc \
+ --disable-build-nscd \
+ --disable-nscd \
+ --disable-timezone-tools \
+ --enable-tunables=no \
+ --with-headers=$$($(1)_SYSROOT)/include \
+ libc_cv_forced_unwind=yes \
+ libc_cv_c_cleanup=yes \
+ libc_cv_ctors_header=no
+ exec touch $$@
+
+$(O)/mk/$(1)-glibc.bootstrapped: $(O)/mk/$(1)-linuxheaders.installed $(O)/mk/$(1)-glibc.configured $(O)/mk/$(1)-gcc.bootstrapped | $(O)/mk/$(1)-0
+ env PATH=$$($(1)_PATH) \
+ $(SHELL) -c 'cd $(O)/build/$(1)/glibc && \
+ $$(MAKE) install-bootstrap-headers=yes install-headers DESTDIR=$$($(1)_SYSROOT) && \
+ $$(MAKE) csu/subdir_lib && \
+ $$($(1)_TRIPLET)-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $$($(1)_SYSROOT)/lib/libc.so'
+ exec cp -f $(O)/build/$(1)/glibc/csu/crt1.o $(O)/build/$(1)/glibc/csu/crti.o $(O)/build/$(1)/glibc/csu/crtn.o $$($(1)_SYSROOT)/lib/
+ exec mkdir -p $$($(1)_SYSROOT)/include/gnu
+ exec touch $$($(1)_SYSROOT)/include/gnu/stubs.h
+ exec touch $$@
+
+$(O)/mk/$(1)-gcc.libbuilt: $(O)/mk/$(1)-gcc.bootstrapped $(O)/mk/$(1)-glibc.bootstrapped | $(O)/mk/$(1)-0
+ env PATH=$$($(1)_PATH) \
+ $(SHELL) -c 'cd $(O)/build/$(1)/gcc && \
+ $$(MAKE) MAKE="$$(MAKE) enable_shared=no" all-target-libgcc LIMITS_H_TEST=true && \
+ $$(MAKE) MAKE="$$(MAKE) enable_shared=no" install-target-libgcc LIMITS_H_TEST=true DESTDIR=$(O)/build/$(1)/SYSROOT'
+ exec ln -sf libgcc.a $(O)/build/$(1)/SYSROOT/lib/gcc/$$($(1)_TRIPLET)/$(GCC_VER)/libgcc_eh.a
+ exec touch $$@
+
+$(O)/mk/$(1)-glibc.built: $(O)/mk/$(1)-glibc.configured $(O)/mk/$(1)-gcc.libbuilt | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/glibc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) MAKEINFO=
+ exec touch $$@
+
+# glibc's "make install" is buggy when parallelized
+$(O)/mk/$(1)-glibc.installed: $(O)/mk/$(1)-glibc.built | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/glibc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) -j1 install MAKEINFO= PERL=no DESTDIR=$$($(1)_SYSROOT)
+ exec touch $$@
+
+# You can't run two glibc installations at once.
+$(O)/mk/$(1)-glibc.done: $(O)/mk/$(1)-glibc.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/glibc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) -j1 install MAKEINFO= PERL=no DESTDIR=$$($(1)_OUTPUT)/$$($(1)_TRIPLET)
+ exec sed -i -e 's|/lib/l|=/lib/l|g' $$($(1)_OUTPUT)/$$($(1)_TRIPLET)/lib/libc.so # Extra hack against Alchemy braindeadness
+ exec touch $$@
+
+$(O)/mk/$(1)-gcc.built: $(O)/mk/$(1)-gcc.bootstrapped $(O)/mk/$(1)-glibc.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gcc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) MAKEINFO=true LIMITS_H_TEST=true
+ exec touch $$@
+
+$(O)/mk/$(1)-gcc.installed: $(O)/mk/$(1)-gcc.built | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gcc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) install MAKEINFO=true LIMITS_H_TEST=true DESTDIR=$(O)/build/$(1)/SYSROOT
+ exec touch $$@
+
+# You can't run two gcc installations at once.
+$(O)/mk/$(1)-gcc.done: $(O)/mk/$(1)-gcc.installed | $(O)/mk/$(1)-0
+ cd $(O)/build/$(1)/gcc && \
+ env PATH=$$($(1)_PATH) \
+ $$(MAKE) install MAKEINFO=true LIMITS_H_TEST=true DESTDIR=$$($(1)_OUTPUT)
+ exec touch $$@
+
+$(1)-gcc: $(O)/mk/$(1)-gcc.done
+$(1)-glibc: $(O)/mk/$(1)-glibc.done
+
+$(1)-clean:
+ exec rm -rf $(O)/mk/$(1)-* $(O)/build/$(1) $$($(1)_OUTPUT)
+
+.PHONY: $(1) $(1)-gcc $(1)-glibc $(1)-clean
+
+endef
+
+$(foreach target,$(XTARGETS),$(eval $(call targets_definition,$(target))))
+
+
+all: $(XTARGETS)
+
+clean:
+ exec rm -rf $(patsubst %,$(O)/mk/%-*,$(XTARGETS)) $(O)/build/* $(O)/sources/gcc
+ if test -d $(O)/mk ; then cd $(O)/mk && ls -1 . | grep -v -e '\.downloaded$$' -e '\.unpacked$$' | xargs rm -f ; fi
+
+distclean:
+ exec rm -rf $(O)
+
+native: $(O)/mk/pc-nativegcc.installed
+
+debcopy: $(XTARGETS_DONE)
+ exec scp -P 4222 $(O)/deb/*.deb apt-parrot@canari.pfa.tds:deb/
+
+.PHONY: it all mclean clean distclean native debcopy
+
+
+$(O)/mk/0:
+ @exec mkdir -p $(O)/mk $(O)/cross $(O)/build/pc/ROOT $(O)/build/pc/BUILD/gcc $(O)/build/pc/BUILD/glibc $(O)/sources
+ exec touch $@
+
+$(O)/mk/mpfr.configured: $(O)/mk/gmp.installed
+$(O)/mk/mpc.configured: $(O)/mk/gmp.installed $(O)/mk/mpfr.installed
+$(O)/mk/isl.configured: $(O)/mk/gmp.installed
+
+$(O)/mk/gcc.ready: $(O)/mk/gcc.unpacked $(O)/mk/gmp.unpacked $(O)/mk/mpfr.unpacked $(O)/mk/mpc.unpacked $(O)/mk/isl.unpacked
+ exec rm -rf $(O)/sources/gcc
+ exec mkdir $(O)/sources/gcc
+ cd $(O)/sources/gcc && ln -sf ../gcc-$(GCC_VER)/* .
+ exec ln -sf ../gmp-$(GMP_VER) $(O)/sources/gcc/gmp
+ exec ln -sf ../mpfr-$(MPFR_VER) $(O)/sources/gcc/mpfr
+ exec ln -sf ../mpc-$(MPC_VER) $(O)/sources/gcc/mpc
+ exec ln -sf ../isl-$(ISL_VER) $(O)/sources/gcc/isl
+ exec touch $@
+
+$(O)/mk/pc-nativegcc.configured: $(O)/mk/gcc.ready | $(O)/mk/pc-0
+ cd $(O)/build/pc/BUILD/gcc && \
+ $(O)/sources/gcc/configure --disable-nls --with-gnu-ld --with-gnu-as \
+ --prefix=$(O)/build/pc/ROOT \
+ --with-glibc-version=$(GLIBC_VER) \
+ --enable-languages=c,c++ \
+ --enable-c99 \
+ --disable-werror \
+ --disable-multilib \
+ --enable-tls \
+ --disable-libmudflap \
+ --disable-libmpx \
+ --enable-libstdcxx-time \
+ --enable-clocale=gnu \
+ --enable-threads=posix \
+ --disable-libquadmath --disable-libquadmath-support \
+ --disable-decimal-float \
+ --with-cloog=no \
+ --with-ppl=no \
+ --disable-libstdcxx-pch \
+ --enable-gnu-unique-object \
+ --enable-linker-build-id \
+ --disable-sjlj-exceptions \
+ --disable-gcov \
+ --disable-libssp \
+ --disable-libgomp \
+ --disable-libvtv \
+ --disable-libsanitizer \
+ CFLAGS='-g0 -O2' CXXFLAGS='-g0 -O2' \
+ $(pc_OPTIONS)
+ exec touch $@
+
+$(O)/mk/pc-nativegcc.built: $(O)/mk/pc-nativegcc.configured | $(O)/mk/pc-0
+ cd $(O)/build/pc/BUILD/gcc && $(MAKE)
+ exec touch $@
+
+$(O)/mk/pc-nativegcc.installed: $(O)/mk/pc-nativegcc.built | $(O)/mk/pc-0
+ cd $(O)/build/pc/BUILD/gcc && $(MAKE) install
+ exec touch $@
diff --git a/glibc/README b/glibc/README
new file mode 100644
index 0000000..d1b9d39
--- /dev/null
+++ b/glibc/README
@@ -0,0 +1,13 @@
+This set of tools builds gcc+glibc cross-toolchains.
+It worked in 2020, but hasn't been maintained since.
+You may be able to make it work with some tweaks.
+
+Build machine requirements:
+
+- GNU make 4.0+
+- gcc 6.2+
+- binutils 2.25+
+- gawk 3.1.2+
+- bison 2.7+
+- sed 3.02+
+- python 3.4+
diff --git a/glibc/finalize.sh b/glibc/finalize.sh
new file mode 100755
index 0000000..6cdb23b
--- /dev/null
+++ b/glibc/finalize.sh
@@ -0,0 +1,31 @@
+#!/bin/sh -e
+
+WD=`realpath \`dirname "$0"\``
+cd "$WD"
+
+what="$1"
+
+triplet=`cat targets/$what/triplet`
+version=`grep ^GCC_VER < ../config | awk '{print $3;}'`
+name="${triplet}_${what}"
+O="$WD/out/cross/$name"
+WO="$WD/out/cross/${what}.tmp"
+buildstrip="strip -R .note -R .comment"
+targetstrip="$WO/bin/${triplet}-strip -R .note -R .comment"
+
+for i in "$WO/bin/"* "$WO/libexec/gcc/$triplet/$version/install-tools/fixincl" "$WO/libexec/gcc/$triplet/$version/plugin/"* ; do
+ $buildstrip "$i" || true
+done
+for i in `ls -1 "$WO/libexec/gcc/$triplet/$version" | grep -vF -e install-tools -e plugin | grep -v '\.a$' | grep -v '\.la$'` ; do
+ $buildstrip "$WO/libexec/gcc/$triplet/$version/$i" || true
+done
+for i in "$WO/$triplet/lib/"*.[oa] "$WO/lib/gcc/$triplet/$version/"*.[oa] ; do
+ $targetstrip -x "$i" || true
+done
+for i in `ls -1 "$WO/$triplet/lib" | grep -F .so. | grep -v '\.py$'` ; do
+ $targetstrip "$WO/$triplet/lib/$i" || true
+done
+
+rm -rf "$WO/share/man" "$O" "${O}-${version}"
+mv "$WO" "${O}-${version}"
+ln -sf "${name}-${version}" "$O"
diff --git a/glibc/hashes/binutils-2.33.1.tar.xz.sha1 b/glibc/hashes/binutils-2.33.1.tar.xz.sha1
new file mode 100644
index 0000000..19e5b06
--- /dev/null
+++ b/glibc/hashes/binutils-2.33.1.tar.xz.sha1
@@ -0,0 +1 @@
+06598868f5fa8efc98427dcb790d42c664f1a1a4 binutils-2.33.1.tar.xz
diff --git a/glibc/hashes/binutils-2.34.tar.xz.sha1 b/glibc/hashes/binutils-2.34.tar.xz.sha1
new file mode 100644
index 0000000..b834311
--- /dev/null
+++ b/glibc/hashes/binutils-2.34.tar.xz.sha1
@@ -0,0 +1 @@
+78f7ba4c0775ae75f5b906dc9af03d70b39b0785 binutils-2.34.tar.xz
diff --git a/glibc/hashes/config.guess.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1 b/glibc/hashes/config.guess.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1
new file mode 100644
index 0000000..9c76104
--- /dev/null
+++ b/glibc/hashes/config.guess.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1
@@ -0,0 +1 @@
+8a64ff82240fdbcf7c1797e69346fef14fbd68ef config.guess
diff --git a/glibc/hashes/config.sub.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1 b/glibc/hashes/config.sub.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1
new file mode 100644
index 0000000..24147fc
--- /dev/null
+++ b/glibc/hashes/config.sub.1912ca50411bb77fb2c610ef55dd91e332663de9.sha1
@@ -0,0 +1 @@
+f5580971048b656a46d8b7548de9b4dadb8224bc config.sub
diff --git a/glibc/hashes/gcc-9.2.0.tar.xz.sha1 b/glibc/hashes/gcc-9.2.0.tar.xz.sha1
new file mode 100644
index 0000000..b404b36
--- /dev/null
+++ b/glibc/hashes/gcc-9.2.0.tar.xz.sha1
@@ -0,0 +1 @@
+306d27c3465fa36862c206738d06d65fff5c3645 gcc-9.2.0.tar.xz
diff --git a/glibc/hashes/gcc-9.3.0.tar.xz.sha1 b/glibc/hashes/gcc-9.3.0.tar.xz.sha1
new file mode 100644
index 0000000..5ed2ca6
--- /dev/null
+++ b/glibc/hashes/gcc-9.3.0.tar.xz.sha1
@@ -0,0 +1 @@
+b746688bf045a316fc92c3528138ad10d0822b6b gcc-9.3.0.tar.xz
diff --git a/glibc/hashes/gdb-8.3.1.tar.xz.sha1 b/glibc/hashes/gdb-8.3.1.tar.xz.sha1
new file mode 100644
index 0000000..62c28ef
--- /dev/null
+++ b/glibc/hashes/gdb-8.3.1.tar.xz.sha1
@@ -0,0 +1 @@
+d403ba208945bbf04f8130ea4853730cdf0c8fc7 gdb-8.3.1.tar.xz
diff --git a/glibc/hashes/glibc-2.30.tar.xz.sha1 b/glibc/hashes/glibc-2.30.tar.xz.sha1
new file mode 100644
index 0000000..991b85d
--- /dev/null
+++ b/glibc/hashes/glibc-2.30.tar.xz.sha1
@@ -0,0 +1 @@
+4df7e4dbb92b5ced729d972b32e3b8683db4a689 glibc-2.30.tar.xz
diff --git a/glibc/hashes/glibc-2.31.tar.xz.sha1 b/glibc/hashes/glibc-2.31.tar.xz.sha1
new file mode 100644
index 0000000..963b4d9
--- /dev/null
+++ b/glibc/hashes/glibc-2.31.tar.xz.sha1
@@ -0,0 +1 @@
+55619672e5e13996e264d408949eb4aaa26e7ec8 glibc-2.31.tar.xz
diff --git a/glibc/hashes/gmp-6.1.2.tar.xz.sha1 b/glibc/hashes/gmp-6.1.2.tar.xz.sha1
new file mode 100644
index 0000000..273570f
--- /dev/null
+++ b/glibc/hashes/gmp-6.1.2.tar.xz.sha1
@@ -0,0 +1 @@
+9dc6981197a7d92f339192eea974f5eca48fcffe gmp-6.1.2.tar.xz
diff --git a/glibc/hashes/isl-0.21.tar.xz.sha1 b/glibc/hashes/isl-0.21.tar.xz.sha1
new file mode 100644
index 0000000..7206f50
--- /dev/null
+++ b/glibc/hashes/isl-0.21.tar.xz.sha1
@@ -0,0 +1 @@
+175111adaa8f6bda81a99ba9e200255a3b8075e2 isl-0.21.tar.xz
diff --git a/glibc/hashes/linux-5.3.8.tar.xz.sha1 b/glibc/hashes/linux-5.3.8.tar.xz.sha1
new file mode 100644
index 0000000..6e072f8
--- /dev/null
+++ b/glibc/hashes/linux-5.3.8.tar.xz.sha1
@@ -0,0 +1 @@
+e34c3da2dae6895513c52915d772fadb891e5e94 linux-5.3.8.tar.xz
diff --git a/glibc/hashes/linux-5.3.9.tar.xz.sha1 b/glibc/hashes/linux-5.3.9.tar.xz.sha1
new file mode 100644
index 0000000..f17a812
--- /dev/null
+++ b/glibc/hashes/linux-5.3.9.tar.xz.sha1
@@ -0,0 +1 @@
+4e733c7be714d7c17a11e1cdcc831dd2a072018c linux-5.3.9.tar.xz
diff --git a/glibc/hashes/linux-5.4.11.tar.xz.sha1 b/glibc/hashes/linux-5.4.11.tar.xz.sha1
new file mode 100644
index 0000000..98aa769
--- /dev/null
+++ b/glibc/hashes/linux-5.4.11.tar.xz.sha1
@@ -0,0 +1 @@
+665a4b0ee94828395454fefa0e1438702ab3bece linux-5.4.11.tar.xz
diff --git a/glibc/hashes/linux-5.5.1.tar.xz.sha1 b/glibc/hashes/linux-5.5.1.tar.xz.sha1
new file mode 100644
index 0000000..59f922a
--- /dev/null
+++ b/glibc/hashes/linux-5.5.1.tar.xz.sha1
@@ -0,0 +1 @@
+04a78eff1a4eafdcc4d5493068ed5a7c313e93e4 linux-5.5.1.tar.xz
diff --git a/glibc/hashes/linux-5.5.10.tar.xz.sha1 b/glibc/hashes/linux-5.5.10.tar.xz.sha1
new file mode 100644
index 0000000..f1fd194
--- /dev/null
+++ b/glibc/hashes/linux-5.5.10.tar.xz.sha1
@@ -0,0 +1 @@
+e1bf356a4be4b52827487fb64ab1b26b5e5ace52 linux-5.5.10.tar.xz
diff --git a/glibc/hashes/linux-5.7.6.tar.xz.sha1 b/glibc/hashes/linux-5.7.6.tar.xz.sha1
new file mode 100644
index 0000000..fdff0b0
--- /dev/null
+++ b/glibc/hashes/linux-5.7.6.tar.xz.sha1
@@ -0,0 +1 @@
+c31e9338c077fc9eb1fac500c3c19290fd8d4cda linux-5.7.6.tar.xz
diff --git a/glibc/hashes/mpc-1.1.0.tar.gz.sha1 b/glibc/hashes/mpc-1.1.0.tar.gz.sha1
new file mode 100644
index 0000000..5937d52
--- /dev/null
+++ b/glibc/hashes/mpc-1.1.0.tar.gz.sha1
@@ -0,0 +1 @@
+b019d9e1d27ec5fb99497159d43a3164995de2d0 mpc-1.1.0.tar.gz
diff --git a/glibc/hashes/mpfr-4.0.2.tar.xz.sha1 b/glibc/hashes/mpfr-4.0.2.tar.xz.sha1
new file mode 100644
index 0000000..0801a08
--- /dev/null
+++ b/glibc/hashes/mpfr-4.0.2.tar.xz.sha1
@@ -0,0 +1 @@
+52c1f2a4c9a202f46cf3275a8d46b562aa584208 mpfr-4.0.2.tar.xz
diff --git a/glibc/hashes/musl-1.2.0.tar.gz.sha1 b/glibc/hashes/musl-1.2.0.tar.gz.sha1
new file mode 100644
index 0000000..abf90fb
--- /dev/null
+++ b/glibc/hashes/musl-1.2.0.tar.gz.sha1
@@ -0,0 +1 @@
+140038a5376ca3a4e69168ed6c3879d1477b20d1 musl-1.2.0.tar.gz
diff --git a/glibc/patches/gcc-9.2.0/cxx_for_build.patch b/glibc/patches/gcc-9.2.0/cxx_for_build.patch
new file mode 100644
index 0000000..270d10a
--- /dev/null
+++ b/glibc/patches/gcc-9.2.0/cxx_for_build.patch
@@ -0,0 +1,11 @@
+diff -rNU3 gcc-9.2.0.old/Makefile.in gcc-9.2.0/Makefile.in
+--- gcc-9.2.0.old/Makefile.in 2019-04-09 10:49:14.000000000 +0200
++++ gcc-9.2.0/Makefile.in 2019-11-04 11:45:20.003304394 +0100
+@@ -198,6 +198,7 @@
+ AR="$(AR)"; export AR; \
+ AS="$(AS)"; export AS; \
+ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
++ CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
+ DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
+ LD="$(LD)"; export LD; \
+ LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
diff --git a/glibc/patches/gcc-9.2.0/find_limits_h.patch b/glibc/patches/gcc-9.2.0/find_limits_h.patch
new file mode 100644
index 0000000..a37c105
--- /dev/null
+++ b/glibc/patches/gcc-9.2.0/find_limits_h.patch
@@ -0,0 +1,12 @@
+diff -rNU3 gcc-9.2.0.old/gcc/Makefile.in gcc-9.2.0/gcc/Makefile.in
+--- gcc-9.2.0.old/gcc/Makefile.in 2019-04-25 16:32:16.000000000 +0200
++++ gcc-9.2.0/gcc/Makefile.in 2019-11-06 11:27:47.090878255 +0100
+@@ -532,7 +532,7 @@
+ STMP_FIXINC = @STMP_FIXINC@
+
+ # Test to see whether <limits.h> exists in the system header files.
+-LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ]
++LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h -o -f $(BUILD_SYSTEM_HEADER_DIR)/$(MULTIARCH_DIRNAME)/limits.h ]
+
+ # Directory for prefix to system directories, for
+ # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
diff --git a/glibc/patches/gcc-9.2.0/libsanitizer_ipcperm_mode.patch b/glibc/patches/gcc-9.2.0/libsanitizer_ipcperm_mode.patch
new file mode 100644
index 0000000..69ed3c6
--- /dev/null
+++ b/glibc/patches/gcc-9.2.0/libsanitizer_ipcperm_mode.patch
@@ -0,0 +1,44 @@
+diff -rNU3 gcc-9.2.0.old/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- gcc-9.2.0.old/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-10-31 12:14:23.000000000 +0100
++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2020-02-03 15:14:36.095084796 +0100
+@@ -1156,8 +1156,7 @@
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff -rNU3 gcc-9.2.0.old/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+--- gcc-9.2.0.old/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2019-04-08 15:08:30.000000000 +0200
++++ gcc-9.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2020-02-03 15:12:44.373316536 +0100
+@@ -211,26 +211,13 @@
+ u64 __unused1;
+ u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+ unsigned mode;
+- unsigned short __pad1;
+-#else
+- unsigned short __pad1;
+- unsigned short mode;
+ unsigned short __pad2;
+-#endif
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+- unsigned int mode;
+- unsigned short __seq;
+- unsigned short __pad1;
+- unsigned long __unused1;
+- unsigned long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
++ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/glibc/patches/gcc-9.3.0/cxx_for_build.patch b/glibc/patches/gcc-9.3.0/cxx_for_build.patch
new file mode 100644
index 0000000..fe7fde8
--- /dev/null
+++ b/glibc/patches/gcc-9.3.0/cxx_for_build.patch
@@ -0,0 +1,11 @@
+diff -rNU3 gcc-9.3.0.old/Makefile.in gcc-9.3.0/Makefile.in
+--- gcc-9.3.0.old/Makefile.in 2019-04-09 10:49:14.000000000 +0200
++++ gcc-9.3.0/Makefile.in 2019-11-04 11:45:20.003304394 +0100
+@@ -198,6 +198,7 @@
+ AR="$(AR)"; export AR; \
+ AS="$(AS)"; export AS; \
+ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
++ CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
+ DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
+ LD="$(LD)"; export LD; \
+ LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
diff --git a/glibc/patches/gcc-9.3.0/find_limits_h.patch b/glibc/patches/gcc-9.3.0/find_limits_h.patch
new file mode 100644
index 0000000..23d7685
--- /dev/null
+++ b/glibc/patches/gcc-9.3.0/find_limits_h.patch
@@ -0,0 +1,12 @@
+diff -rNU3 gcc-9.3.0.old/gcc/Makefile.in gcc-9.3.0/gcc/Makefile.in
+--- gcc-9.3.0.old/gcc/Makefile.in 2019-04-25 16:32:16.000000000 +0200
++++ gcc-9.3.0/gcc/Makefile.in 2019-11-06 11:27:47.090878255 +0100
+@@ -532,7 +532,7 @@
+ STMP_FIXINC = @STMP_FIXINC@
+
+ # Test to see whether <limits.h> exists in the system header files.
+-LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ]
++LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h -o -f $(BUILD_SYSTEM_HEADER_DIR)/$(MULTIARCH_DIRNAME)/limits.h ]
+
+ # Directory for prefix to system directories, for
+ # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
diff --git a/glibc/patches/gdb-8.3.1/arm64.diff b/glibc/patches/gdb-8.3.1/arm64.diff
new file mode 100644
index 0000000..c8c9c29
--- /dev/null
+++ b/glibc/patches/gdb-8.3.1/arm64.diff
@@ -0,0 +1,40 @@
+The signal definitions of musl and gdb collide
+
+The kernel defines "struct sigcontext" in asm/sigcontext.h and musl libc
+defines it in signal.h which collides.
+Kernel 4.14 misses the definitions of struct user_sve_header so we still
+have to use the aarch64-sve-linux-sigcontext.h header file which also
+provides that and make sure aarch64-sve-linux-sigcontext.h does not
+provide the same headers as the kernel or musl.
+
+--- a/gdb/nat/aarch64-sve-linux-ptrace.h
++++ b/gdb/nat/aarch64-sve-linux-ptrace.h
+@@ -23,9 +23,9 @@
+ #include <signal.h>
+ #include <sys/utsname.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
+
+-#ifndef SVE_SIG_ZREGS_SIZE
++#ifndef SVE_PT_REGS_SVE
+ #include "aarch64-sve-linux-sigcontext.h"
+ #endif
+
+--- a/gdb/nat/aarch64-sve-linux-sigcontext.h
++++ b/gdb/nat/aarch64-sve-linux-sigcontext.h
+@@ -19,6 +19,7 @@
+ #ifndef AARCH64_SVE_LINUX_SIGCONTEXT_H
+ #define AARCH64_SVE_LINUX_SIGCONTEXT_H
+
++#ifndef SVE_MAGIC
+ #define SVE_MAGIC 0x53564501
+
+ struct sve_context {
+@@ -128,6 +129,7 @@ struct sve_context {
+ (SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
+
+ #define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
++#endif
+
+ /* SVE/FP/SIMD state (NT_ARM_SVE) */
+
diff --git a/glibc/patches/gdb-8.3.1/ppc-musl.diff b/glibc/patches/gdb-8.3.1/ppc-musl.diff
new file mode 100644
index 0000000..70cfa18
--- /dev/null
+++ b/glibc/patches/gdb-8.3.1/ppc-musl.diff
@@ -0,0 +1,93 @@
+--- a/gdb/nat/ppc-linux.h
++++ b/gdb/nat/ppc-linux.h
+@@ -18,7 +18,90 @@
+ #ifndef PPC_LINUX_H
+ #define PPC_LINUX_H 1
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ #include <asm/ptrace.h>
++#else // Musl
++// Do not include ptrace.h from Linux headers and since
++// Musl does not define PT_*, define them:
++
++#define PT_R0 0
++#define PT_R1 1
++#define PT_R2 2
++#define PT_R3 3
++#define PT_R4 4
++#define PT_R5 5
++#define PT_R6 6
++#define PT_R7 7
++#define PT_R8 8
++#define PT_R9 9
++#define PT_R10 10
++#define PT_R11 11
++#define PT_R12 12
++#define PT_R13 13
++#define PT_R14 14
++#define PT_R15 15
++#define PT_R16 16
++#define PT_R17 17
++#define PT_R18 18
++#define PT_R19 19
++#define PT_R20 20
++#define PT_R21 21
++#define PT_R22 22
++#define PT_R23 23
++#define PT_R24 24
++#define PT_R25 25
++#define PT_R26 26
++#define PT_R27 27
++#define PT_R28 28
++#define PT_R29 29
++#define PT_R30 30
++#define PT_R31 31
++
++#define PT_NIP 32
++#define PT_MSR 33
++#define PT_ORIG_R3 34
++#define PT_CTR 35
++#define PT_LNK 36
++#define PT_XER 37
++#define PT_CCR 38
++#ifndef __powerpc64__
++#define PT_MQ 39
++#else
++#define PT_SOFTE 39
++#endif
++#define PT_TRAP 40
++#define PT_DAR 41
++#define PT_DSISR 42
++#define PT_RESULT 43
++#define PT_DSCR 44
++#define PT_REGS_COUNT 44
++
++#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
++
++#ifndef __powerpc64__
++
++#define PT_FPR31 (PT_FPR0 + 2*31)
++#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
++
++#else /* __powerpc64__ */
++
++#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
++
++
++#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */
++#define PT_VSCR (PT_VR0 + 32*2 + 1)
++#define PT_VRSAVE (PT_VR0 + 33*2)
++
++
++/*
++ * Only store first 32 VSRs here. The second 32 VSRs in VR0-31
++ */
++#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */
++#define PT_VSR31 (PT_VSR0 + 2*31)
++#endif /* __powerpc64__ */
++
++#endif // Libc
++
+ #include <asm/cputable.h>
+
+ /* This sometimes isn't defined. */
diff --git a/glibc/patches/gdb-8.3.1/ppc-ptregs.diff b/glibc/patches/gdb-8.3.1/ppc-ptregs.diff
new file mode 100644
index 0000000..743bd2e
--- /dev/null
+++ b/glibc/patches/gdb-8.3.1/ppc-ptregs.diff
@@ -0,0 +1,10 @@
+--- a/gdb/gdbserver/linux-ppc-low.c
++++ b/gdb/gdbserver/linux-ppc-low.c
+@@ -21,7 +21,6 @@
+ #include "linux-low.h"
+
+ #include <elf.h>
+-#include <asm/ptrace.h>
+
+ #include "nat/ppc-linux.h"
+ #include "linux-ppc-tdesc.h"
diff --git a/glibc/patches/gdb-8.3.1/remove-extraneous-include.diff b/glibc/patches/gdb-8.3.1/remove-extraneous-include.diff
new file mode 100644
index 0000000..62ed130
--- /dev/null
+++ b/glibc/patches/gdb-8.3.1/remove-extraneous-include.diff
@@ -0,0 +1,12 @@
+--- gdb-8.1/gdb/nat/linux-osdata.c.old 2018-01-04 22:07:23.000000000 -0600
++++ gdb-8.1/gdb/nat/linux-osdata.c 2018-06-22 04:31:42.655497623 -0500
+@@ -23,7 +23,8 @@
+ #include <sys/types.h>
+ #include <sys/sysinfo.h>
+ #include <ctype.h>
+-#include <utmp.h>
++#include <limits.h>
++#define UT_NAMESIZE LOGIN_NAME_MAX
+ #include <time.h>
+ #include <unistd.h>
+ #include <pwd.h>
diff --git a/glibc/patches/gdb-8.3.1/s390x-use-elf-gdb_fpregset_t.diff b/glibc/patches/gdb-8.3.1/s390x-use-elf-gdb_fpregset_t.diff
new file mode 100644
index 0000000..b01582c
--- /dev/null
+++ b/glibc/patches/gdb-8.3.1/s390x-use-elf-gdb_fpregset_t.diff
@@ -0,0 +1,156 @@
+The s390 versions of fill_gregset / supply_gregset and fill_fpregset /
+supply_fpregset declare the data structure to be filled or supplied from
+as gregset_t and fpregset_t, respectively, instead of gdb_gregset_t and
+gdb_fpregset_t. This is incompatible with the declaration of these
+functions in gregset.h.
+gdb/ChangeLog:
+
+ * s390-linux-nat.c (supply_gregset, fill_gregset, fetch_regs)
+ (store_regs): Replace gregset_t by gdb_gregset_t.
+ (supply_fpregset, fill_fpregset, fetch_fpregs, store_fpregs):
+ Replace fpregset_t by gdb_fpregset_t.
+Credit to Andreas Arnez at IBM
+
+---
+ gdb/s390-linux-nat.c | 34 ++++++++++++++++++----------------
+ 1 file changed, 18 insertions(+), 16 deletions(-)
+
+diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
+index 55a3899..84c304f 100644
+--- a/gdb/s390-linux-nat.c
++++ b/gdb/s390-linux-nat.c
+@@ -100,7 +100,7 @@ static const struct regset s390_64_gregset =
+ make them look like 32-bit registers. */
+
+ void
+-supply_gregset (struct regcache *regcache, const gregset_t *regp)
++supply_gregset (struct regcache *regcache, const gdb_gregset_t *regp)
+ {
+ #ifdef __s390x__
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+@@ -111,7 +111,7 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
+ gdb_byte buf[4];
+
+ regcache_supply_regset (&s390_64_gregset, regcache, -1,
+- regp, sizeof (gregset_t));
++ regp, sizeof (gdb_gregset_t));
+ pswm = extract_unsigned_integer ((const gdb_byte *) regp
+ + S390_PSWM_OFFSET, 8, byte_order);
+ pswa = extract_unsigned_integer ((const gdb_byte *) regp
+@@ -126,7 +126,7 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
+ #endif
+
+ regcache_supply_regset (&s390_gregset, regcache, -1, regp,
+- sizeof (gregset_t));
++ sizeof (gdb_gregset_t));
+ }
+
+ /* Fill register REGNO (if it is a general-purpose register) in
+@@ -134,14 +134,15 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
+ do this for all registers. */
+
+ void
+-fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
++fill_gregset (const struct regcache *regcache, gdb_gregset_t *regp,
++ int regno)
+ {
+ #ifdef __s390x__
+ struct gdbarch *gdbarch = regcache->arch ();
+ if (gdbarch_ptr_bit (gdbarch) == 32)
+ {
+ regcache_collect_regset (&s390_64_gregset, regcache, regno,
+- regp, sizeof (gregset_t));
++ regp, sizeof (gdb_gregset_t));
+
+ if (regno == -1
+ || regno == S390_PSWM_REGNUM || regno == S390_PSWA_REGNUM)
+@@ -178,26 +179,27 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
+ #endif
+
+ regcache_collect_regset (&s390_gregset, regcache, regno, regp,
+- sizeof (gregset_t));
++ sizeof (gdb_gregset_t));
+ }
+
+ /* Fill GDB's register array with the floating-point register values
+ in *REGP. */
+ void
+-supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
++supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *regp)
+ {
+ regcache_supply_regset (&s390_fpregset, regcache, -1, regp,
+- sizeof (fpregset_t));
++ sizeof (gdb_fpregset_t));
+ }
+
+ /* Fill register REGNO (if it is a general-purpose register) in
+ *REGP with the value in GDB's register array. If REGNO is -1,
+ do this for all registers. */
+ void
+-fill_fpregset (const struct regcache *regcache, fpregset_t *regp, int regno)
++fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *regp,
++ int regno)
+ {
+ regcache_collect_regset (&s390_fpregset, regcache, regno, regp,
+- sizeof (fpregset_t));
++ sizeof (gdb_fpregset_t));
+ }
+
+ /* Find the TID for the current inferior thread to use with ptrace. */
+@@ -217,7 +219,7 @@ s390_inferior_tid (void)
+ static void
+ fetch_regs (struct regcache *regcache, int tid)
+ {
+- gregset_t regs;
++ gdb_gregset_t regs;
+ ptrace_area parea;
+
+ parea.len = sizeof (regs);
+@@ -226,7 +228,7 @@ fetch_regs (struct regcache *regcache, int tid)
+ if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
+ perror_with_name (_("Couldn't get registers"));
+
+- supply_gregset (regcache, (const gregset_t *) &regs);
++ supply_gregset (regcache, (const gdb_gregset_t *) &regs);
+ }
+
+ /* Store all valid general-purpose registers in GDB's register cache
+@@ -234,7 +236,7 @@ fetch_regs (struct regcache *regcache, int tid)
+ static void
+ store_regs (const struct regcache *regcache, int tid, int regnum)
+ {
+- gregset_t regs;
++ gdb_gregset_t regs;
+ ptrace_area parea;
+
+ parea.len = sizeof (regs);
+@@ -254,7 +256,7 @@ store_regs (const struct regcache *regcache, int tid, int regnum)
+ static void
+ fetch_fpregs (struct regcache *regcache, int tid)
+ {
+- fpregset_t fpregs;
++ gdb_fpregset_t fpregs;
+ ptrace_area parea;
+
+ parea.len = sizeof (fpregs);
+@@ -263,7 +265,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
+ if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
+ perror_with_name (_("Couldn't get floating point status"));
+
+- supply_fpregset (regcache, (const fpregset_t *) &fpregs);
++ supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregs);
+ }
+
+ /* Store all valid floating-point registers in GDB's register cache
+@@ -271,7 +273,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
+ static void
+ store_fpregs (const struct regcache *regcache, int tid, int regnum)
+ {
+- fpregset_t fpregs;
++ gdb_fpregset_t fpregs;
+ ptrace_area parea;
+
+ parea.len = sizeof (fpregs);
+--
+1.8.5.6
+
diff --git a/glibc/targets/genericv7a/options b/glibc/targets/genericv7a/options
new file mode 100644
index 0000000..bd7d438
--- /dev/null
+++ b/glibc/targets/genericv7a/options
@@ -0,0 +1 @@
+--with-arch=armv7-a --with-float=softfp --with-float-abi=softfp
diff --git a/glibc/targets/genericv7a/triplet b/glibc/targets/genericv7a/triplet
new file mode 100644
index 0000000..d34ec00
--- /dev/null
+++ b/glibc/targets/genericv7a/triplet
@@ -0,0 +1 @@
+arm-linux-gnueabi
diff --git a/glibc/targets/h3/options b/glibc/targets/h3/options
new file mode 100644
index 0000000..0421e0c
--- /dev/null
+++ b/glibc/targets/h3/options
@@ -0,0 +1 @@
+--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --with-float-abi=hard
diff --git a/glibc/targets/h3/triplet b/glibc/targets/h3/triplet
new file mode 100644
index 0000000..ccd9d5c
--- /dev/null
+++ b/glibc/targets/h3/triplet
@@ -0,0 +1 @@
+aarch64-linux-gnu
diff --git a/glibc/targets/i486/options b/glibc/targets/i486/options
new file mode 100644
index 0000000..0695cee
--- /dev/null
+++ b/glibc/targets/i486/options
@@ -0,0 +1 @@
+--with-arch=i486 --with-cpu=i486
diff --git a/glibc/targets/i486/triplet b/glibc/targets/i486/triplet
new file mode 100644
index 0000000..8ba0ba9
--- /dev/null
+++ b/glibc/targets/i486/triplet
@@ -0,0 +1 @@
+i486-linux-gnu
diff --git a/glibc/targets/i686/options b/glibc/targets/i686/options
new file mode 100644
index 0000000..fdca118
--- /dev/null
+++ b/glibc/targets/i686/options
@@ -0,0 +1 @@
+--with-arch=i686 --with-cpu=i686
diff --git a/glibc/targets/i686/triplet b/glibc/targets/i686/triplet
new file mode 100644
index 0000000..e9dc410
--- /dev/null
+++ b/glibc/targets/i686/triplet
@@ -0,0 +1 @@
+i686-linux-gnu
diff --git a/glibc/targets/kryo485/options b/glibc/targets/kryo485/options
new file mode 100644
index 0000000..4e54542
--- /dev/null
+++ b/glibc/targets/kryo485/options
@@ -0,0 +1 @@
+--with-cpu=cortex-a76.cortex-a55 --with-float-abi=hard
diff --git a/glibc/targets/kryo485/triplet b/glibc/targets/kryo485/triplet
new file mode 100644
index 0000000..ccd9d5c
--- /dev/null
+++ b/glibc/targets/kryo485/triplet
@@ -0,0 +1 @@
+aarch64-linux-gnu
diff --git a/glibc/targets/o3/options b/glibc/targets/o3/options
new file mode 100644
index 0000000..d9f44a4
--- /dev/null
+++ b/glibc/targets/o3/options
@@ -0,0 +1 @@
+--with-arch=armv7-a --with-tune=cortex-a5 --with-float=soft --with-float-abi=soft
diff --git a/glibc/targets/o3/triplet b/glibc/targets/o3/triplet
new file mode 100644
index 0000000..d34ec00
--- /dev/null
+++ b/glibc/targets/o3/triplet
@@ -0,0 +1 @@
+arm-linux-gnueabi
diff --git a/glibc/targets/p7/options b/glibc/targets/p7/options
new file mode 100644
index 0000000..304b2a7
--- /dev/null
+++ b/glibc/targets/p7/options
@@ -0,0 +1 @@
+--with-arch=armv7-a --with-tune=cortex-a9 --with-float=softfp --with-float-abi=softfp --with-fpu=neon
diff --git a/glibc/targets/p7/triplet b/glibc/targets/p7/triplet
new file mode 100644
index 0000000..d34ec00
--- /dev/null
+++ b/glibc/targets/p7/triplet
@@ -0,0 +1 @@
+arm-linux-gnueabi
diff --git a/glibc/targets/pc/options b/glibc/targets/pc/options
new file mode 100644
index 0000000..fdbaf40
--- /dev/null
+++ b/glibc/targets/pc/options
@@ -0,0 +1 @@
+--disable-bootstrap
diff --git a/glibc/targets/pc/triplet b/glibc/targets/pc/triplet
new file mode 100644
index 0000000..1842132
--- /dev/null
+++ b/glibc/targets/pc/triplet
@@ -0,0 +1 @@
+x86_64-linux-gnu
diff --git a/glibc/targets/pi3/options b/glibc/targets/pi3/options
new file mode 100644
index 0000000..85c4b6a
--- /dev/null
+++ b/glibc/targets/pi3/options
@@ -0,0 +1 @@
+--with-cpu=cortex-a53 --with-float-abi=hard
diff --git a/glibc/targets/pi3/triplet b/glibc/targets/pi3/triplet
new file mode 100644
index 0000000..ccd9d5c
--- /dev/null
+++ b/glibc/targets/pi3/triplet
@@ -0,0 +1 @@
+aarch64-linux-gnu