diff options
Diffstat (limited to 'toolchain')
31 files changed, 518 insertions, 51 deletions
diff --git a/toolchain/Config.in b/toolchain/Config.in index ecd9d200f1..0d03a2872b 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -211,14 +211,13 @@ comment "C Library" choice prompt "C Library implementation" if TOOLCHAINOPTS - default LIBC_USE_EGLIBC if (aarch64 || aarch64_be) - default LIBC_USE_UCLIBC + default LIBC_USE_GLIBC if (aarch64 || aarch64_be) help Select the C library implementation. - config LIBC_USE_EGLIBC - bool "Use eglibc" - select USE_EGLIBC + config LIBC_USE_GLIBC + bool "Use glibc" + select USE_GLIBC depends on !avr32 config LIBC_USE_UCLIBC @@ -233,7 +232,7 @@ choice endchoice -source "toolchain/eglibc/Config.in" +source "toolchain/glibc/Config.in" source "toolchain/uClibc/Config.in" source "toolchain/musl/Config.in" @@ -256,7 +255,7 @@ config INSIGHT help Enable if you want to build insight-gdb. -config USE_EGLIBC +config USE_GLIBC bool default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (aarch64 || aarch64_be || octeon) @@ -273,26 +272,26 @@ config USE_EXTERNAL_LIBC source "toolchain/gcc/Config.version" -source "toolchain/eglibc/Config.version" +source "toolchain/glibc/Config.version" source "toolchain/uClibc/Config.version" source "toolchain/musl/Config.version" config LIBC string - default "eglibc" if USE_EGLIBC + default "glibc" if USE_GLIBC default "uClibc" if USE_UCLIBC default "musl" if USE_MUSL config LIBC_VERSION string - default EGLIBC_VERSION if USE_EGLIBC + default GLIBC_VERSION if USE_GLIBC default UCLIBC_VERSION if USE_UCLIBC default MUSL_VERSION if USE_MUSL config TARGET_SUFFIX string - default "gnueabi" if USE_EGLIBC && (arm || armeb) - default "gnu" if USE_EGLIBC && !(arm || armeb) + default "gnueabi" if USE_GLIBC && (arm || armeb) + default "gnu" if USE_GLIBC && !(arm || armeb) default "uclibcgnueabi" if USE_UCLIBC && (arm || armeb) default "uclibc" if USE_UCLIBC && !(arm || armeb) default "muslgnueabi" if USE_MUSL && (arm || armeb) diff --git a/toolchain/eglibc/Config.in b/toolchain/eglibc/Config.in deleted file mode 100644 index da71bd9ebe..0000000000 --- a/toolchain/eglibc/Config.in +++ /dev/null @@ -1,22 +0,0 @@ -choice - prompt "eglibc version" - depends on TOOLCHAINOPTS && USE_EGLIBC - default EGLIBC_USE_VERSION_2_19 - help - Select the version of eglibc you wish to use. - - config EGLIBC_USE_VERSION_2_15 - bool "eglibc 2.15" - select EGLIBC_VERSION_2_15 - depends on BROKEN - - config EGLIBC_USE_VERSION_2_19 - bool "eglibc 2.19" - select EGLIBC_VERSION_2_19 - -endchoice - -menu "eglibc configuration" - depends on TOOLCHAINOPTS && USE_EGLIBC - source toolchain/eglibc/config/Config.in -endmenu diff --git a/toolchain/glibc/Config.in b/toolchain/glibc/Config.in new file mode 100644 index 0000000000..72d306e7a4 --- /dev/null +++ b/toolchain/glibc/Config.in @@ -0,0 +1,26 @@ +choice + prompt "(e)glibc version" + depends on TOOLCHAINOPTS && USE_GLIBC + default EGLIBC_USE_VERSION_2_19 + help + Select the version of glibc you wish to use. + + config EGLIBC_USE_VERSION_2_15 + bool "eglibc 2.15" + select EGLIBC_VERSION_2_15 + depends on BROKEN + + config EGLIBC_USE_VERSION_2_19 + bool "eglibc 2.19" + select EGLIBC_VERSION_2_19 + + config GLIBC_USE_VERSION_2_21 + bool "glibc 2.21" + select GLIBC_VERSION_2_21 + +endchoice + +menu "eglibc configuration" + depends on TOOLCHAINOPTS && USE_GLIBC && (EGLIBC_USE_VERSION_2_15 || EGLIBC_USE_VERSION_2_19) + source toolchain/glibc/config/Config.in +endmenu diff --git a/toolchain/eglibc/Config.version b/toolchain/glibc/Config.version index 3c0f0efe3c..b4b2fcb4d2 100644 --- a/toolchain/eglibc/Config.version +++ b/toolchain/glibc/Config.version @@ -1,9 +1,10 @@ -if USE_EGLIBC +if USE_GLIBC -config EGLIBC_VERSION +config GLIBC_VERSION string default "2.15" if EGLIBC_VERSION_2_15 default "2.19" if EGLIBC_VERSION_2_19 + default "2.21" if GLIBC_VERSION_2_21 config EGLIBC_VERSION_2_15 bool @@ -12,15 +13,15 @@ config EGLIBC_VERSION_2_19 default y if !TOOLCHAINOPTS bool -config EGLIBC_REVISION +config GLIBC_VERSION_2_21 + default y if !TOOLCHAINOPTS + bool + +config GLIBC_REVISION string default "18909" if EGLIBC_VERSION_2_15 default "25243" if EGLIBC_VERSION_2_19 + default "4e42b5b8f8" if GLIBC_VERSION_2_21 default "" endif - -menu "eglibc configuration" - depends on !TOOLCHAINOPTS && USE_EGLIBC - source toolchain/eglibc/config/Config.in -endmenu diff --git a/toolchain/eglibc/Makefile b/toolchain/glibc/Makefile index f880db81ed..f880db81ed 100644 --- a/toolchain/eglibc/Makefile +++ b/toolchain/glibc/Makefile diff --git a/toolchain/eglibc/common.mk b/toolchain/glibc/common.mk index 9ef92c6667..e985de61b9 100644 --- a/toolchain/eglibc/common.mk +++ b/toolchain/glibc/common.mk @@ -6,19 +6,27 @@ # include $(TOPDIR)/rules.mk -PKG_NAME:=eglibc -PKG_VERSION:=$(call qstrip,$(CONFIG_EGLIBC_VERSION)) -PKG_REVISION:=$(call qstrip,$(CONFIG_EGLIBC_REVISION)) +PKG_NAME:=glibc +PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION)) +PKG_REVISION:=$(call qstrip,$(CONFIG_GLIBC_REVISION)) -PKG_SOURCE_PROTO:=svn +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git PKG_SOURCE_VERSION:=$(PKG_REVISION) PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2 +GLIBC_PATH:= ifneq ($(CONFIG_EGLIBC_VERSION_2_15),) + GLIBC_PATH:=libc/ + PKG_SOURCE_PROTO:=svn + PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_15 endif ifneq ($(CONFIG_EGLIBC_VERSION_2_19),) + GLIBC_PATH:=libc/ + PKG_SOURCE_PROTO:=svn + PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_19 endif @@ -32,7 +40,7 @@ include $(INCLUDE_DIR)/toolchain-build.mk HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built -HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.eglibc_$(VARIANT)_installed +HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed ifeq ($(ARCH),mips64) ifdef CONFIG_MIPS64_ABI_N64 @@ -46,18 +54,19 @@ ifeq ($(ARCH),mips64) endif endif -EGLIBC_CONFIGURE:= \ +GLIBC_CONFIGURE:= \ BUILD_CC="$(HOSTCC)" \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ libc_cv_slibdir="/lib" \ use_ldconfig=no \ - $(HOST_BUILD_DIR)/libc/configure \ + $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \ --prefix= \ --build=$(GNU_HOST_NAME) \ --host=$(REAL_GNU_TARGET_NAME) \ --with-headers=$(TOOLCHAIN_DIR)/include \ --disable-profile \ + --disable-werror \ --without-gd \ --without-cvs \ --enable-add-ons \ @@ -69,31 +78,37 @@ export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include define Host/SetToolchainInfo $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk +ifneq ($(CONFIG_GLIBC_VERSION_2_21),) + $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk +else $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk +endif $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk endef define Host/Configure [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \ - cd $(HOST_BUILD_DIR)/libc; \ + cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \ autoconf --force && \ touch $(HOST_BUILD_DIR)/.autoconf; \ } mkdir -p $(CUR_BUILD_DIR) grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config ( cd $(CUR_BUILD_DIR); rm -f config.cache; \ - $(EGLIBC_CONFIGURE) \ + $(GLIBC_CONFIGURE) \ ); endef define Host/Prepare $(call Host/Prepare/Default) ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) +ifeq ($(CONFIG_GLIBC_VERSION_2_21),) $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults ifneq ($(CONFIG_EGLIBC_VERSION_2_15),) ln -sf ../ports $(HOST_BUILD_DIR)/libc/ endif +endif endef define Host/Clean diff --git a/toolchain/eglibc/config/Config.in b/toolchain/glibc/config/Config.in index 6f022234a6..6f022234a6 100644 --- a/toolchain/eglibc/config/Config.in +++ b/toolchain/glibc/config/Config.in diff --git a/toolchain/eglibc/headers/Makefile b/toolchain/glibc/headers/Makefile index f9f411b1f0..f9f411b1f0 100644 --- a/toolchain/eglibc/headers/Makefile +++ b/toolchain/glibc/headers/Makefile diff --git a/toolchain/eglibc/include/libintl.h b/toolchain/glibc/include/libintl.h index 69cb887a26..69cb887a26 100644 --- a/toolchain/eglibc/include/libintl.h +++ b/toolchain/glibc/include/libintl.h diff --git a/toolchain/eglibc/patches/2.15/001-fix_autoconf_macro.patch b/toolchain/glibc/patches/2.15/001-fix_autoconf_macro.patch index 55b26c7dad..55b26c7dad 100644 --- a/toolchain/eglibc/patches/2.15/001-fix_autoconf_macro.patch +++ b/toolchain/glibc/patches/2.15/001-fix_autoconf_macro.patch diff --git a/toolchain/eglibc/patches/2.15/005-versions.patch b/toolchain/glibc/patches/2.15/005-versions.patch index da9d2bacb5..da9d2bacb5 100644 --- a/toolchain/eglibc/patches/2.15/005-versions.patch +++ b/toolchain/glibc/patches/2.15/005-versions.patch diff --git a/toolchain/eglibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch b/toolchain/glibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch index d1e19aa448..d1e19aa448 100644 --- a/toolchain/eglibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch +++ b/toolchain/glibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch diff --git a/toolchain/eglibc/patches/2.15/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.15/100-fix_cross_rpcgen.patch index 8fe5cf3f7c..8fe5cf3f7c 100644 --- a/toolchain/eglibc/patches/2.15/100-fix_cross_rpcgen.patch +++ b/toolchain/glibc/patches/2.15/100-fix_cross_rpcgen.patch diff --git a/toolchain/eglibc/patches/2.15/110-fix_cross_zic.patch b/toolchain/glibc/patches/2.15/110-fix_cross_zic.patch index 221eb28709..221eb28709 100644 --- a/toolchain/eglibc/patches/2.15/110-fix_cross_zic.patch +++ b/toolchain/glibc/patches/2.15/110-fix_cross_zic.patch diff --git a/toolchain/eglibc/patches/2.15/120-use_host_cflags.patch b/toolchain/glibc/patches/2.15/120-use_host_cflags.patch index 4c58fb4fb4..4c58fb4fb4 100644 --- a/toolchain/eglibc/patches/2.15/120-use_host_cflags.patch +++ b/toolchain/glibc/patches/2.15/120-use_host_cflags.patch diff --git a/toolchain/eglibc/patches/2.15/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.15/200-add-dl-search-paths.patch index 70e7e604de..70e7e604de 100644 --- a/toolchain/eglibc/patches/2.15/200-add-dl-search-paths.patch +++ b/toolchain/glibc/patches/2.15/200-add-dl-search-paths.patch diff --git a/toolchain/eglibc/patches/2.19/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.19/100-fix_cross_rpcgen.patch index 5c0d45b530..5c0d45b530 100644 --- a/toolchain/eglibc/patches/2.19/100-fix_cross_rpcgen.patch +++ b/toolchain/glibc/patches/2.19/100-fix_cross_rpcgen.patch diff --git a/toolchain/eglibc/patches/2.19/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.19/200-add-dl-search-paths.patch index fa192ca1cd..fa192ca1cd 100644 --- a/toolchain/eglibc/patches/2.19/200-add-dl-search-paths.patch +++ b/toolchain/glibc/patches/2.19/200-add-dl-search-paths.patch diff --git a/toolchain/eglibc/patches/2.19/300-require-autoconf-2.69.patch b/toolchain/glibc/patches/2.19/300-require-autoconf-2.69.patch index 623885ca8f..623885ca8f 100644 --- a/toolchain/eglibc/patches/2.19/300-require-autoconf-2.69.patch +++ b/toolchain/glibc/patches/2.19/300-require-autoconf-2.69.patch diff --git a/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch new file mode 100644 index 0000000000..6a5e537b77 --- /dev/null +++ b/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch @@ -0,0 +1,52 @@ +--- a/sunrpc/rpc/types.h ++++ b/sunrpc/rpc/types.h +@@ -75,18 +75,23 @@ typedef unsigned long rpcport_t; + #endif + + #ifndef __u_char_defined +-typedef __u_char u_char; +-typedef __u_short u_short; +-typedef __u_int u_int; +-typedef __u_long u_long; +-typedef __quad_t quad_t; +-typedef __u_quad_t u_quad_t; +-typedef __fsid_t fsid_t; ++typedef unsigned char u_char; ++typedef unsigned short u_short; ++typedef unsigned int u_int; ++typedef unsigned long u_long; ++#if __WORDSIZE == 64 ++typedef long int quad_t; ++typedef unsigned long int u_quad_t; ++#elif defined __GLIBC_HAVE_LONG_LONG ++typedef long long int quad_t; ++typedef unsigned long long int u_quad_t; ++#endif ++typedef u_quad_t fsid_t; + # define __u_char_defined + #endif +-#ifndef __daddr_t_defined +-typedef __daddr_t daddr_t; +-typedef __caddr_t caddr_t; ++#if !defined(__daddr_t_defined) && defined(linux) ++typedef long int daddr_t; ++typedef char *caddr_t; + # define __daddr_t_defined + #endif + +--- a/sunrpc/rpc_main.c ++++ b/sunrpc/rpc_main.c +@@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd) + abort (); + temp = rindex (cmd->infile, '.'); + cp = stpcpy (mkfilename, "Makefile."); +- if (temp != NULL) +- *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0'; +- else ++ if (temp != NULL) { ++ strncpy(cp, cmd->infile, temp - cmd->infile); ++ cp[temp - cmd->infile - 1] = 0; ++ } else + stpcpy (cp, cmd->infile); + + } diff --git a/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch new file mode 100644 index 0000000000..a6200f783b --- /dev/null +++ b/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch @@ -0,0 +1,14 @@ +add /usr/lib to default search path for the dynamic linker + +--- a/Makeconfig ++++ b/Makeconfig +@@ -501,6 +501,9 @@ else + default-rpath = $(libdir) + endif + ++# Add /usr/lib to default search path for the dynamic linker ++user-defined-trusted-dirs := /usr/lib ++ + ifndef link-extra-libs + link-extra-libs = $(LDLIBS-$(@F)) + link-extra-libs-static = $(link-extra-libs) diff --git a/toolchain/patches/2.15/001-fix_autoconf_macro.patch b/toolchain/patches/2.15/001-fix_autoconf_macro.patch new file mode 100644 index 0000000000..55b26c7dad --- /dev/null +++ b/toolchain/patches/2.15/001-fix_autoconf_macro.patch @@ -0,0 +1,48 @@ +--- a/libc/aclocal.m4 ++++ b/libc/aclocal.m4 +@@ -88,6 +88,12 @@ + fi + rm -fr contest*]) + ++dnl Test a compiler option or options with an empty input file. ++dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false]) ++AC_DEFUN([LIBC_TRY_CC_OPTION], ++[AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])], ++ [$2], [$3])]) ++ + AC_DEFUN([LIBC_PROG_BINUTILS], + [# Was a --with-binutils option given? + if test -n "$path_binutils"; then +--- a/libc/configure ++++ b/libc/configure +@@ -7404,7 +7404,14 @@ + else + libc_cv_cc_nofma= + for opt in -ffp-contract=off -mno-fused-madd; do +- LIBC_TRY_CC_OPTION($opt, libc_cv_cc_nofma=$opt; break) ++ if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null' ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; }; then : ++ libc_cv_cc_nofma=$opt; break ++fi + done + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_nofma" >&5 +--- a/libc/configure.in ++++ b/libc/configure.in +@@ -2238,10 +2238,9 @@ + libc_cv_cc_submachine, [dnl + libc_cv_cc_submachine=no + for opt in "-march=$submachine" "-mcpu=$submachine"; do +- if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then ++ LIBC_TRY_CC_OPTION([$opt], [ + libc_cv_cc_submachine="$opt" +- break +- fi ++ break], []) + done]) + if test "x$libc_cv_cc_submachine" = xno; then + AC_MSG_ERROR([${CC-cc} does not support $submachine]) diff --git a/toolchain/patches/2.15/005-versions.patch b/toolchain/patches/2.15/005-versions.patch new file mode 100644 index 0000000000..da9d2bacb5 --- /dev/null +++ b/toolchain/patches/2.15/005-versions.patch @@ -0,0 +1,11 @@ +--- a/libc/configure.in ++++ b/libc/configure.in +@@ -1037,7 +1037,7 @@ + critic_missing="$critic_missing gcc") + AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version, + [GNU Make[^0-9]*\([0-9][0-9.]*\)], +- [3.79* | 3.[89]*], critic_missing="$critic_missing make") ++ [3.79* | 3.[89]* | 4.* ], critic_missing="$critic_missing make") + + AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version, + [GNU gettext.* \([0-9]*\.[0-9.]*\)], diff --git a/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch b/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch new file mode 100644 index 0000000000..d1e19aa448 --- /dev/null +++ b/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch @@ -0,0 +1,110 @@ +partially revert commit 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 - caused segmentation faults in dlopen + +References: +http://comments.gmane.org/gmane.comp.lib.glibc.user/1227 +http://sourceware.org/ml/libc-alpha/2011-06/msg00006.html + +diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c +index 4b17bf8..733cc1b 100644 +--- a/libc/elf/dl-close.c ++++ b/libc/elf/dl-close.c +@@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map) + if (map->l_direct_opencount > 0 || map->l_type != lt_loaded + || dl_close_state != not_pending) + { +- if (map->l_direct_opencount == 0) +- { +- if (map->l_type == lt_loaded) +- dl_close_state = rerun; +- else if (map->l_type == lt_library) +- { +- struct link_map **oldp = map->l_initfini; +- map->l_initfini = map->l_orig_initfini; +- _dl_scope_free (oldp); +- } +- } ++ if (map->l_direct_opencount == 0 && map->l_type == lt_loaded) ++ dl_close_state = rerun; + + /* There are still references to this object. Do nothing more. */ + if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)) +diff --git a/libc/elf/dl-deps.c b/libc/elf/dl-deps.c +index 51cb2fa..eddcbf0 100644 +--- a/libc/elf/dl-deps.c ++++ b/libc/elf/dl-deps.c +@@ -489,6 +489,7 @@ _dl_map_object_deps (struct link_map *map, + nneeded * sizeof needed[0]); + atomic_write_barrier (); + l->l_initfini = l_initfini; ++ l->l_free_initfini = 1; + } + + /* If we have no auxiliary objects just go on to the next map. */ +@@ -689,6 +690,7 @@ Filters not supported with LD_TRACE_PRELINKING")); + l_initfini[nlist] = NULL; + atomic_write_barrier (); + map->l_initfini = l_initfini; ++ map->l_free_initfini = 1; + if (l_reldeps != NULL) + { + atomic_write_barrier (); +@@ -697,7 +699,7 @@ Filters not supported with LD_TRACE_PRELINKING")); + _dl_scope_free (old_l_reldeps); + } + if (old_l_initfini != NULL) +- map->l_orig_initfini = old_l_initfini; ++ _dl_scope_free (old_l_initfini); + + if (errno_reason) + _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname, +diff --git a/libc/elf/dl-libc.c b/libc/elf/dl-libc.c +index f44fa10..7563093 100644 +--- a/libc/elf/dl-libc.c ++++ b/libc/elf/dl-libc.c +@@ -284,6 +284,10 @@ libc_freeres_fn (free_mem) + if (! old->dont_free) + free (old); + } ++ ++ /* Free the initfini dependency list. */ ++ if (l->l_free_initfini) ++ free (l->l_initfini); + } + + if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0 +diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c +index b93a01f..2fc83ce 100644 +--- a/libc/elf/rtld.c ++++ b/libc/elf/rtld.c +@@ -2277,6 +2277,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + lnp->dont_free = 1; + lnp = lnp->next; + } ++ l->l_free_initfini = 0; + + if (l != &GL(dl_rtld_map)) + _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0, +diff --git a/libc/include/link.h b/libc/include/link.h +index e877104..b1b4065 100644 +--- a/libc/include/link.h ++++ b/libc/include/link.h +@@ -192,6 +192,9 @@ struct link_map + during LD_TRACE_PRELINKING=1 + contains any DT_SYMBOLIC + libraries. */ ++ unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be ++ freed, ie. not allocated with ++ the dummy malloc in ld.so. */ + + /* Collected information about own RPATH directories. */ + struct r_search_path_struct l_rpath_dirs; +@@ -240,9 +243,6 @@ struct link_map + + /* List of object in order of the init and fini calls. */ + struct link_map **l_initfini; +- /* The init and fini list generated at startup, saved when the +- object is also loaded dynamically. */ +- struct link_map **l_orig_initfini; + + /* List of the dependencies introduced through symbol binding. */ + struct link_map_reldeps diff --git a/toolchain/patches/2.15/100-fix_cross_rpcgen.patch b/toolchain/patches/2.15/100-fix_cross_rpcgen.patch new file mode 100644 index 0000000000..8fe5cf3f7c --- /dev/null +++ b/toolchain/patches/2.15/100-fix_cross_rpcgen.patch @@ -0,0 +1,71 @@ +--- a/libc/sunrpc/proto.h ++++ b/libc/sunrpc/proto.h +@@ -56,12 +56,14 @@ void add_type(int len, const char *type) + $build's C library and $host's GLIBC. */ + #ifdef _CROSS_RPCGEN_ + ++#undef stpcpy ++ + /* Rather then defining _GNU_SOURCE before including $build's <string.h> + we just declare stpcpy here. */ + extern char *stpcpy (char *, const char *); + +-/* Use $build's i18n support as we can't use $host's. */ +-#define _(X) (gettext (X)) ++/* Do not use i18n support */ ++#define _(X) (X) + + /* rpcgen sources check for __GNU_LIBRARY__ to tweak for GLIBC code + that rpcgen generates. The proper fix would be to rename all those checks +--- a/libc/sunrpc/rpc/types.h ++++ b/libc/sunrpc/rpc/types.h +@@ -70,18 +70,23 @@ typedef unsigned long rpcport_t; + #endif + + #ifndef __u_char_defined +-typedef __u_char u_char; +-typedef __u_short u_short; +-typedef __u_int u_int; +-typedef __u_long u_long; +-typedef __quad_t quad_t; +-typedef __u_quad_t u_quad_t; +-typedef __fsid_t fsid_t; ++typedef unsigned char u_char; ++typedef unsigned short u_short; ++typedef unsigned int u_int; ++typedef unsigned long u_long; ++#if __WORDSIZE == 64 ++typedef long int quad_t; ++typedef unsigned long int u_quad_t; ++#elif defined __GLIBC_HAVE_LONG_LONG ++typedef long long int quad_t; ++typedef unsigned long long int u_quad_t; ++#endif ++typedef u_quad_t fsid_t; + # define __u_char_defined + #endif +-#ifndef __daddr_t_defined +-typedef __daddr_t daddr_t; +-typedef __caddr_t caddr_t; ++#if !defined(__daddr_t_defined) && defined(linux) ++typedef long int daddr_t; ++typedef char *caddr_t; + # define __daddr_t_defined + #endif + +--- a/libc/sunrpc/rpc_main.c ++++ b/libc/sunrpc/rpc_main.c +@@ -997,9 +997,10 @@ mkfile_output (struct commandline *cmd) + abort (); + temp = rindex (cmd->infile, '.'); + cp = stpcpy (mkfilename, "Makefile."); +- if (temp != NULL) +- *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0'; +- else ++ if (temp != NULL) { ++ strncpy(cp, cmd->infile, temp - cmd->infile); ++ cp[temp - cmd->infile - 1] = 0; ++ } else + stpcpy (cp, cmd->infile); + + } diff --git a/toolchain/patches/2.15/110-fix_cross_zic.patch b/toolchain/patches/2.15/110-fix_cross_zic.patch new file mode 100644 index 0000000000..221eb28709 --- /dev/null +++ b/toolchain/patches/2.15/110-fix_cross_zic.patch @@ -0,0 +1,27 @@ +--- a/libc/timezone/zic.c ++++ b/libc/timezone/zic.c +@@ -8,6 +8,8 @@ static char elsieid[] = "@(#)zic.c 8.19" + #ifdef CROSS_ZIC + #define REPORT_BUGS_TO "" + #define PKGVERSION "" ++#undef _ ++#define _(X) (X) + #else + #include "config.h" + #endif +@@ -490,6 +492,7 @@ char * argv[]; + #ifdef unix + (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); + #endif /* defined unix */ ++#ifndef CROSS_ZIC + #if HAVE_GETTEXT + (void) setlocale(LC_ALL, ""); + #ifdef TZ_DOMAINDIR +@@ -497,6 +500,7 @@ char * argv[]; + #endif /* defined TEXTDOMAINDIR */ + (void) textdomain(TZ_DOMAIN); + #endif /* HAVE_GETTEXT */ ++#endif + progname = argv[0]; + if (TYPE_BIT(zic_t) < 64) { + (void) fprintf(stderr, "%s: %s\n", progname, diff --git a/toolchain/patches/2.15/120-use_host_cflags.patch b/toolchain/patches/2.15/120-use_host_cflags.patch new file mode 100644 index 0000000000..4c58fb4fb4 --- /dev/null +++ b/toolchain/patches/2.15/120-use_host_cflags.patch @@ -0,0 +1,22 @@ +--- a/libc/sunrpc/Makefile ++++ b/libc/sunrpc/Makefile +@@ -175,7 +175,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$ + $(+link) + + $(addprefix $(objpfx)cross-,$(rpcgen-objs)): $(objpfx)cross-%.o: %.c +- gcc $< -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ \ ++ gcc $< -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ $(HOST_CFLAGS) \ + $(OUTPUT_OPTION) $(compile-mkdep-flags) + + $(objpfx)cross-rpcgen: $(addprefix $(objpfx)cross-,$(rpcgen-objs)) +--- a/libc/timezone/Makefile ++++ b/libc/timezone/Makefile +@@ -182,7 +182,7 @@ $(objpfx)zic: $(addprefix $(objpfx), $(z + + $(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c + gcc $< -c $(OUTPUT_OPTION) $(CFLAGS-$*.c) $(CPPFLAGS-$*) \ +- -DCROSS_ZIC $(compile-mkdep-flags) ++ -DCROSS_ZIC $(HOST_CFLAGS) $(compile-mkdep-flags) + + $(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs)) + gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@ diff --git a/toolchain/patches/2.15/200-add-dl-search-paths.patch b/toolchain/patches/2.15/200-add-dl-search-paths.patch new file mode 100644 index 0000000000..70e7e604de --- /dev/null +++ b/toolchain/patches/2.15/200-add-dl-search-paths.patch @@ -0,0 +1,14 @@ +add /usr/lib to default search path for the dynamic linker + +--- a/libc/Makeconfig ++++ b/libc/Makeconfig +@@ -539,6 +539,9 @@ + default-rpath = $(libdir) + endif + ++# Add /usr/lib to default search path for the dynamic linker ++user-defined-trusted-dirs := /usr/lib ++ + ifndef link-extra-libs + link-extra-libs = $(LDLIBS-$(@F)) + link-extra-libs-static = $(link-extra-libs) diff --git a/toolchain/patches/2.19/100-fix_cross_rpcgen.patch b/toolchain/patches/2.19/100-fix_cross_rpcgen.patch new file mode 100644 index 0000000000..5c0d45b530 --- /dev/null +++ b/toolchain/patches/2.19/100-fix_cross_rpcgen.patch @@ -0,0 +1,52 @@ +--- a/libc/sunrpc/rpc/types.h ++++ b/libc/sunrpc/rpc/types.h +@@ -75,18 +75,23 @@ typedef unsigned long rpcport_t; + #endif + + #ifndef __u_char_defined +-typedef __u_char u_char; +-typedef __u_short u_short; +-typedef __u_int u_int; +-typedef __u_long u_long; +-typedef __quad_t quad_t; +-typedef __u_quad_t u_quad_t; +-typedef __fsid_t fsid_t; ++typedef unsigned char u_char; ++typedef unsigned short u_short; ++typedef unsigned int u_int; ++typedef unsigned long u_long; ++#if __WORDSIZE == 64 ++typedef long int quad_t; ++typedef unsigned long int u_quad_t; ++#elif defined __GLIBC_HAVE_LONG_LONG ++typedef long long int quad_t; ++typedef unsigned long long int u_quad_t; ++#endif ++typedef u_quad_t fsid_t; + # define __u_char_defined + #endif +-#ifndef __daddr_t_defined +-typedef __daddr_t daddr_t; +-typedef __caddr_t caddr_t; ++#if !defined(__daddr_t_defined) && defined(linux) ++typedef long int daddr_t; ++typedef char *caddr_t; + # define __daddr_t_defined + #endif + +--- a/libc/sunrpc/rpc_main.c ++++ b/libc/sunrpc/rpc_main.c +@@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd) + abort (); + temp = rindex (cmd->infile, '.'); + cp = stpcpy (mkfilename, "Makefile."); +- if (temp != NULL) +- *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0'; +- else ++ if (temp != NULL) { ++ strncpy(cp, cmd->infile, temp - cmd->infile); ++ cp[temp - cmd->infile - 1] = 0; ++ } else + stpcpy (cp, cmd->infile); + + } diff --git a/toolchain/patches/2.19/200-add-dl-search-paths.patch b/toolchain/patches/2.19/200-add-dl-search-paths.patch new file mode 100644 index 0000000000..fa192ca1cd --- /dev/null +++ b/toolchain/patches/2.19/200-add-dl-search-paths.patch @@ -0,0 +1,14 @@ +add /usr/lib to default search path for the dynamic linker + +--- a/libc/Makeconfig ++++ b/libc/Makeconfig +@@ -501,6 +501,9 @@ else + default-rpath = $(libdir) + endif + ++# Add /usr/lib to default search path for the dynamic linker ++user-defined-trusted-dirs := /usr/lib ++ + ifndef link-extra-libs + link-extra-libs = $(LDLIBS-$(@F)) + link-extra-libs-static = $(link-extra-libs) diff --git a/toolchain/patches/2.19/300-require-autoconf-2.69.patch b/toolchain/patches/2.19/300-require-autoconf-2.69.patch new file mode 100644 index 0000000000..623885ca8f --- /dev/null +++ b/toolchain/patches/2.19/300-require-autoconf-2.69.patch @@ -0,0 +1,13 @@ +Index: eglibc-2.19-r25243/libc/aclocal.m4 +=================================================================== +--- eglibc-2.19-r25243.orig/libc/aclocal.m4 2013-11-06 15:03:08.000000000 -0800 ++++ eglibc-2.19-r25243/libc/aclocal.m4 2014-11-22 15:43:05.343256863 -0800 +@@ -1,7 +1,7 @@ + dnl We require that everyone use exactly the same Autoconf version so that + dnl the internal functions defined and used by the main configure script + dnl match those expected by the fragments. +-m4_define([GLIBC_AUTOCONF_VERSION], [2.68]) ++m4_define([GLIBC_AUTOCONF_VERSION], [2.69]) + m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [], + [m4_fatal(m4_flatten( + Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have |