--- /dev/null
--- /dev/null
++#
++# Copyright (C) 2015 OpenWrt.org
++#
++# This is free software, licensed under the GNU General Public License v2.
++# See /LICENSE for more information.
++#
++
++PKG_CHECK_FORMAT_SECURITY ?= 1
++PKG_SSP ?= 1
++PKG_FORTIFY_SOURCE ?= 1
++PKG_RELRO ?= 1
++
++ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
++ ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
++ TARGET_CFLAGS += -Wformat -Werror=format-security
++ endif
++endif
++ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
++ ifeq ($(strip $(PKG_SSP)),1)
++ TARGET_CFLAGS += -fstack-protector
++ endif
++endif
++ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
++ ifeq ($(strip $(PKG_SSP)),1)
++ TARGET_CFLAGS += -fstack-protector-strong
++ endif
++endif
++ifdef CONFIG_PKG_FORTIFY_SOURCE_1
++ ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
++ TARGET_CFLAGS += -D_FORTIFY_SOURCE=1
++ endif
++endif
++ifdef CONFIG_PKG_FORTIFY_SOURCE_2
++ ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
++ TARGET_CFLAGS += -D_FORTIFY_SOURCE=2
++ endif
++endif
++ifdef CONFIG_PKG_RELRO_PARTIAL
++ ifeq ($(strip $(PKG_RELRO)),1)
++ TARGET_CFLAGS += -Wl,-z,relro
++ TARGET_LDFLAGS += -zrelro
++ endif
++endif
++ifdef CONFIG_PKG_RELRO_FULL
++ ifeq ($(strip $(PKG_RELRO)),1)
++ TARGET_CFLAGS += -Wl,-z,now -Wl,-z,relro
++ TARGET_LDFLAGS += -znow -zrelro
++ endif
++endif
++
config USE_MIPS16
bool "Build packages with MIPS16 instructions" if TARGET_OPTIONS
depends on HAS_MIPS16
-- depends on !GCC_VERSION_4_6
default y
help
If your target CPU does support the MIPS16 instruction set
bool "n64"
config MIPS64_ABI_N32
++ depends on !LIBC_USE_MUSL
bool "n32"
config MIPS64_ABI_O32
choice
prompt "C Library implementation" if TOOLCHAINOPTS
-- default LIBC_USE_GLIBC if (aarch64 || aarch64_be)
-- default LIBC_USE_UCLIBC
++ default LIBC_USE_UCLIBC if arc
++ default LIBC_USE_MUSL
help
Select the C library implementation.
config LIBC_USE_GLIBC
bool "Use (e)glibc"
select USE_GLIBC
++ depends on !arc
config LIBC_USE_UCLIBC
select USE_UCLIBC
bool "Use uClibc"
depends on !(aarch64 || aarch64_be)
++ depends on BROKEN || !(arm || armeb || i386 || x86_64 || mips || mipsel || mips64 || mips64el || powerpc)
config LIBC_USE_MUSL
select USE_MUSL
bool "Use musl"
-- depends on BROKEN
-- depends on !(mips64 || mips64el)
++ depends on !(arc)
endchoice
source "toolchain/glibc/Config.in"
source "toolchain/uClibc/Config.in"
--source "toolchain/musl/Config.in"
comment "Debuggers"
depends on TOOLCHAINOPTS
config USE_GLIBC
bool
-- default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (aarch64 || aarch64_be || octeon)
config USE_UCLIBC
++ default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)
bool
-- default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(aarch64 || aarch64_be || octeon)
config USE_MUSL
++ default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(arc)
bool
config USE_EXTERNAL_LIBC
bool
default y if EXTERNAL_TOOLCHAIN || NATIVE_TOOLCHAIN
++source "toolchain/binutils/Config.version"
source "toolchain/gcc/Config.version"
source "toolchain/glibc/Config.version"
curdir:=toolchain
# subdirectories to descend into
--$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC))
++$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC) fortify-headers)
ifdef CONFIG_USE_UCLIBC
$(curdir)/builddirs += $(LIBC)/utils
endif
choice
prompt "Binutils Version" if TOOLCHAINOPTS
-- default BINUTILS_VERSION_LINARO
++ default BINUTILS_USE_VERSION_2_25_1 if !arc
++ default BINUTILS_USE_VERSION_2_23_ARC if arc
help
Select the version of binutils you wish to use.
-- config BINUTILS_VERSION_LINARO
++ config BINUTILS_USE_VERSION_2_24_LINARO
++ depends on !arc
bool "Linaro binutils 2.24"
++ select BINUTILS_VERSION_2_24_LINARO
++
++ config BINUTILS_USE_VERSION_2_25_1
++ depends on !arc
++ bool "Binutils 2.25.1"
++ select BINUTILS_VERSION_2_25_1
++
++ config BINUTILS_USE_VERSION_2_23_ARC
++ depends on arc
++ bool "ARC binutils 2.23"
++ select BINUTILS_VERSION_2_23_ARC
endchoice
default ""
help
Any additional binutils options you may want to include....
--
--config BINUTILS_VERSION
-- string
-- prompt "Binutils Version" if (TOOLCHAINOPTS && NULL)
-- default "linaro" if BINUTILS_VERSION_LINARO
-- default "linaro"
--- /dev/null
--- /dev/null
++config BINUTILS_VERSION_2_24_LINARO
++ bool
++
++config BINUTILS_VERSION_2_25_1
++ default y if (!TOOLCHAINOPTS && !arc)
++ bool
++
++config BINUTILS_VERSION_2_23_ARC
++ default y if (!TOOLCHAINOPTS && arc)
++ bool
++
++config BINUTILS_VERSION
++ string
++ default "2.24-linaro" if BINUTILS_VERSION_2_24_LINARO
++ default "2.25.1" if BINUTILS_VERSION_2_25_1
++ default "arc-2015.06" if BINUTILS_VERSION_2_23_ARC
++
PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
BIN_VERSION:=$(PKG_VERSION)
--PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
--PKG_REV:=2.24.0-2014.09
--PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
--PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
--BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
--HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
++PKG_SOURCE_URL:=@GNU/binutils/
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
++
++ifeq ($(PKG_VERSION),2.25.1)
++ PKG_MD5SUM:=ac493a78de4fee895961d025b7905be4
++endif
++
++ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro)
++ PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
++ PKG_REV:=2.24.0-2014.09
++ PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
++ PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
++ BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
++ HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
++endif
++
++ifneq ($(CONFIG_BINUTILS_VERSION_2_23_ARC),)
++ PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2015.06/
++ PKG_REV:=2015.06
++ PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
++ PKG_MD5SUM:=961a3564de857238c255c381f8e4360b
++ BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
++ HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
++endif
HOST_BUILD_PARALLEL:=1
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
--with-sysroot=$(TOOLCHAIN_DIR) \
++ --enable-deterministic-archives \
--enable-plugins \
--disable-multilib \
--disable-werror \
--disable-nls \
++ --disable-sim \
++ --disable-gdb \
$(GRAPHITE_CONFIGURE) \
$(SOFT_FLOAT_CONFIG_OPTION) \
$(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
$(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
$(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
$(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
++ # ARC gcc requires extlib.
++ # If extlib is not available in "initial" folder
++ # initial gcc will fail to build libc.
++ if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
++ $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
++ fi
endef
define Host/Clean
--- /dev/null
--- /dev/null
++--- a/ld/Makefile.am
+++++ b/ld/Makefile.am
++@@ -54,7 +54,7 @@ endif
++ # We put the scripts in the directory $(scriptdir)/ldscripts.
++ # We can't put the scripts in $(datadir) because the SEARCH_DIR
++ # directives need to be different for native and cross linkers.
++-scriptdir = $(tooldir)/lib
+++scriptdir = $(libdir)
++
++ EMUL = @EMUL@
++ EMULATION_OFILES = @EMULATION_OFILES@
++--- a/ld/Makefile.in
+++++ b/ld/Makefile.in
++@@ -388,7 +388,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
++ # We put the scripts in the directory $(scriptdir)/ldscripts.
++ # We can't put the scripts in $(datadir) because the SEARCH_DIR
++ # directives need to be different for native and cross linkers.
++-scriptdir = $(tooldir)/lib
+++scriptdir = $(libdir)
++ BASEDIR = $(srcdir)/..
++ BFDDIR = $(BASEDIR)/bfd
++ INCDIR = $(BASEDIR)/include
--- /dev/null
--- /dev/null
++--- a/ld/emultempl/elf32.em
+++++ b/ld/emultempl/elf32.em
++@@ -1198,6 +1198,8 @@ fragment <<EOF
++ && command_line.rpath == NULL)
++ {
++ lib_path = (const char *) getenv ("LD_RUN_PATH");
+++ if ((lib_path) && (strlen (lib_path) == 0))
+++ lib_path = NULL;
++ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
++ force))
++ break;
++@@ -1461,6 +1463,8 @@ gld${EMULATION_NAME}_before_allocation (
++ rpath = command_line.rpath;
++ if (rpath == NULL)
++ rpath = (const char *) getenv ("LD_RUN_PATH");
+++ if ((rpath) && (strlen (rpath) == 0))
+++ rpath = NULL;
++
++ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
++ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
--- /dev/null
--- /dev/null
++--- a/bfd/elfxx-mips.c
+++++ b/bfd/elfxx-mips.c
++@@ -7689,6 +7689,7 @@ _bfd_mips_elf_create_dynamic_sections (b
++
++ name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING";
++ bh = NULL;
+++ if (0) {
++ if (!(_bfd_generic_link_add_one_symbol
++ (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0,
++ NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
++@@ -7701,6 +7702,7 @@ _bfd_mips_elf_create_dynamic_sections (b
++
++ if (! bfd_elf_link_record_dynamic_symbol (info, h))
++ return FALSE;
+++ }
++
++ if (! mips_elf_hash_table (info)->use_rld_obj_head)
++ {
--- /dev/null
--- /dev/null
++--- a/bfd/config.bfd
+++++ b/bfd/config.bfd
++@@ -1062,12 +1062,12 @@ case "${targ}" in
++ targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
++ ;;
++ mips64*el-*-linux*)
++- targ_defvec=mips_elf32_ntrad_le_vec
++- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
+++ targ_defvec=mips_elf64_trad_le_vec
+++ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec"
++ ;;
++ mips64*-*-linux*)
++- targ_defvec=mips_elf32_ntrad_be_vec
++- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+++ targ_defvec=mips_elf64_trad_be_vec
+++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
++ ;;
++ mips*el-*-linux*)
++ targ_defvec=mips_elf32_trad_le_vec
++--- a/ld/configure.tgt
+++++ b/ld/configure.tgt
++@@ -476,11 +476,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip
++ mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
++ targ_extra_emuls="elf32elmipvxworks" ;;
++ mips*-*-windiss) targ_emul=elf32mipswindiss ;;
++-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
++- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+++mips64*el-*-linux-*) targ_emul=elf64ltsmip
+++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
++ targ_extra_libpath=$targ_extra_emuls ;;
++-mips64*-*-linux-*) targ_emul=elf32btsmipn32
++- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+++mips64*-*-linux-*) targ_emul=elf64btsmip
+++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
++ targ_extra_libpath=$targ_extra_emuls ;;
++ mips*el-*-linux-*) targ_emul=elf32ltsmip
++ targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
--- /dev/null
--- /dev/null
++#
++# Copyright (C) 2015 OpenWrt.org
++#
++# This is free software, licensed under the GNU General Public License v2.
++# See /LICENSE for more information.
++#
++include $(TOPDIR)/rules.mk
++include $(INCLUDE_DIR)/target.mk
++
++PKG_NAME:=fortify-headers
++PKG_VERSION:=0.7
++PKG_RELEASE=1
++
++PKG_SOURCE_URL:=http://dl.2f30.org/releases
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
++PKG_MD5SUM:=3f7c36daa0be000987e8ad8c0a202b42
++
++include $(INCLUDE_DIR)/toolchain-build.mk
++
++define Host/Compile
++ true
++endef
++
++define Host/Install
++ $(MAKE) -C $(HOST_BUILD_DIR) PREFIX="" DESTDIR="$(TOOLCHAIN_DIR)" install
++endef
++
++$(eval $(call HostBuild))
choice
prompt "GCC compiler Version" if TOOLCHAINOPTS
-- default GCC_USE_VERSION_4_6_LINARO if TARGET_octeon
-- default GCC_USE_VERSION_4_8_LINARO
++ default GCC_USE_VERSION_4_8_ARC if arc
++ default GCC_USE_VERSION_5
help
Select the version of gcc you wish to use.
-- config GCC_USE_VERSION_4_6_LINARO
-- select GCC_VERSION_4_6_LINARO
-- bool "gcc 4.6.x with Linaro enhancements"
++ config GCC_USE_VERSION_4_8_ARC
++ select GCC_VERSION_4_8_ARC
++ bool "gcc 4.8.x with support of ARC cores"
++ depends on arc
-- config GCC_USE_VERSION_4_8_LINARO
-- select GCC_VERSION_4_8_LINARO
-- bool "gcc 4.8.x with Linaro enhancements"
++ config GCC_USE_VERSION_5
++ select GCC_VERSION_5
++ bool "gcc 5.x"
++ depends on !arc
endchoice
config GCC_USE_SYSTEM_PPL_CLOOG
bool
prompt "Use the system versions of PPL and CLooG"
-- depends on GCC_USE_GRAPHITE
++ depends on GCC_USE_GRAPHITE && GCC_VERSION_4_8
default n
config EXTRA_GCC_CONFIG_OPTIONS
config SSP_SUPPORT
bool
prompt "Enable Stack-Smashing Protection support" if TOOLCHAINOPTS
-- default n
++ depends on !USE_MUSL
++ default y if !USE_MUSL
help
Enable Stack-Smashing Protection support
--config GCC_VERSION_4_6_LINARO
-- default y if (!TOOLCHAINOPTS && TARGET_octeon)
-- bool
--
--config GCC_VERSION_4_8_LINARO
-- default y if (!TOOLCHAINOPTS && !TARGET_octeon)
++config GCC_VERSION_4_8_ARC
++ default y if (!TOOLCHAINOPTS && arc)
bool
config GCC_VERSION
string
-- default "4.6.3" if GCC_VERSION_4_6_3
-- default "4.6-linaro" if GCC_VERSION_4_6_LINARO
default "4.8-linaro" if GCC_VERSION_4_8_LINARO
-- default "4.6-linaro"
--
--config GCC_VERSION_4_6
-- bool
-- default y if GCC_VERSION_4_6_LINARO
++ default "arc-2015.06" if GCC_VERSION_4_8_ARC
++ default "5.3.0"
config GCC_VERSION_4_8
bool
-- default y if GCC_VERSION_4_8_LINARO
++ default y if (GCC_VERSION_4_8_LINARO || GCC_VERSION_4_8_ARC)
++config GCC_VERSION_5
++ default y if (!TOOLCHAINOPTS && !arc)
++ bool
PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
--ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
-- LINARO_RELEASE:=
-- ifeq ($(CONFIG_GCC_VERSION),"4.6-linaro")
-- PKG_REV:=4.6-2013.05
-- PKG_VERSION:=4.6.4
-- PKG_VERSION_MAJOR:=4.6
-- PKG_MD5SUM:=26b48802ae1203cd99415026fbf56ed7
-- PKG_COMP:=bz2
-- endif
-- ifeq ($(CONFIG_GCC_VERSION),"4.8-linaro")
-- PKG_REV:=4.8-2014.04
-- PKG_VERSION:=4.8.3
-- PKG_VERSION_MAJOR:=4.8
-- PKG_MD5SUM:=5ba2f3a449b1658ccc09d27cc7ab3c03
-- PKG_COMP:=xz
-- endif
-- ifneq ($(LINARO_RELEASE),)
-- PKG_SOURCE_URL:=http://releases.linaro.org/$(LINARO_RELEASE)/components/toolchain/gcc-linaro/$(PKG_VERSION_MAJOR)
-- else
-- PKG_SOURCE_URL:=http://launchpad.net/gcc-linaro/$(PKG_VERSION_MAJOR)/$(PKG_REV)/+download/
-- endif
-- PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.$(PKG_COMP)
-- GCC_DIR:=gcc-linaro-$(PKG_REV)
-- HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GCC_DIR)
--else
-- PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
-- PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
++PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-- ifeq ($(PKG_VERSION),4.6.3)
-- PKG_MD5SUM:=773092fe5194353b02bb0110052a972e
-- endif
-- ifeq ($(PKG_VERSION),4.8.0)
-- PKG_MD5SUM:=e6040024eb9e761c3bea348d1fa5abb0
-- endif
++ifeq ($(PKG_VERSION),5.3.0)
++ PKG_MD5SUM:=c9616fd448f980259c31de613e575719
++endif
++
++ifneq ($(CONFIG_GCC_VERSION_4_8_ARC),)
++ PKG_VERSION:=4.8.4
++ PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/arc-2015.06
++ PKG_SOURCE:=$(PKG_NAME)-$(GCC_VERSION).tar.gz
++ PKG_MD5SUM:=25007ebb02a5f6c32532b103bb5984a0
++ PKG_REV:=2015.06
++ GCC_DIR:=gcc-arc-$(PKG_REV)
++ HOST_BUILD_DIR = $(BUILD_DIR_HOST)/$(PKG_NAME)-$(GCC_VERSION)
endif
PATCH_DIR=../patches/$(GCC_VERSION)
export glibcxx_cv_c99_math_tr1=no
endif
++ifdef CONFIG_GCC_USE_GRAPHITE
++ ifdef CONFIG_GCC_VERSION_4_8
++ GRAPHITE_CONFIGURE=--with-cloog=$(REAL_STAGING_DIR_HOST)
++ else
++ GRAPHITE_CONFIGURE=--with-isl=$(REAL_STAGING_DIR_HOST)
++ endif
++else
++ GRAPHITE_CONFIGURE=--without-isl --without-cloog
++endif
++
GCC_CONFIGURE:= \
SHELL="$(BASH)" \
$(if $(shell gcc --version 2>&1 | grep LLVM), \
$(SOFT_FLOAT_CONFIG_OPTION) \
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
-- --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
++ --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
++ $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
--with-gmp=$(TOPDIR)/staging_dir/host \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--with-mpc=$(TOPDIR)/staging_dir/host \
GCC_CONFIGURE += --with-mips-plt
endif
++ifndef GCC_VERSION_4_8
++ GCC_CONFIGURE += --with-diagnostics-color=auto-if-env
++endif
++
ifneq ($(CONFIG_SSP_SUPPORT),)
GCC_CONFIGURE+= \
--enable-libssp
--enable-languages=$(TARGET_LANGUAGES) \
--enable-shared \
--enable-threads \
-- --with-slibdir=$(TOOLCHAIN_DIR)/lib
--
--ifneq ($(CONFIG_GCC_VERSION_4_5)$(CONFIG_GCC_VERSION_4_6),)
-- GCC_CONFIGURE += \
++ --with-slibdir=$(TOOLCHAIN_DIR)/lib \
--enable-lto \
--with-libelf=$(TOPDIR)/staging_dir/host
++
++ifdef CONFIG_USE_MUSL
++ GCC_MAKE += gcc_cv_libc_provides_ssp=yes
endif
ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
+++ /dev/null
----- a/gcc/Makefile.in
--+++ b/gcc/Makefile.in
--@@ -4251,18 +4251,10 @@
-- doc/gccint.info: $(TEXI_GCCINT_FILES)
-- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
--
---doc/%.info: %.texi
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/%.info:
--
-- # Duplicate entry to handle renaming of gccinstall.info
---doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/gccinstall.info:
--
-- doc/cpp.dvi: $(TEXI_CPP_FILES)
-- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
--diff -urN a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
----- a/gcc/tree-ssa-math-opts.c 2012-12-12 18:05:23.000000000 +0100
--+++ b/gcc/tree-ssa-math-opts.c 2013-04-29 15:54:00.051998936 +0200
--@@ -1280,6 +1280,47 @@
-- return result;
-- }
--
--+/* Return true if stmt is a type conversion operation that can be stripped
--+ when used in a widening multiply operation. */
--+static bool
--+widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
--+{
--+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
--+
--+ if (TREE_CODE (result_type) == INTEGER_TYPE)
--+ {
--+ tree op_type;
--+ tree inner_op_type;
--+
--+ if (!CONVERT_EXPR_CODE_P (rhs_code))
--+ return false;
--+
--+ op_type = TREE_TYPE (gimple_assign_lhs (stmt));
--+
--+ /* If the type of OP has the same precision as the result, then
--+ we can strip this conversion. The multiply operation will be
--+ selected to create the correct extension as a by-product. */
--+ if (TYPE_PRECISION (result_type) == TYPE_PRECISION (op_type))
--+ return true;
--+
--+ /* We can also strip a conversion if it preserves the signed-ness of
--+ the operation and doesn't narrow the range. */
--+ inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
--+
--+ /* If the inner-most type is unsigned, then we can strip any
--+ intermediate widening operation. If it's signed, then the
--+ intermediate widening operation must also be signed. */
--+ if ((TYPE_UNSIGNED (inner_op_type)
--+ || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
--+ && TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
--+ return true;
--+
--+ return false;
--+ }
--+
--+ return rhs_code == FIXED_CONVERT_EXPR;
--+}
--+
-- /* Return true if RHS is a suitable operand for a widening multiplication,
-- assuming a target type of TYPE.
-- There are two cases:
--@@ -1296,17 +1337,13 @@
-- {
-- gimple stmt;
-- tree type1, rhs1;
--- enum tree_code rhs_code;
--
-- if (TREE_CODE (rhs) == SSA_NAME)
-- {
-- stmt = SSA_NAME_DEF_STMT (rhs);
-- if (is_gimple_assign (stmt))
-- {
--- rhs_code = gimple_assign_rhs_code (stmt);
--- if (TREE_CODE (type) == INTEGER_TYPE
--- ? !CONVERT_EXPR_CODE_P (rhs_code)
--- : rhs_code != FIXED_CONVERT_EXPR)
--+ if (! widening_mult_conversion_strippable_p (type, stmt))
-- rhs1 = rhs;
-- else
-- {
+++ /dev/null
----- a/gcc/haifa-sched.c
--+++ b/gcc/haifa-sched.c
--@@ -4654,10 +4654,12 @@ schedule_block (basic_block *target_bb)
--
-- if (recog_memoized (insn) >= 0)
-- {
--+ memcpy (temp_state, curr_state, dfa_state_size);
-- cost = state_transition (curr_state, insn);
-- if (sched_pressure != SCHED_PRESSURE_WEIGHTED)
-- gcc_assert (cost < 0);
--- cycle_issued_insns++;
--+ if (memcmp (temp_state, curr_state, dfa_state_size) != 0)
--+ cycle_issued_insns++;
-- asm_p = false;
-- }
-- else
+++ /dev/null
----- a/gcc/config/mips/sync.md
--+++ b/gcc/config/mips/sync.md
--@@ -136,7 +136,7 @@
-- [(match_operand:SI 1 "register_operand" "d")
-- (match_operand:SI 2 "register_operand" "d")
-- (atomic_hiqi_op:SI (match_dup 0)
--- (match_operand:SI 3 "register_operand" "dJ"))]
--+ (match_operand:SI 3 "reg_or_0_operand" "dJ"))]
-- UNSPEC_SYNC_OLD_OP_12))
-- (clobber (match_scratch:SI 4 "=&d"))]
-- "GENERATE_LL_SC"
--@@ -177,7 +177,7 @@
-- [(match_operand:SI 2 "register_operand" "d")
-- (match_operand:SI 3 "register_operand" "d")
-- (atomic_hiqi_op:SI (match_dup 0)
--- (match_operand:SI 4 "register_operand" "dJ"))]
--+ (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
-- UNSPEC_SYNC_OLD_OP_12))
-- (clobber (match_scratch:SI 5 "=&d"))]
-- "GENERATE_LL_SC"
--@@ -218,7 +218,7 @@
-- (match_operand:SI 2 "register_operand" "d")
-- (match_operand:SI 3 "register_operand" "d")
-- (atomic_hiqi_op:SI (match_dup 0)
--- (match_operand:SI 4 "register_operand" "dJ"))]
--+ (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
-- UNSPEC_SYNC_NEW_OP_12))
-- (set (match_dup 1)
-- (unspec_volatile:SI
--@@ -259,7 +259,7 @@
-- [(match_operand:SI 1 "register_operand" "d")
-- (match_operand:SI 2 "register_operand" "d")
-- (match_dup 0)
--- (match_operand:SI 3 "register_operand" "dJ")]
--+ (match_operand:SI 3 "reg_or_0_operand" "dJ")]
-- UNSPEC_SYNC_OLD_OP_12))
-- (clobber (match_scratch:SI 4 "=&d"))]
-- "GENERATE_LL_SC"
--@@ -298,7 +298,7 @@
-- (unspec_volatile:SI
-- [(match_operand:SI 2 "register_operand" "d")
-- (match_operand:SI 3 "register_operand" "d")
--- (match_operand:SI 4 "register_operand" "dJ")]
--+ (match_operand:SI 4 "reg_or_0_operand" "dJ")]
-- UNSPEC_SYNC_OLD_OP_12))
-- (clobber (match_scratch:SI 5 "=&d"))]
-- "GENERATE_LL_SC"
--@@ -337,7 +337,7 @@
-- [(match_operand:SI 1 "memory_operand" "+R")
-- (match_operand:SI 2 "register_operand" "d")
-- (match_operand:SI 3 "register_operand" "d")
--- (match_operand:SI 4 "register_operand" "dJ")]
--+ (match_operand:SI 4 "reg_or_0_operand" "dJ")]
-- UNSPEC_SYNC_NEW_OP_12))
-- (set (match_dup 1)
-- (unspec_volatile:SI
--@@ -546,7 +546,7 @@
-- (set (match_dup 1)
-- (unspec_volatile:SI [(match_operand:SI 2 "register_operand" "d")
-- (match_operand:SI 3 "register_operand" "d")
--- (match_operand:SI 4 "arith_operand" "dJ")]
--+ (match_operand:SI 4 "reg_or_0_operand" "dJ")]
-- UNSPEC_SYNC_EXCHANGE_12))]
-- "GENERATE_LL_SC"
-- { return mips_output_sync_loop (insn, operands); }
+++ /dev/null
----- a/contrib/regression/objs-gcc.sh
--+++ b/contrib/regression/objs-gcc.sh
--@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
-- then
-- make all-gdb all-dejagnu all-ld || exit 1
-- make install-gdb install-dejagnu install-ld || exit 1
--+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
--+ then
--+ make all-gdb all-dejagnu all-ld || exit 1
--+ make install-gdb install-dejagnu install-ld || exit 1
-- elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
-- make bootstrap || exit 1
-- make install || exit 1
----- a/libjava/classpath/ltconfig
--+++ b/libjava/classpath/ltconfig
--@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
--
-- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
-- case $host_os in
---linux-gnu*) ;;
--+linux-gnu*|linux-uclibc*) ;;
-- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-- esac
--
--@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
-- ;;
--
-- # This must be Linux ELF.
---linux-gnu*)
--+linux*)
-- version_type=linux
-- need_lib_prefix=no
-- need_version=no
+++ /dev/null
----- a/config.sub
--+++ b/config.sub
--@@ -125,6 +125,7 @@ esac
-- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-- case $maybe_os in
-- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
--+ linux-musl* | \
-- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-- knetbsd*-gnu* | netbsd*-gnu* | \
-- kopensolaris*-gnu* | \
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -485,7 +485,7 @@ case ${target} in
-- esac
--
-- # Common C libraries.
---tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
--+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
--
-- # Common parts for widely ported systems.
-- case ${target} in
--@@ -598,6 +598,9 @@ case ${target} in
-- *-*-*uclibc*)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
-- ;;
--+ *-*-*musl*)
--+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
--+ ;;
-- *)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
-- ;;
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -78,6 +78,10 @@
-- %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
-- %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
--
--+/* musl has no "classic" (i.e. broken) mode */
--+#undef MUSL_DYNAMIC_LINKER
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
----- a/gcc/config/i386/linux.h
--+++ b/gcc/config/i386/linux.h
--@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3.
-- /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-- #define LINK_EMULATION "elf_i386"
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
--
-- #undef ASM_SPEC
-- #define ASM_SPEC \
----- a/gcc/config/i386/linux64.h
--+++ b/gcc/config/i386/linux64.h
--@@ -65,6 +65,9 @@ see the files COPYING3 and COPYING.RUNTI
-- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
--
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
--+
-- #if TARGET_64BIT_DEFAULT
-- #define SPEC_32 "m32"
-- #define SPEC_64 "!m32"
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTI
-- #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
-- #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
-- #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
--+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
-- #else
-- #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
-- #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
-- #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
--+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
-- #endif
--
-- #define LINUX_TARGET_OS_CPP_BUILTINS() \
--@@ -54,18 +56,21 @@ see the files COPYING3 and COPYING.RUNTI
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
--
---#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
--- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
--+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
--+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
--
-- #if DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
-- #elif DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
-- #elif DEFAULT_LIBC == LIBC_BIONIC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif /* DEFAULT_LIBC */
--@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTI
--
-- #define LINUX_DYNAMIC_LINKER \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
--- BIONIC_DYNAMIC_LINKER)
--+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
-- #define LINUX_DYNAMIC_LINKER32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
--- BIONIC_DYNAMIC_LINKER32)
--+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
-- #define LINUX_DYNAMIC_LINKER64 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
--- BIONIC_DYNAMIC_LINKER64)
--+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
--
-- /* Determine whether the entire c99 runtime
-- is present in the runtime library. */
----- a/gcc/config/linux.opt
--+++ b/gcc/config/linux.opt
--@@ -30,3 +30,7 @@ Use GNU C library
-- muclibc
-- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
-- Use uClibc C library
--+
--+mmusl
--+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
--+Use musl C library
----- a/gcc/config/mips/linux.h
--+++ b/gcc/config/mips/linux.h
--@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3.
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
--
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
--+
-- /* Borrowed from sparc/linux.h */
-- #undef LINK_SPEC
-- #define LINK_SPEC \
----- a/gcc/ginclude/stddef.h
--+++ b/gcc/ginclude/stddef.h
--@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #ifndef _GCC_SIZE_T
-- #ifndef _SIZET_
-- #ifndef __size_t
--+#ifndef __DEFINED_size_t /* musl */
-- #define __size_t__ /* BeOS */
-- #define __SIZE_T__ /* Cray Unicos/Mk */
-- #define _SIZE_T
--@@ -200,6 +201,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #define ___int_size_t_h
-- #define _GCC_SIZE_T
-- #define _SIZET_
--+#define __DEFINED_size_t /* musl */
-- #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
-- /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
-- #else
--@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
-- typedef long ssize_t;
-- #endif /* __BEOS__ */
-- #endif /* !(defined (__GNUG__) && defined (size_t)) */
--+#endif /* __DEFINED_size_t */
-- #endif /* __size_t */
-- #endif /* _SIZET_ */
-- #endif /* _GCC_SIZE_T */
----- a/libgomp/config/posix/time.c
--+++ b/libgomp/config/posix/time.c
--@@ -28,6 +28,8 @@
-- The following implementation uses the most simple POSIX routines.
-- If present, POSIX 4 clocks should be used instead. */
--
--+#define _POSIX_C_SOURCE 199309L /* for clocks */
--+
-- #include "libgomp.h"
-- #include <unistd.h>
-- #if TIME_WITH_SYS_TIME
----- a/libstdc++-v3/configure.host
--+++ b/libstdc++-v3/configure.host
--@@ -237,6 +237,13 @@ case "${host_os}" in
-- os_include_dir="os/bsd/freebsd"
-- ;;
-- gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
--+ # check for musl by target
--+ case "${host_os}" in
--+ *-musl*)
--+ os_include_dir="os/generic"
--+ ;;
--+ *)
--+
-- if [ "$uclibc" = "yes" ]; then
-- os_include_dir="os/uclibc"
-- elif [ "$bionic" = "yes" ]; then
--@@ -245,6 +252,9 @@ case "${host_os}" in
-- os_include_dir="os/gnu-linux"
-- fi
-- ;;
--+
--+ esac
--+ ;;
-- hpux*)
-- os_include_dir="os/hpux"
-- ;;
----- a/gcc/config/mips/linux64.h
--+++ b/gcc/config/mips/linux64.h
--@@ -40,9 +40,12 @@ along with GCC; see the file COPYING3.
-- #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
-- #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
-- #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
--+#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
-- #define LINUX_DYNAMIC_LINKERN32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
--- BIONIC_DYNAMIC_LINKERN32)
--+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
--
-- #undef LINK_SPEC
-- #define LINK_SPEC "\
----- a/gcc/config/sparc/linux64.h 2013-09-10 10:02:45.663973856 +0100
--+++ b/gcc/config/sparc/linux64.h 2013-09-10 10:03:17.871972435 +0100
--@@ -104,6 +104,9 @@
-- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
--
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-sparc.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-sparc.so.1"
--+
-- #ifdef SPARC_BI_ARCH
--
-- #undef SUBTARGET_EXTRA_SPECS
+++ /dev/null
----- a/boehm-gc/include/gc.h
--+++ b/boehm-gc/include/gc.h
--@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
-- #if defined(__linux__) || defined(__GLIBC__)
-- # include <features.h>
-- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
--- && !defined(__ia64__)
--+ && !defined(__ia64__) && !defined(__UCLIBC__)
-- # ifndef GC_HAVE_BUILTIN_BACKTRACE
-- # define GC_HAVE_BUILTIN_BACKTRACE
-- # endif
+++ /dev/null
----- a/libstdc++-v3/include/c_global/cstdio
--+++ b/libstdc++-v3/include/c_global/cstdio
--@@ -137,7 +137,7 @@ namespace std
-- using ::vsprintf;
-- } // namespace
--
---#if _GLIBCXX_USE_C99
--+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
--
-- #undef snprintf
-- #undef vfscanf
+++ /dev/null
----- a/libmudflap/mf-hooks2.c
--+++ b/libmudflap/mf-hooks2.c
--@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
-- {
-- TRACE ("%s\n", __PRETTY_FUNCTION__);
-- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
--- bzero (s, n);
--+ memset (s, 0, n);
-- }
--
--
--@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
-- TRACE ("%s\n", __PRETTY_FUNCTION__);
-- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
-- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
--- bcopy (src, dest, n);
--+ memmove (dest, src, n);
-- }
--
--
--@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
-- TRACE ("%s\n", __PRETTY_FUNCTION__);
-- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
-- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
--- return bcmp (s1, s2, n);
--+ return n == 0 ? 0 : memcmp (s1, s2, n);
-- }
--
--
--@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
-- size_t n = strlen (s);
-- TRACE ("%s\n", __PRETTY_FUNCTION__);
-- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
--- return index (s, c);
--+ return strchr (s, c);
-- }
--
--
--@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
-- size_t n = strlen (s);
-- TRACE ("%s\n", __PRETTY_FUNCTION__);
-- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
--- return rindex (s, c);
--+ return strrchr (s, c);
-- }
--
-- /* XXX: stpcpy, memccpy */
+++ /dev/null
----- a/gcc/config/arm/arm.h
--+++ b/gcc/config/arm/arm.h
--@@ -232,7 +232,7 @@ extern void (*arm_lang_output_object_att
-- #define TARGET_BACKTRACE (leaf_function_p () \
-- ? TARGET_TPCS_LEAF_FRAME \
-- : TARGET_TPCS_FRAME)
---#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN)
--+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN)
-- #define TARGET_AAPCS_BASED \
-- (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
--
+++ /dev/null
----- a/gcc/config/arm/linux-elf.h
--+++ b/gcc/config/arm/linux-elf.h
--@@ -60,7 +60,7 @@
-- %{shared:-lc} \
-- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
--
---#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
--+#define LIBGCC_SPEC "-lgcc"
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--
----- a/gcc/config/arm/t-linux
--+++ b/gcc/config/arm/t-linux
--@@ -23,7 +23,11 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
--
-- LIB1ASMSRC = arm/lib1funcs.asm
-- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
--- _arm_addsubdf3 _arm_addsubsf3
--+ _arm_addsubdf3 _arm_addsubsf3 \
--+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
--+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
--+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
--+ _arm_fixsfsi _arm_fixunssfsi
--
-- # MULTILIB_OPTIONS = mhard-float/msoft-float
-- # MULTILIB_DIRNAMES = hard-float soft-float
+++ /dev/null
----- a/libgcc/Makefile.in
--+++ b/libgcc/Makefile.in
--@@ -747,11 +747,12 @@ $(libgcov-objects): %$(objext): $(gcc_sr
--
-- # Static libraries.
-- libgcc.a: $(libgcc-objects)
--+libgcc_pic.a: $(libgcc-s-objects)
-- libgcov.a: $(libgcov-objects)
-- libunwind.a: $(libunwind-objects)
-- libgcc_eh.a: $(libgcc-eh-objects)
--
---libgcc.a libgcov.a libunwind.a libgcc_eh.a:
--+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-- -rm -f $@
--
-- objects="$(objects)"; \
--@@ -773,7 +774,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
-- endif
--
-- ifeq ($(enable_shared),yes)
---all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
--+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
-- ifneq ($(LIBUNWIND),)
-- all: libunwind$(SHLIB_EXT)
-- endif
--@@ -954,6 +955,10 @@ install-shared:
-- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
--
--+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
--+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+
-- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
-- @shlib_base_name@,libgcc_s,$(subst \
-- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
--http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
--
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -46,7 +46,7 @@
-- The ARM10TDMI core is the default for armv5t, so set
-- SUBTARGET_CPU_DEFAULT to achieve this. */
-- #undef SUBTARGET_CPU_DEFAULT
---#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
--+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
--
-- /* TARGET_BIG_ENDIAN_DEFAULT is set in
-- config.gcc for big endian configurations. */
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -82,10 +82,15 @@
-- #undef MUSL_DYNAMIC_LINKER
-- #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
--
--+/* For armv4 we pass --fix-v4bx to linker to support EABI */
--+#undef TARGET_FIX_V4BX_SPEC
--+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
--+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
---#define LINK_SPEC BE8_LINK_SPEC \
--+#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
-- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
-- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
--
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -115,10 +115,6 @@
-- #define ENDFILE_SPEC \
-- LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
--
---/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
--- do not use -lfloat. */
---#undef LIBGCC_SPEC
---
-- /* Clear the instruction cache from `beg' to `end'. This is
-- implemented in lib1funcs.asm, so ensure an error if this definition
-- is used. */
----- a/gcc/config/arm/linux-elf.h
--+++ b/gcc/config/arm/linux-elf.h
--@@ -60,8 +60,6 @@
-- %{shared:-lc} \
-- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
--
---#define LIBGCC_SPEC "-lgcc"
---
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--
-- #define LINUX_TARGET_LINK_SPEC "%{h*} \
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -52,6 +52,10 @@ see the files COPYING3 and COPYING.RUNTI
-- builtin_assert ("system=posix"); \
-- } while (0)
--
--+#ifndef LIBGCC_SPEC
--+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
--+#endif
--+
-- /* Determine which dynamic linker to use depending on whether GLIBC or
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
----- a/gcc/config/rs6000/linux.h
--+++ b/gcc/config/rs6000/linux.h
--@@ -88,6 +88,8 @@
-- #define USE_LD_AS_NEEDED 1
-- #endif
--
--+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
--+
-- #undef TARGET_VERSION
-- #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
--
----- a/gcc/mkmap-symver.awk
--+++ b/gcc/mkmap-symver.awk
--@@ -132,5 +132,5 @@ function output(lib) {
-- else if (inherit[lib])
-- printf("} %s;\n", inherit[lib]);
-- else
--- printf ("\n local:\n\t*;\n};\n");
--+ printf ("\n\t*;\n};\n");
-- }
----- a/libgcc/Makefile.in
--+++ b/libgcc/Makefile.in
--@@ -269,6 +269,12 @@ ifeq ($(enable_shared),yes)
-- install-libunwind = install-libunwind
-- endif
--
--+else
--+# Not enable_shared.
--+iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
--+endif
--+
--+
-- # For -fvisibility=hidden. We need both a -fvisibility=hidden on
-- # the command line, and a #define to prevent libgcc2.h etc from
-- # overriding that with #pragmas.
--@@ -291,13 +297,6 @@ else
-- gen-hide-list = echo > $@
-- endif
--
---else
---# Not enable_shared.
---iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
---vis_hide =
---gen-hide-list = echo > \$@
---endif
---
-- ifneq ($(EXTRA_PARTS),)
-- extra-parts = libgcc-extra-parts
-- INSTALL_PARTS = $(EXTRA_PARTS)
+++ /dev/null
----- a/gcc/crtstuff.c
--+++ b/gcc/crtstuff.c
--@@ -100,15 +100,20 @@ call_ ## FUNC (void) \
-- #if defined(OBJECT_FORMAT_ELF) \
-- && !defined(OBJECT_FORMAT_FLAT) \
-- && defined(HAVE_LD_EH_FRAME_HDR) \
--- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
--- && defined(__GLIBC__) && __GLIBC__ >= 2
--+ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
-- #include <link.h>
-- /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
-- But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
---# if !defined(__UCLIBC__) \
--- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
---# define USE_PT_GNU_EH_FRAME
--+# if defined(__UCLIBC__)
--+# if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
--+ (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
--+# define USE_PT_GNU_EH_FRAME
--+# endif
--+# elif defined(__GLIBC__)
--+# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
--+# define USE_PT_GNU_EH_FRAME
--+# endif
-- # endif
-- #endif
-- #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
+++ /dev/null
----- a/gcc/config/rs6000/sysv4.h
--+++ b/gcc/config/rs6000/sysv4.h
--@@ -248,13 +248,13 @@ do { \
--
-- /* Define cutoff for using external functions to save floating point.
-- When optimizing for size, use external functions when profitable. */
---#define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
--+#define FP_SAVE_INLINE(FIRST_REG) (1 || (optimize_size \
-- ? ((FIRST_REG) == 62 \
-- || (FIRST_REG) == 63) \
--- : (FIRST_REG) < 64)
--+ : (FIRST_REG) < 64))
-- /* And similarly for general purpose registers. */
---#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
--- && !optimize_size)
--+#define GP_SAVE_INLINE(FIRST_REG) (1 || ((FIRST_REG) < 32 \
--+ && !optimize_size))
--
-- /* Put jump tables in read-only memory, rather than in .text. */
-- #define JUMP_TABLES_IN_TEXT_SECTION 0
+++ /dev/null
----- a/gcc/defaults.h
--+++ b/gcc/defaults.h
--@@ -383,7 +383,7 @@ see the files COPYING3 and COPYING.RUNTI
-- /* If we have named section and we support weak symbols, then use the
-- .jcr section for recording java classes which need to be registered
-- at program start-up time. */
---#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
--+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
-- #ifndef JCR_SECTION_NAME
-- #define JCR_SECTION_NAME ".jcr"
-- #endif
+++ /dev/null
----- gcc/gcc/config/mips/t-libgcc-mips16~ 2013-03-26 09:09:34.209077496 -0400
--+++ gcc/gcc/config/mips/t-libgcc-mips16 2013-03-26 18:21:01.717303669 -0400
--@@ -43,3 +43,6 @@
--
-- # Version these symbols if building libgcc.so.
-- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
--+
--+CRTSTUFF_T_CFLAGS += -mno-mips16
--+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
--
-- This patch brings over a few features from MirBSD:
-- * -fhonour-copts
-- If this option is not given, it's warned (depending
-- on environment variables). This is to catch errors
-- of misbuilt packages which override CFLAGS themselves.
-- * -Werror-maybe-reset
-- Has the effect of -Wno-error if GCC_NO_WERROR is
-- set and not '0', a no-operation otherwise. This is
-- to be able to use -Werror in "make" but prevent
-- GNU autoconf generated configure scripts from
-- freaking out.
-- * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
-- the default for -O2/-Os, because they trigger gcc bugs
-- and can delete code with security implications.
--
-- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
-- with copyright assignment to the FSF in effect.
--
----- a/gcc/c-family/c-opts.c
--+++ b/gcc/c-family/c-opts.c
--@@ -103,6 +103,9 @@ static size_t deferred_count;
-- /* Number of deferred options scanned for -include. */
-- static size_t include_cursor;
--
--+/* Check if a port honours COPTS. */
--+static int honour_copts = 0;
--+
-- static void handle_OPT_d (const char *);
-- static void set_std_cxx98 (int);
-- static void set_std_cxx0x (int);
--@@ -441,6 +444,9 @@ c_common_handle_option (size_t scode, co
-- global_dc->warning_as_error_requested = value;
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ break;
--+
-- case OPT_Wformat:
-- set_Wformat (value);
-- break;
--@@ -584,6 +590,12 @@ c_common_handle_option (size_t scode, co
-- flag_no_builtin = !value;
-- break;
--
--+ case OPT_fhonour_copts:
--+ if (c_language == clk_c) {
--+ honour_copts++;
--+ }
--+ break;
--+
-- case OPT_fconstant_string_class_:
-- constant_string_class_name = arg;
-- break;
--@@ -1058,6 +1070,47 @@ c_common_init (void)
-- return false;
-- }
--
--+ if (c_language == clk_c) {
--+ char *ev = getenv ("GCC_HONOUR_COPTS");
--+ int evv;
--+ if (ev == NULL)
--+ evv = -1;
--+ else if ((*ev == '0') || (*ev == '\0'))
--+ evv = 0;
--+ else if (*ev == '1')
--+ evv = 1;
--+ else if (*ev == '2')
--+ evv = 2;
--+ else if (*ev == 's')
--+ evv = -1;
--+ else {
--+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
--+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
--+ }
--+ if (evv == 1) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in lenient mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ warning (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ } else if (evv == 2) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in strict mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ error ("someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ return false;
--+ }
--+ } else if (evv == 0) {
--+ if (honour_copts != 1)
--+ inform (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ }
--+
-- return true;
-- }
--
----- a/gcc/c-family/c.opt
--+++ b/gcc/c-family/c.opt
--@@ -363,6 +363,10 @@ Werror-implicit-function-declaration
-- C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
-- This switch is deprecated; use -Werror=implicit-function-declaration instead
--
--+Werror-maybe-reset
--+C ObjC C++ ObjC++
--+; Documented in common.opt
--+
-- Wfloat-equal
-- C ObjC C++ ObjC++ Var(warn_float_equal) Warning
-- Warn if testing floating point numbers for equality
--@@ -794,6 +798,9 @@ C++ ObjC++ Optimization Alias(fexception
-- fhonor-std
-- C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
--
--+fhonour-copts
--+C ObjC C++ ObjC++ RejectNegative
--+
-- fhosted
-- C ObjC
-- Assume normal C execution environment
----- a/gcc/common.opt
--+++ b/gcc/common.opt
--@@ -520,6 +520,10 @@ Werror=
-- Common Joined
-- Treat specified warning as error
--
--+Werror-maybe-reset
--+Common
--+If environment variable GCC_NO_WERROR is set, act as -Wno-error
--+
-- Wextra
-- Common Var(extra_warnings) Warning
-- Print extra (possibly unwanted) warnings
--@@ -1156,6 +1160,9 @@ fguess-branch-probability
-- Common Report Var(flag_guess_branch_prob) Optimization
-- Enable guessing of branch probabilities
--
--+fhonour-copts
--+Common RejectNegative
--+
-- ; Nonzero means ignore `#ident' directives. 0 means handle them.
-- ; Generate position-independent code for executables if possible
-- ; On SVR4 targets, it also controls whether or not to emit a
----- a/gcc/opts.c
--+++ b/gcc/opts.c
--@@ -477,8 +477,6 @@ static const struct default_options defa
-- { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
-- #endif
-- { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
--- { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
--- { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
--@@ -494,6 +492,8 @@ static const struct default_options defa
-- { OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 },
--
-- /* -O3 optimizations. */
--+ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
--+ { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
-- { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
-- { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
-- /* Inlining of functions reducing size is a good idea with -Os
--@@ -1405,6 +1405,17 @@ common_handle_option (struct gcc_options
-- opts, opts_set, loc, dc);
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ {
--+ char *ev = getenv ("GCC_NO_WERROR");
--+ if ((ev != NULL) && (*ev != '0'))
--+ warnings_are_errors = 0;
--+ }
--+ break;
--+
--+ case OPT_fhonour_copts:
--+ break;
--+
-- case OPT_Wlarger_than_:
-- opts->x_larger_than_size = value;
-- opts->x_warn_larger_than = value != -1;
----- a/gcc/doc/cppopts.texi
--+++ b/gcc/doc/cppopts.texi
--@@ -164,6 +164,11 @@ in older programs. This warning is on b
-- Make all warnings into hard errors. Source code which triggers warnings
-- will be rejected.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
-- @item -Wsystem-headers
-- @opindex Wsystem-headers
-- Issue warnings for code in system headers. These are normally unhelpful
----- a/gcc/doc/invoke.texi
--+++ b/gcc/doc/invoke.texi
--@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
-- -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
-- -Wno-deprecated-declarations -Wdisabled-optimization @gol
-- -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
----Wno-endif-labels -Werror -Werror=* @gol
--+-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
-- -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-- -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-- -Wformat-security -Wformat-y2k @gol
--@@ -4498,6 +4498,22 @@ This option is only supported for C and
-- @option{-Wall} and by @option{-pedantic}, which can be disabled with
-- @option{-Wno-pointer-sign}.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
--+ at item -fhonour-copts
--+ at opindex fhonour-copts
--+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
--+given at least once, and warn if it is given more than once.
--+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
--+given exactly once.
--+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
--+is not given exactly once.
--+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
--+This flag and environment variable only affect the C language.
--+
-- @item -Wstack-protector
-- @opindex Wstack-protector
-- @opindex Wno-stack-protector
--@@ -6317,7 +6333,7 @@ so, the first branch is redirected to ei
-- second branch or a point immediately following it, depending on whether
-- the condition is known to be true or false.
--
---Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
--+Enabled at levels @option{-O3}.
--
-- @item -fsplit-wide-types
-- @opindex fsplit-wide-types
----- a/gcc/java/jvspec.c
--+++ b/gcc/java/jvspec.c
--@@ -627,6 +627,7 @@ lang_specific_pre_link (void)
-- class name. Append dummy `.c' that can be stripped by set_input so %b
-- is correct. */
-- set_input (concat (main_class_name, "main.c", NULL));
--+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
-- err = do_spec (jvgenmain_spec);
-- if (err == 0)
-- {
+++ /dev/null
----- a/gcc/gcc.c
--+++ b/gcc/gcc.c
--@@ -7772,7 +7772,10 @@ getenv_spec_function (int argc, const ch
--
-- value = getenv (argv[0]);
-- if (!value)
--- fatal_error ("environment variable %qs not defined", argv[0]);
--+ {
--+ warning (0, "environment variable %qs not defined", argv[0]);
--+ value = "";
--+ }
--
-- /* We have to escape every character of the environment variable so
-- they are not interpreted as active spec characters. A
+++ /dev/null
----- a/libstdc++-v3/include/Makefile.in
--+++ b/libstdc++-v3/include/Makefile.in
--@@ -1326,7 +1326,7 @@
-- @$(STAMP) stamp-bits
--
-- stamp-bits-sup: stamp-bits ${bits_sup_headers}
--- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
--+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
-- @$(STAMP) stamp-bits-sup
--
-- stamp-c_base: ${c_base_headers}
+++ /dev/null
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -1805,7 +1805,7 @@ m68k-*-linux*) # Motorola m68k's runnin
-- default_m68k_cpu=68020
-- default_cf_cpu=5475
-- with_arch=${with_arch:-m68k}
--- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h ./sysroot-suffix.h"
--+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h"
-- extra_options="${extra_options} m68k/ieee.opt"
-- tm_defines="${tm_defines} MOTOROLA=1"
-- tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs"
+++ /dev/null
--Revert of:
--
--commit 275035b56823b26d5fb7e90fad945b998648edf2
--Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
--Date: Thu Sep 5 14:09:07 2013 +0000
--
-- PR target/58139
-- * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
-- looking for widest mode.
--
--
-- git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
--
--
----- a/gcc/reginfo.c
--+++ b/gcc/reginfo.c
--@@ -620,35 +620,40 @@ choose_hard_reg_mode (unsigned int regno
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
-- if (found_mode != VOIDmode)
+++ /dev/null
----- /dev/null
--+++ b/gcc/testsuite/gcc.dg/visibility-21.c
--@@ -0,0 +1,14 @@
--+/* PR target/32219 */
--+/* { dg-do run } */
--+/* { dg-require-visibility "" } */
--+/* { dg-options "-fPIC" { target fpic } } */
--+
--+extern void f() __attribute__((weak,visibility("hidden")));
--+extern int puts( char const* );
--+int main()
--+{
--+ if (f)
--+ f();
--+ return 0;
--+}
--+
----- a/gcc/varasm.c
--+++ b/gcc/varasm.c
--@@ -6677,6 +6677,10 @@ default_binds_local_p_1 (const_tree exp,
-- /* Static variables are always local. */
-- else if (! TREE_PUBLIC (exp))
-- local_p = true;
--+ /* hidden weak can't be overridden by something non-local, all
--+ that is possible is that it is not defined at all. */
--+ else if (DECL_WEAK (exp))
--+ local_p = false;
-- /* A variable is local if the user has said explicitly that it will
-- be. */
-- else if ((DECL_VISIBILITY_SPECIFIED (exp)
--@@ -6690,11 +6694,6 @@ default_binds_local_p_1 (const_tree exp,
-- local. */
-- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
-- local_p = true;
--- /* Default visibility weak data can be overridden by a strong symbol
--- in another module and so are not local. */
--- else if (DECL_WEAK (exp)
--- && !resolved_locally)
--- local_p = false;
-- /* If PIC, then assume that any global name can be overridden by
-- symbols resolved from other modules. */
-- else if (shlib)
+++ /dev/null
----- a/gcc/c/c-typeck.c
--+++ b/gcc/c/c-typeck.c
--@@ -62,9 +62,9 @@ int in_typeof;
-- if expr.original_code == SIZEOF_EXPR. */
-- tree c_last_sizeof_arg;
--
---/* Nonzero if we've already printed a "missing braces around initializer"
--- message within this initializer. */
---static int missing_braces_mentioned;
--+/* Nonzero if we might need to print a "missing braces around
--+ initializer" message within this initializer. */
--+static int found_missing_braces;
--
-- static int require_constant_value;
-- static int require_constant_elements;
--@@ -6363,6 +6363,9 @@ static int constructor_nonconst;
-- /* 1 if this constructor is erroneous so far. */
-- static int constructor_erroneous;
--
--+/* 1 if this constructor is the universal zero initializer { 0 }. */
--+static int constructor_zeroinit;
--+
-- /* Structure for managing pending initializer elements, organized as an
-- AVL tree. */
--
--@@ -6524,7 +6527,7 @@ start_init (tree decl, tree asmspec_tree
-- constructor_stack = 0;
-- constructor_range_stack = 0;
--
--- missing_braces_mentioned = 0;
--+ found_missing_braces = 0;
--
-- spelling_base = 0;
-- spelling_size = 0;
--@@ -6619,6 +6622,7 @@ really_start_incremental_init (tree type
-- constructor_type = type;
-- constructor_incremental = 1;
-- constructor_designated = 0;
--+ constructor_zeroinit = 1;
-- designator_depth = 0;
-- designator_erroneous = 0;
--
--@@ -6816,11 +6820,8 @@ push_init_level (int implicit, struct ob
-- set_nonincremental_init (braced_init_obstack);
-- }
--
--- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
--- {
--- missing_braces_mentioned = 1;
--- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
--- }
--+ if (implicit == 1)
--+ found_missing_braces = 1;
--
-- if (TREE_CODE (constructor_type) == RECORD_TYPE
-- || TREE_CODE (constructor_type) == UNION_TYPE)
--@@ -6953,16 +6954,23 @@ pop_init_level (int implicit, struct obs
-- }
-- }
--
--+ if (vec_safe_length (constructor_elements) != 1)
--+ constructor_zeroinit = 0;
--+
--+ /* Warn when some structs are initialized with direct aggregation. */
--+ if (!implicit && found_missing_braces && warn_missing_braces
--+ && !constructor_zeroinit)
--+ {
--+ warning_init (OPT_Wmissing_braces,
--+ "missing braces around initializer");
--+ }
--+
-- /* Warn when some struct elements are implicitly initialized to zero. */
-- if (warn_missing_field_initializers
-- && constructor_type
-- && TREE_CODE (constructor_type) == RECORD_TYPE
-- && constructor_unfilled_fields)
-- {
--- bool constructor_zeroinit =
--- (vec_safe_length (constructor_elements) == 1
--- && integer_zerop ((*constructor_elements)[0].value));
---
-- /* Do not warn for flexible array members or zero-length arrays. */
-- while (constructor_unfilled_fields
-- && (!DECL_SIZE (constructor_unfilled_fields)
--@@ -8077,6 +8085,9 @@ process_init_element (struct c_expr valu
-- designator_depth = 0;
-- designator_erroneous = 0;
--
--+ if (!implicit && value.value && !integer_zerop (value.value))
--+ constructor_zeroinit = 0;
--+
-- /* Handle superfluous braces around string cst as in
-- char x[] = {"foo"}; */
-- if (string_flag
+++ /dev/null
----- a/include/filenames.h
--+++ b/include/filenames.h
--@@ -43,11 +43,6 @@ extern "C" {
-- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
-- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
-- #else /* not DOSish */
---# if defined(__APPLE__)
---# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
---# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
---# endif
---# endif /* __APPLE__ */
-- # define HAS_DRIVE_SPEC(f) (0)
-- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
-- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+++ /dev/null
----- a/gcc/Makefile.in
--+++ b/gcc/Makefile.in
--@@ -4327,18 +4327,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
-- doc/gccint.info: $(TEXI_GCCINT_FILES)
-- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
--
---doc/%.info: %.texi
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/%.info:
--
-- # Duplicate entry to handle renaming of gccinstall.info
---doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/gccinstall.info:
--
-- doc/cpp.dvi: $(TEXI_CPP_FILES)
-- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
----- a/gcc/calls.c
--+++ b/gcc/calls.c
--@@ -176,6 +176,12 @@ prepare_call_address (tree fndecl, rtx f
-- && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
-- ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
-- : memory_address (FUNCTION_MODE, funexp));
--+ else if (flag_pic && !flag_plt && fndecl
--+ && TREE_CODE (fndecl) == FUNCTION_DECL
--+ && !targetm.binds_local_p (fndecl))
--+ {
--+ funexp = force_reg (Pmode, funexp);
--+ }
-- else if (! sibcallp)
-- {
-- #ifndef NO_FUNCTION_CSE
----- a/gcc/common.opt
--+++ b/gcc/common.opt
--@@ -1617,6 +1617,10 @@ fpie
-- Common Report Var(flag_pie,1) Negative(fPIC)
-- Generate position-independent code for executables if possible (small mode)
--
--+fplt
--+Common Report Var(flag_plt) Init(1)
--+Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
--+
-- fplugin=
-- Common Joined RejectNegative Var(common_deferred_options) Defer
-- Specify a plugin to load
+++ /dev/null
----- a/contrib/regression/objs-gcc.sh
--+++ b/contrib/regression/objs-gcc.sh
--@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
-- then
-- make all-gdb all-dejagnu all-ld || exit 1
-- make install-gdb install-dejagnu install-ld || exit 1
--+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
--+ then
--+ make all-gdb all-dejagnu all-ld || exit 1
--+ make install-gdb install-dejagnu install-ld || exit 1
-- elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
-- make bootstrap || exit 1
-- make install || exit 1
----- a/libjava/classpath/ltconfig
--+++ b/libjava/classpath/ltconfig
--@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
--
-- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
-- case $host_os in
---linux-gnu*) ;;
--+linux-gnu*|linux-uclibc*) ;;
-- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-- esac
--
--@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
-- ;;
--
-- # This must be Linux ELF.
---linux-gnu*)
--+linux*)
-- version_type=linux
-- need_lib_prefix=no
-- need_version=no
+++ /dev/null
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -559,7 +559,7 @@ case ${target} in
-- esac
--
-- # Common C libraries.
---tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
--+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
--
-- # Common parts for widely ported systems.
-- case ${target} in
--@@ -662,6 +662,9 @@ case ${target} in
-- *-*-*uclibc*)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
-- ;;
--+ *-*-*musl*)
--+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
--+ ;;
-- *)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
-- ;;
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
-- #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
-- #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
-- #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
--+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
-- #else
-- #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
-- #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
-- #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
--+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
-- #endif
--
-- #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
--@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
--
---#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
--- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
--+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
--+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
--
-- #if DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
-- #elif DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
-- #elif DEFAULT_LIBC == LIBC_BIONIC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif /* DEFAULT_LIBC */
--@@ -84,21 +89,21 @@ see the files COPYING3 and COPYING.RUNTI
--
-- #define GNU_USER_DYNAMIC_LINKER \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
--- BIONIC_DYNAMIC_LINKER)
--+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
-- #define GNU_USER_DYNAMIC_LINKER32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
--- BIONIC_DYNAMIC_LINKER32)
--+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
-- #define GNU_USER_DYNAMIC_LINKER64 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
--- BIONIC_DYNAMIC_LINKER64)
--+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
-- #define GNU_USER_DYNAMIC_LINKERX32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
--- BIONIC_DYNAMIC_LINKERX32)
--+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
--
-- /* Determine whether the entire c99 runtime
-- is present in the runtime library. */
-- #undef TARGET_C99_FUNCTIONS
---#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
--+#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
--
-- /* Whether we have sincos that follows the GNU extension. */
-- #undef TARGET_HAS_SINCOS
--@@ -107,3 +112,74 @@ see the files COPYING3 and COPYING.RUNTI
-- /* Whether we have Bionic libc runtime */
-- #undef TARGET_HAS_BIONIC
-- #define TARGET_HAS_BIONIC (OPTION_BIONIC)
--+
--+/* musl avoids problematic includes by rearranging the include directories.
--+ * Unfortunately, this is mostly duplicated from cppdefault.c */
--+#if DEFAULT_LIBC == LIBC_MUSL
--+#define INCLUDE_DEFAULTS_MUSL_GPP \
--+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
--+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
--+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
--+
--+#ifdef LOCAL_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
--+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
--+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_LOCAL
--+#endif
--+
--+#ifdef PREFIX_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
--+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_PREFIX
--+#endif
--+
--+#ifdef CROSS_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_CROSS \
--+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_CROSS
--+#endif
--+
--+#ifdef TOOL_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_TOOL \
--+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_TOOL
--+#endif
--+
--+#ifdef NATIVE_SYSTEM_HEADER_DIR
--+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
--+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
--+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_NATIVE
--+#endif
--+
--+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
--+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
--+# define INCLUDE_DEFAULTS_MUSL_LOCAL
--+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
--+# define INCLUDE_DEFAULTS_MUSL_NATIVE
--+#else
--+# undef INCLUDE_DEFAULTS_MUSL_CROSS
--+# define INCLUDE_DEFAULTS_MUSL_CROSS
--+#endif
--+
--+#undef INCLUDE_DEFAULTS
--+#define INCLUDE_DEFAULTS \
--+ { \
--+ INCLUDE_DEFAULTS_MUSL_GPP \
--+ INCLUDE_DEFAULTS_MUSL_PREFIX \
--+ INCLUDE_DEFAULTS_MUSL_CROSS \
--+ INCLUDE_DEFAULTS_MUSL_TOOL \
--+ INCLUDE_DEFAULTS_MUSL_NATIVE \
--+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
--+ { 0, 0, 0, 0, 0, 0 } \
--+ }
--+#endif
----- a/gcc/config/linux.opt
--+++ b/gcc/config/linux.opt
--@@ -30,3 +30,7 @@ Use GNU C library
-- muclibc
-- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
-- Use uClibc C library
--+
--+mmusl
--+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
--+Use musl C library
----- a/gcc/ginclude/stddef.h
--+++ b/gcc/ginclude/stddef.h
--@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #ifndef _GCC_SIZE_T
-- #ifndef _SIZET_
-- #ifndef __size_t
--+#ifndef __DEFINED_size_t /* musl */
-- #define __size_t__ /* BeOS */
-- #define __SIZE_T__ /* Cray Unicos/Mk */
-- #define _SIZE_T
--@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #define ___int_size_t_h
-- #define _GCC_SIZE_T
-- #define _SIZET_
--+#define __DEFINED_size_t /* musl */
-- #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
-- || defined(__FreeBSD_kernel__)
-- /* __size_t is a typedef on FreeBSD 5, must not trash it. */
--@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
-- typedef long ssize_t;
-- #endif /* __BEOS__ */
-- #endif /* !(defined (__GNUG__) && defined (size_t)) */
--+#endif /* __DEFINED_size_t */
-- #endif /* __size_t */
-- #endif /* _SIZET_ */
-- #endif /* _GCC_SIZE_T */
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -77,6 +77,23 @@
-- %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
-- %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
--
--+/* For ARM musl currently supports four dynamic linkers:
--+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
--+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
--+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
--+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
--+ musl does not support the legacy OABI mode.
--+ All the dynamic linkers live in /lib.
--+ We default to soft-float, EL. */
--+#undef MUSL_DYNAMIC_LINKER
--+#if TARGET_BIG_ENDIAN_DEFAULT
--+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
--+#endif
--+#define MUSL_DYNAMIC_LINKER \
--+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
----- a/libitm/config/arm/hwcap.cc
--+++ b/libitm/config/arm/hwcap.cc
--@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
--
-- #ifdef __linux__
-- #include <unistd.h>
--+#ifdef __GLIBC__
-- #include <sys/fcntl.h>
--+#else
--+#include <fcntl.h>
--+#endif
-- #include <elf.h>
--
-- static void __attribute__((constructor))
+++ /dev/null
----- a/gcc/config/mips/linux.h
--+++ b/gcc/config/mips/linux.h
--@@ -18,3 +18,10 @@ along with GCC; see the file COPYING3.
-- <http://www.gnu.org/licenses/>. */
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
--+
--+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
--+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
--+#endif
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
+++ /dev/null
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -2122,6 +2122,10 @@ powerpc*-*-linux*)
-- powerpc*-*-linux*paired*)
-- tm_file="${tm_file} rs6000/750cl.h" ;;
-- esac
--+ case ${target} in
--+ *-linux*-musl*)
--+ enable_secureplt=yes ;;
--+ esac
-- if test x${enable_secureplt} = xyes; then
-- tm_file="rs6000/secureplt.h ${tm_file}"
-- fi
----- a/gcc/config/rs6000/linux64.h
--+++ b/gcc/config/rs6000/linux64.h
--@@ -354,17 +354,21 @@ extern int dot_symbols;
-- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
-- #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-- #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
-- #if DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
-- #elif DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif
-- #define GNU_USER_DYNAMIC_LINKER32 \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
-- #define GNU_USER_DYNAMIC_LINKER64 \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
--
-- #undef DEFAULT_ASM_ENDIAN
-- #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
----- a/gcc/config/rs6000/secureplt.h
--+++ b/gcc/config/rs6000/secureplt.h
--@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
-- <http://www.gnu.org/licenses/>. */
--
-- #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
--+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
----- a/gcc/config/rs6000/sysv4.h
--+++ b/gcc/config/rs6000/sysv4.h
--@@ -550,6 +550,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
-- #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
-- #define CC1_SECURE_PLT_DEFAULT_SPEC ""
-- #endif
--+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
--+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
--+#endif
--
-- /* Pass -G xxx to the compiler and set correct endian mode. */
-- #define CC1_SPEC "%{G*} %(cc1_cpu)" \
--@@ -600,7 +603,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
--
-- /* Override the default target of the linker. */
-- #define LINK_TARGET_SPEC \
--- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
--+ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
--+ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
--
-- /* Any specific OS flags. */
-- #define LINK_OS_SPEC "\
--@@ -778,15 +782,18 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-- #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
-- #if DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
-- #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif
-- #define GNU_USER_DYNAMIC_LINKER \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
--
-- #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
-- %{rdynamic:-export-dynamic} \
--@@ -912,6 +919,7 @@ ncrtn.o%s"
-- { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
-- { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
-- { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
--+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
-- { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
-- { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
-- { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
+++ /dev/null
----- a/gcc/config/sh/linux.h
--+++ b/gcc/config/sh/linux.h
--@@ -43,7 +43,14 @@ along with GCC; see the file COPYING3.
--
-- #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--
--+#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
--+#define MUSL_DYNAMIC_LINKER_E "eb"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E
--+#endif
--+
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
--
-- #undef SUBTARGET_LINK_EMUL_SUFFIX
-- #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+++ /dev/null
----- a/gcc/config/i386/linux.h
--+++ b/gcc/config/i386/linux.h
--@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
--
-- #define GNU_USER_LINK_EMULATION "elf_i386"
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
----- a/gcc/config/i386/linux64.h
--+++ b/gcc/config/i386/linux64.h
--@@ -30,3 +30,7 @@ see the files COPYING3 and COPYING.RUNTI
-- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-- #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
--+
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
--+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
----- a/libitm/config/linux/x86/tls.h
--+++ b/libitm/config/linux/x86/tls.h
--@@ -25,16 +25,19 @@
-- #ifndef LIBITM_X86_TLS_H
-- #define LIBITM_X86_TLS_H 1
--
---#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
--+#if defined(__GLIBC_PREREQ)
--+#if __GLIBC_PREREQ(2, 10)
-- /* Use slots in the TCB head rather than __thread lookups.
-- GLIBC has reserved words 10 through 13 for TM. */
-- #define HAVE_ARCH_GTM_THREAD 1
-- #define HAVE_ARCH_GTM_THREAD_DISP 1
-- #endif
--+#endif
--
-- #include "config/generic/tls.h"
--
---#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
--+#if defined(__GLIBC_PREREQ)
--+#if __GLIBC_PREREQ(2, 10)
-- namespace GTM HIDDEN {
--
-- #ifdef __x86_64__
--@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
--
-- } // namespace GTM
-- #endif /* >= GLIBC 2.10 */
--+#endif
--
-- #endif // LIBITM_X86_TLS_H
+++ /dev/null
----- a/gcc/config/aarch64/aarch64-linux.h
--+++ b/gcc/config/aarch64/aarch64-linux.h
--@@ -21,7 +21,11 @@
-- #ifndef GCC_AARCH64_LINUX_H
-- #define GCC_AARCH64_LINUX_H
--
--+/* The AArch64 port currently supports two dynamic linkers:
--+ - ld-linux-aarch64.so.1 - GLIBC dynamic linker
--+ - ld-musl-aarch64.so.1 - musl libc dynamic linker */
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
--
-- #define CPP_SPEC "%{pthread:-D_REENTRANT}"
--
+++ /dev/null
----- a/fixincludes/mkfixinc.sh
--+++ b/fixincludes/mkfixinc.sh
--@@ -19,7 +19,8 @@ case $machine in
-- powerpc-*-eabi* | \
-- powerpc-*-rtems* | \
-- powerpcle-*-eabisim* | \
--- powerpcle-*-eabi* )
--+ powerpcle-*-eabi* | \
--+ *-musl* )
-- # IF there is no include fixing,
-- # THEN create a no-op fixer and exit
-- (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
+++ /dev/null
----- a/libgomp/config/posix/time.c
--+++ b/libgomp/config/posix/time.c
--@@ -28,6 +28,8 @@
-- The following implementation uses the most simple POSIX routines.
-- If present, POSIX 4 clocks should be used instead. */
--
--+#define _POSIX_C_SOURCE 199309L /* for clocks */
--+
-- #include "libgomp.h"
-- #include <unistd.h>
-- #if TIME_WITH_SYS_TIME
+++ /dev/null
----- a/libstdc++-v3/configure.host
--+++ b/libstdc++-v3/configure.host
--@@ -264,6 +264,13 @@ case "${host_os}" in
-- os_include_dir="os/bsd/freebsd"
-- ;;
-- gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
--+ # check for musl by target
--+ case "${host_os}" in
--+ *-musl*)
--+ os_include_dir="os/generic"
--+ ;;
--+ *)
--+
-- if [ "$uclibc" = "yes" ]; then
-- os_include_dir="os/uclibc"
-- elif [ "$bionic" = "yes" ]; then
--@@ -272,6 +279,9 @@ case "${host_os}" in
-- os_include_dir="os/gnu-linux"
-- fi
-- ;;
--+
--+ esac
--+ ;;
-- hpux*)
-- os_include_dir="os/hpux"
-- ;;
+++ /dev/null
----- a/libsanitizer/interception/interception_type_test.cc
--+++ b/libsanitizer/interception/interception_type_test.cc
--@@ -31,7 +31,7 @@ COMPILER_CHECK(sizeof(OFF64_T) == sizeof
-- // rest (they depend on _FILE_OFFSET_BITS setting when building an application).
-- # if defined(__ANDROID__) || !defined _FILE_OFFSET_BITS || \
-- _FILE_OFFSET_BITS != 64
---COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
--+// COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
-- # endif
--
-- #endif
+++ /dev/null
----- a/gcc/config/mips/linux.h
--+++ b/gcc/config/mips/linux.h
--@@ -24,4 +24,4 @@ along with GCC; see the file COPYING3.
-- #else
-- #define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
-- #endif
---#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+++ /dev/null
--Index: gcc-linaro-4.8-2014.04/gcc/config/mips/linux64.h
--===================================================================
----- gcc-linaro-4.8-2014.04.orig/gcc/config/mips/linux64.h 2014-10-23 15:52:48.999134219 -0700
--+++ gcc-linaro-4.8-2014.04/gcc/config/mips/linux64.h 2014-10-23 15:59:19.815116979 -0700
--@@ -27,6 +27,16 @@
-- #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
-- #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
-- #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
--+
--+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
--+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
--+#endif
--+
--+#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-- #define GNU_USER_DYNAMIC_LINKERN32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
--- BIONIC_DYNAMIC_LINKERN32)
--+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+++ /dev/null
----- a/gcc/config/arm/arm.h
--+++ b/gcc/config/arm/arm.h
--@@ -277,7 +277,7 @@ extern void (*arm_lang_output_object_att
-- /* Thumb-1 only. */
-- #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
--
---#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
--+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
-- && !TARGET_THUMB1)
--
-- #define TARGET_CRC32 (arm_arch_crc)
+++ /dev/null
----- a/libgcc/config/arm/t-linux
--+++ b/libgcc/config/arm/t-linux
--@@ -1,6 +1,10 @@
-- LIB1ASMSRC = arm/lib1funcs.S
-- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
--- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
--+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
--+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
--+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
--+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
--+ _arm_fixsfsi _arm_fixunssfsi
--
-- # Just for these, we omit the frame pointer since it makes such a big
-- # difference.
----- a/gcc/config/arm/linux-elf.h
--+++ b/gcc/config/arm/linux-elf.h
--@@ -55,8 +55,6 @@
-- %{shared:-lc} \
-- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
--
---#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
---
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--
-- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
----- a/libgcc/Makefile.in
--+++ b/libgcc/Makefile.in
--@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
--
-- # Static libraries.
-- libgcc.a: $(libgcc-objects)
--+libgcc_pic.a: $(libgcc-s-objects)
-- libgcov.a: $(libgcov-objects)
-- libunwind.a: $(libunwind-objects)
-- libgcc_eh.a: $(libgcc-eh-objects)
--
---libgcc.a libgcov.a libunwind.a libgcc_eh.a:
--+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-- -rm -f $@
--
-- objects="$(objects)"; \
--@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
-- endif
--
-- ifeq ($(enable_shared),yes)
---all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
--+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
-- ifneq ($(LIBUNWIND),)
-- all: libunwind$(SHLIB_EXT)
-- endif
--@@ -1058,6 +1059,10 @@ install-shared:
-- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
--
--+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
--+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+
-- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
-- @shlib_base_name@,libgcc_s,$(subst \
-- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
--http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
--
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -45,7 +45,7 @@
-- The ARM10TDMI core is the default for armv5t, so set
-- SUBTARGET_CPU_DEFAULT to achieve this. */
-- #undef SUBTARGET_CPU_DEFAULT
---#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
--+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
--
-- /* TARGET_BIG_ENDIAN_DEFAULT is set in
-- config.gcc for big endian configurations. */
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -94,10 +94,15 @@
-- #define MUSL_DYNAMIC_LINKER \
-- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
--
--+/* For armv4 we pass --fix-v4bx to linker to support EABI */
--+#undef TARGET_FIX_V4BX_SPEC
--+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
--+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
---#define LINK_SPEC BE8_LINK_SPEC \
--+#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
-- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
-- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
--
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -131,10 +131,6 @@
-- #define ENDFILE_SPEC \
-- LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
--
---/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
--- do not use -lfloat. */
---#undef LIBGCC_SPEC
---
-- /* Clear the instruction cache from `beg' to `end'. This is
-- implemented in lib1funcs.S, so ensure an error if this definition
-- is used. */
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
-- builtin_assert ("system=posix"); \
-- } while (0)
--
--+#ifndef LIBGCC_SPEC
--+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
--+#endif
--+
-- /* Determine which dynamic linker to use depending on whether GLIBC or
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
----- a/libgcc/mkmap-symver.awk
--+++ b/libgcc/mkmap-symver.awk
--@@ -132,5 +132,5 @@ function output(lib) {
-- else if (inherit[lib])
-- printf("} %s;\n", inherit[lib]);
-- else
--- printf ("\n local:\n\t*;\n};\n");
--+ printf ("\n\t*;\n};\n");
-- }
----- a/gcc/config/rs6000/linux.h
--+++ b/gcc/config/rs6000/linux.h
--@@ -61,6 +61,9 @@
-- #undef CPLUSPLUS_CPP_SPEC
-- #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
--
--+#undef LIBGCC_SPEC
--+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
--+
-- #undef LINK_SHLIB_SPEC
-- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
--
+++ /dev/null
----- a/libgcc/config/t-libunwind
--+++ b/libgcc/config/t-libunwind
--@@ -2,8 +2,7 @@
--
-- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
--
---LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
--- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
--+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
--
-- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+++ /dev/null
----- a/libgcc/unwind-dw2-fde-dip.c
--+++ b/libgcc/unwind-dw2-fde-dip.c
--@@ -46,33 +46,13 @@
-- #include "unwind-compat.h"
-- #include "gthr.h"
--
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__BIONIC__)
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__FreeBSD__) && __FreeBSD__ >= 7
---# define ElfW __ElfN
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__OpenBSD__)
---# define ElfW(type) Elf_##type
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(TARGET_DL_ITERATE_PHDR) \
--- && defined(__sun__) && defined(__svr4__)
--+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
-- # define USE_PT_GNU_EH_FRAME
--+# ifdef __OpenBSD__
--+# define ElfW(type) Elf_##type
--+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
--+# define ElfW __ElfN
--+# endif
-- #endif
--
-- #if defined(USE_PT_GNU_EH_FRAME)
+++ /dev/null
----- a/gcc/config/rs6000/rs6000.c
--+++ b/gcc/config/rs6000/rs6000.c
--@@ -17662,7 +17662,7 @@ rs6000_savres_strategy (rs6000_stack_t *
-- /* Define cutoff for using out-of-line functions to save registers. */
-- if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
-- {
--- if (!optimize_size)
--+ if (1)
-- {
-- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
-- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+++ /dev/null
----- a/gcc/defaults.h
--+++ b/gcc/defaults.h
--@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
-- /* If we have named section and we support weak symbols, then use the
-- .jcr section for recording java classes which need to be registered
-- at program start-up time. */
---#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
--+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
-- #ifndef JCR_SECTION_NAME
-- #define JCR_SECTION_NAME ".jcr"
-- #endif
+++ /dev/null
----- a/libgcc/config/mips/t-mips16
--+++ b/libgcc/config/mips/t-mips16
--@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
--
-- # Version these symbols if building libgcc.so.
-- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
--+
--+CRTSTUFF_T_CFLAGS += -mno-mips16
--+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
--
-- This patch brings over a few features from MirBSD:
-- * -fhonour-copts
-- If this option is not given, it's warned (depending
-- on environment variables). This is to catch errors
-- of misbuilt packages which override CFLAGS themselves.
-- * -Werror-maybe-reset
-- Has the effect of -Wno-error if GCC_NO_WERROR is
-- set and not '0', a no-operation otherwise. This is
-- to be able to use -Werror in "make" but prevent
-- GNU autoconf generated configure scripts from
-- freaking out.
-- * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
-- the default for -O2/-Os, because they trigger gcc bugs
-- and can delete code with security implications.
--
-- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
-- with copyright assignment to the FSF in effect.
--
----- a/gcc/c-family/c-opts.c
--+++ b/gcc/c-family/c-opts.c
--@@ -104,6 +104,9 @@ static size_t include_cursor;
-- /* Whether any standard preincluded header has been preincluded. */
-- static bool done_preinclude;
--
--+/* Check if a port honours COPTS. */
--+static int honour_copts = 0;
--+
-- static void handle_OPT_d (const char *);
-- static void set_std_cxx98 (int);
-- static void set_std_cxx11 (int);
--@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
-- cpp_opts->warn_endif_labels = value;
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ break;
--+
-- case OPT_Winvalid_pch:
-- cpp_opts->warn_invalid_pch = value;
-- break;
--@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
-- flag_no_builtin = !value;
-- break;
--
--+ case OPT_fhonour_copts:
--+ if (c_language == clk_c) {
--+ honour_copts++;
--+ }
--+ break;
--+
-- case OPT_fconstant_string_class_:
-- constant_string_class_name = arg;
-- break;
--@@ -1027,6 +1039,47 @@ c_common_init (void)
-- return false;
-- }
--
--+ if (c_language == clk_c) {
--+ char *ev = getenv ("GCC_HONOUR_COPTS");
--+ int evv;
--+ if (ev == NULL)
--+ evv = -1;
--+ else if ((*ev == '0') || (*ev == '\0'))
--+ evv = 0;
--+ else if (*ev == '1')
--+ evv = 1;
--+ else if (*ev == '2')
--+ evv = 2;
--+ else if (*ev == 's')
--+ evv = -1;
--+ else {
--+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
--+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
--+ }
--+ if (evv == 1) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in lenient mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ warning (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ } else if (evv == 2) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in strict mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ error ("someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ return false;
--+ }
--+ } else if (evv == 0) {
--+ if (honour_copts != 1)
--+ inform (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ }
--+
-- return true;
-- }
--
----- a/gcc/c-family/c.opt
--+++ b/gcc/c-family/c.opt
--@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
-- C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
-- This switch is deprecated; use -Werror=implicit-function-declaration instead
--
--+Werror-maybe-reset
--+C ObjC C++ ObjC++
--+; Documented in common.opt
--+
-- Wfloat-equal
-- C ObjC C++ ObjC++ Var(warn_float_equal) Warning
-- Warn if testing floating point numbers for equality
--@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
-- fhonor-std
-- C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
--
--+fhonour-copts
--+C ObjC C++ ObjC++ RejectNegative
--+
-- fhosted
-- C ObjC
-- Assume normal C execution environment
----- a/gcc/common.opt
--+++ b/gcc/common.opt
--@@ -541,6 +541,10 @@ Werror=
-- Common Joined
-- Treat specified warning as error
--
--+Werror-maybe-reset
--+Common
--+If environment variable GCC_NO_WERROR is set, act as -Wno-error
--+
-- Wextra
-- Common Var(extra_warnings) Warning
-- Print extra (possibly unwanted) warnings
--@@ -1242,6 +1246,9 @@ fguess-branch-probability
-- Common Report Var(flag_guess_branch_prob) Optimization
-- Enable guessing of branch probabilities
--
--+fhonour-copts
--+Common RejectNegative
--+
-- ; Nonzero means ignore `#ident' directives. 0 means handle them.
-- ; Generate position-independent code for executables if possible
-- ; On SVR4 targets, it also controls whether or not to emit a
----- a/gcc/opts.c
--+++ b/gcc/opts.c
--@@ -468,8 +468,6 @@ static const struct default_options defa
-- { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
-- #endif
-- { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
--- { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
--- { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
--@@ -489,6 +487,8 @@ static const struct default_options defa
-- { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
--
-- /* -O3 optimizations. */
--+ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
--+ { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
-- { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
-- { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
-- /* Inlining of functions reducing size is a good idea with -Os
--@@ -1435,6 +1435,17 @@ common_handle_option (struct gcc_options
-- opts, opts_set, loc, dc);
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ {
--+ char *ev = getenv ("GCC_NO_WERROR");
--+ if ((ev != NULL) && (*ev != '0'))
--+ warnings_are_errors = 0;
--+ }
--+ break;
--+
--+ case OPT_fhonour_copts:
--+ break;
--+
-- case OPT_Wlarger_than_:
-- opts->x_larger_than_size = value;
-- opts->x_warn_larger_than = value != -1;
----- a/gcc/doc/cppopts.texi
--+++ b/gcc/doc/cppopts.texi
--@@ -163,6 +163,11 @@ in older programs. This warning is on b
-- Make all warnings into hard errors. Source code which triggers warnings
-- will be rejected.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
-- @item -Wsystem-headers
-- @opindex Wsystem-headers
-- Issue warnings for code in system headers. These are normally unhelpful
----- a/gcc/doc/invoke.texi
--+++ b/gcc/doc/invoke.texi
--@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
-- -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
-- -Wno-deprecated-declarations -Wdisabled-optimization @gol
-- -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
----Wno-endif-labels -Werror -Werror=* @gol
--+-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
-- -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-- -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-- -Wformat-security -Wformat-y2k @gol
--@@ -4817,6 +4817,22 @@ This option is only supported for C and
-- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
-- @option{-Wno-pointer-sign}.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
--+ at item -fhonour-copts
--+ at opindex fhonour-copts
--+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
--+given at least once, and warn if it is given more than once.
--+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
--+given exactly once.
--+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
--+is not given exactly once.
--+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
--+This flag and environment variable only affect the C language.
--+
-- @item -Wstack-protector
-- @opindex Wstack-protector
-- @opindex Wno-stack-protector
--@@ -6928,7 +6944,7 @@ so, the first branch is redirected to ei
-- second branch or a point immediately following it, depending on whether
-- the condition is known to be true or false.
--
---Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
--+Enabled at levels @option{-O3}.
--
-- @item -fsplit-wide-types
-- @opindex fsplit-wide-types
----- a/gcc/java/jvspec.c
--+++ b/gcc/java/jvspec.c
--@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
-- class name. Append dummy `.c' that can be stripped by set_input so %b
-- is correct. */
-- set_input (concat (main_class_name, "main.c", NULL));
--+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
-- err = do_spec (jvgenmain_spec);
-- if (err == 0)
-- {
+++ /dev/null
----- a/gcc/gcc.c
--+++ b/gcc/gcc.c
--@@ -8029,7 +8029,10 @@ getenv_spec_function (int argc, const ch
--
-- value = getenv (argv[0]);
-- if (!value)
--- fatal_error ("environment variable %qs not defined", argv[0]);
--+ {
--+ warning (0, "environment variable %qs not defined", argv[0]);
--+ value = "";
--+ }
--
-- /* We have to escape every character of the environment variable so
-- they are not interpreted as active spec characters. A
+++ /dev/null
--From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
--From: Andrew McDonnell <bugs@andrewmcdonnell.net>
--Date: Fri, 3 Oct 2014 19:09:00 +0930
--Subject: Add .note.GNU-stack section
--
--See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
--Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
--
--Re: [Patch, MIPS] Add .note.GNU-stack section
--
-- From: Steve Ellcey <sellcey at mips dot com>
--
--On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
-->
-->
--> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
--
--> This works except you did not update the assembly files in
--> libgcc or glibc. We (Cavium) have the same patch in our tree
--> for a few released versions.
--
--> Mind just checking yours in then Andrew?
--
--> Thanks!
--> -eric
--
--I talked to Andrew about what files he changed in GCC and created and
--tested this new patch. Andrew also mentioned changing some assembly
--files in glibc but I don't see any use of '.section .note.GNU-stack' in
--any assembly files in glibc (for any platform) so I wasn't planning on
--creating a glibc to add them to mips glibc assembly language files.
--
--OK to check in this patch?
--
--Steve Ellcey
--sellcey@mips.com
--
--
--
--2014-09-26 Steve Ellcey <sellcey@mips.com>
-----
-- gcc/config/mips/mips.c | 3 +++
-- libgcc/config/mips/crti.S | 4 ++++
-- libgcc/config/mips/crtn.S | 3 +++
-- libgcc/config/mips/mips16.S | 4 ++++
-- libgcc/config/mips/vr4120-div.S | 4 ++++
-- 5 files changed, 18 insertions(+)
--
----- a/gcc/config/mips/mips.c
--+++ b/gcc/config/mips/mips.c
--@@ -18223,6 +18223,9 @@ mips_expand_vec_minmax (rtx target, rtx
-- #undef TARGET_VECTORIZE_VEC_PERM_CONST_OK
-- #define TARGET_VECTORIZE_VEC_PERM_CONST_OK mips_vectorize_vec_perm_const_ok
--
--+#undef TARGET_ASM_FILE_END
--+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--+
-- struct gcc_target targetm = TARGET_INITIALIZER;
-- \f
-- #include "gt-mips.h"
----- a/libgcc/config/mips/crti.S
--+++ b/libgcc/config/mips/crti.S
--@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-- <http://www.gnu.org/licenses/>. */
--
--+
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+
-- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
-- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--
----- a/libgcc/config/mips/crtn.S
--+++ b/libgcc/config/mips/crtn.S
--@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-- <http://www.gnu.org/licenses/>. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+
-- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
-- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--
----- a/libgcc/config/mips/mips16.S
--+++ b/libgcc/config/mips/mips16.S
--@@ -27,6 +27,10 @@ see the files COPYING3 and COPYING.RUNTI
-- values using the soft-float calling convention, but do the actual
-- operation using the hard floating point instructions. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+ .previous
--+
-- #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
--
-- /* This file contains 32-bit assembly code. */
----- a/libgcc/config/mips/vr4120-div.S
--+++ b/libgcc/config/mips/vr4120-div.S
--@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
-- -mfix-vr4120. div and ddiv do not give the correct result when one
-- of the operands is negative. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+ .previous
--+
-- .set nomips16
--
-- #define DIV \
+++ /dev/null
----- a/libstdc++-v3/include/Makefile.in
--+++ b/libstdc++-v3/include/Makefile.in
--@@ -1342,7 +1342,7 @@
-- @$(STAMP) stamp-bits
--
-- stamp-bits-sup: stamp-bits ${bits_sup_headers}
--- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
--+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
-- @$(STAMP) stamp-bits-sup
--
-- stamp-c_base: ${c_base_headers}
+++ /dev/null
--https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58595
--
----- /dev/null
--+++ b/gcc/testsuite/gcc.dg/tls/pr58595.c
--@@ -0,0 +1,28 @@
--+/* PR target/58595 */
--+/* { dg-do run } */
--+/* { dg-options "-O2" } */
--+/* { dg-additional-options "-fpic" { target fpic } } */
--+/* { dg-require-effective-target tls } */
--+/* { dg-require-effective-target sync_int_long } */
--+
--+struct S { unsigned long a, b; };
--+__thread struct S s;
--+void bar (unsigned long *);
--+
--+__attribute__((noinline)) void
--+foo (void)
--+{
--+ int i;
--+ for (i = 0; i < 10; i++)
--+ __sync_fetch_and_add (&s.b, 1L);
--+}
--+
--+int
--+main ()
--+{
--+ s.b = 12;
--+ foo ();
--+ if (s.b != 22)
--+ __builtin_abort ();
--+ return 0;
--+}
----- a/gcc/config/arm/arm.c
--+++ b/gcc/config/arm/arm.c
--@@ -231,7 +231,6 @@ static tree arm_gimplify_va_arg_expr (tr
-- static void arm_option_override (void);
-- static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
-- static bool arm_cannot_copy_insn_p (rtx);
---static bool arm_tls_symbol_p (rtx x);
-- static int arm_issue_rate (void);
-- static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
-- static bool arm_output_addr_const_extra (FILE *, rtx);
--@@ -6665,6 +6664,32 @@ legitimize_tls_address (rtx x, rtx reg)
-- rtx
-- arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
-- {
--+ if (arm_tls_referenced_p (x))
--+ {
--+ rtx addend = NULL;
--+
--+ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
--+ {
--+ addend = XEXP (XEXP (x, 0), 1);
--+ x = XEXP (XEXP (x, 0), 0);
--+ }
--+
--+ if (GET_CODE (x) != SYMBOL_REF)
--+ return x;
--+
--+ gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0);
--+
--+ x = legitimize_tls_address (x, NULL_RTX);
--+
--+ if (addend)
--+ {
--+ x = gen_rtx_PLUS (SImode, x, addend);
--+ orig_x = x;
--+ }
--+ else
--+ return x;
--+ }
--+
-- if (!TARGET_ARM)
-- {
-- /* TODO: legitimize_address for Thumb2. */
--@@ -6673,9 +6698,6 @@ arm_legitimize_address (rtx x, rtx orig_
-- return thumb_legitimize_address (x, orig_x, mode);
-- }
--
--- if (arm_tls_symbol_p (x))
--- return legitimize_tls_address (x, NULL_RTX);
---
-- if (GET_CODE (x) == PLUS)
-- {
-- rtx xop0 = XEXP (x, 0);
--@@ -6787,9 +6809,6 @@ arm_legitimize_address (rtx x, rtx orig_
-- rtx
-- thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
-- {
--- if (arm_tls_symbol_p (x))
--- return legitimize_tls_address (x, NULL_RTX);
---
-- if (GET_CODE (x) == PLUS
-- && CONST_INT_P (XEXP (x, 1))
-- && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode)
--@@ -7080,20 +7099,6 @@ thumb_legitimize_reload_address (rtx *x_
--
-- /* Test for various thread-local symbols. */
--
---/* Return TRUE if X is a thread-local symbol. */
---
---static bool
---arm_tls_symbol_p (rtx x)
---{
--- if (! TARGET_HAVE_TLS)
--- return false;
---
--- if (GET_CODE (x) != SYMBOL_REF)
--- return false;
---
--- return SYMBOL_REF_TLS_MODEL (x) != 0;
---}
---
-- /* Helper for arm_tls_referenced_p. */
--
-- static int
+++ /dev/null
--Revert of:
--
--commit 275035b56823b26d5fb7e90fad945b998648edf2
--Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
--Date: Thu Sep 5 14:09:07 2013 +0000
--
-- PR target/58139
-- * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
-- looking for widest mode.
--
--
-- git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
--
--
----- a/gcc/reginfo.c
--+++ b/gcc/reginfo.c
--@@ -621,35 +621,40 @@ choose_hard_reg_mode (unsigned int regno
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
--+ if (found_mode != VOIDmode)
--+ return found_mode;
--+
-- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
-- mode != VOIDmode;
-- mode = GET_MODE_WIDER_MODE (mode))
-- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-- && HARD_REGNO_MODE_OK (regno, mode)
--- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
--- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
--+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
-- found_mode = mode;
--
-- if (found_mode != VOIDmode)
+++ /dev/null
----- a/include/filenames.h
--+++ b/include/filenames.h
--@@ -43,11 +43,6 @@ extern "C" {
-- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
-- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
-- #else /* not DOSish */
---# if defined(__APPLE__)
---# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
---# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
---# endif
---# endif /* __APPLE__ */
-- # define HAS_DRIVE_SPEC(f) (0)
-- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
-- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+++ /dev/null
----- a/gcc/Makefile.in
--+++ b/gcc/Makefile.in
--@@ -2847,18 +2847,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
-- doc/gccint.info: $(TEXI_GCCINT_FILES)
-- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
--
---doc/%.info: %.texi
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/%.info:
--
-- # Duplicate entry to handle renaming of gccinstall.info
---doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
--- if [ x$(BUILD_INFO) = xinfo ]; then \
--- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
--- -I $(gcc_docdir)/include -o $@ $<; \
--- fi
--+doc/gccinstall.info:
--
-- doc/cpp.dvi: $(TEXI_CPP_FILES)
-- doc/gcc.dvi: $(TEXI_GCC_FILES)
+++ /dev/null
----- a/gcc/calls.c
--+++ b/gcc/calls.c
--@@ -184,6 +184,12 @@ prepare_call_address (tree fndecl, rtx f
-- && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
-- ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
-- : memory_address (FUNCTION_MODE, funexp));
--+ else if (flag_pic && !flag_plt && fndecl
--+ && TREE_CODE (fndecl) == FUNCTION_DECL
--+ && !targetm.binds_local_p (fndecl))
--+ {
--+ funexp = force_reg (Pmode, funexp);
--+ }
-- else if (! sibcallp)
-- {
-- #ifndef NO_FUNCTION_CSE
----- a/gcc/common.opt
--+++ b/gcc/common.opt
--@@ -1659,6 +1659,10 @@ fpie
-- Common Report Var(flag_pie,1) Negative(fPIC)
-- Generate position-independent code for executables if possible (small mode)
--
--+fplt
--+Common Report Var(flag_plt) Init(1)
--+Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
--+
-- fplugin=
-- Common Joined RejectNegative Var(common_deferred_options) Defer
-- Specify a plugin to load
+++ /dev/null
----- a/contrib/regression/objs-gcc.sh
--+++ b/contrib/regression/objs-gcc.sh
--@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
-- then
-- make all-gdb all-dejagnu all-ld || exit 1
-- make install-gdb install-dejagnu install-ld || exit 1
--+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
--+ then
--+ make all-gdb all-dejagnu all-ld || exit 1
--+ make install-gdb install-dejagnu install-ld || exit 1
-- elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
-- make bootstrap || exit 1
-- make install || exit 1
----- a/libjava/classpath/ltconfig
--+++ b/libjava/classpath/ltconfig
--@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
--
-- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
-- case $host_os in
---linux-gnu*) ;;
--+linux-gnu*|linux-uclibc*) ;;
-- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-- esac
--
--@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
-- ;;
--
-- # This must be Linux ELF.
---linux-gnu*)
--+linux*)
-- version_type=linux
-- need_lib_prefix=no
-- need_version=no
+++ /dev/null
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -595,7 +595,7 @@ case ${target} in
-- esac
--
-- # Common C libraries.
---tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
--+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
--
-- # 32-bit x86 processors supported by --with-arch=. Each processor
-- # MUST be separated by exactly one space.
--@@ -720,6 +720,9 @@ case ${target} in
-- *-*-*uclibc*)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
-- ;;
--+ *-*-*musl*)
--+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
--+ ;;
-- *)
-- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
-- ;;
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
-- #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
-- #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
-- #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
--+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
-- #else
-- #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
-- #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
-- #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
--+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
-- #endif
--
-- #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
--@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
--
---#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
--- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
--+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
--+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
--
-- #if DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
-- #elif DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
-- #elif DEFAULT_LIBC == LIBC_BIONIC
---#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
--- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
--+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif /* DEFAULT_LIBC */
--@@ -84,21 +89,92 @@ see the files COPYING3 and COPYING.RUNTI
--
-- #define GNU_USER_DYNAMIC_LINKER \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
--- BIONIC_DYNAMIC_LINKER)
--+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
-- #define GNU_USER_DYNAMIC_LINKER32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
--- BIONIC_DYNAMIC_LINKER32)
--+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
-- #define GNU_USER_DYNAMIC_LINKER64 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
--- BIONIC_DYNAMIC_LINKER64)
--+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
-- #define GNU_USER_DYNAMIC_LINKERX32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
--- BIONIC_DYNAMIC_LINKERX32)
--+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
--
-- /* Whether we have Bionic libc runtime */
-- #undef TARGET_HAS_BIONIC
-- #define TARGET_HAS_BIONIC (OPTION_BIONIC)
--
--+/* musl avoids problematic includes by rearranging the include directories.
--+ * Unfortunately, this is mostly duplicated from cppdefault.c */
--+#if DEFAULT_LIBC == LIBC_MUSL
--+#define INCLUDE_DEFAULTS_MUSL_GPP \
--+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
--+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
--+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
--+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
--+
--+#ifdef LOCAL_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
--+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
--+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_LOCAL
--+#endif
--+
--+#ifdef PREFIX_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
--+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_PREFIX
--+#endif
--+
--+#ifdef CROSS_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_CROSS \
--+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_CROSS
--+#endif
--+
--+#ifdef TOOL_INCLUDE_DIR
--+#define INCLUDE_DEFAULTS_MUSL_TOOL \
--+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_TOOL
--+#endif
--+
--+#ifdef NATIVE_SYSTEM_HEADER_DIR
--+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
--+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
--+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
--+#else
--+#define INCLUDE_DEFAULTS_MUSL_NATIVE
--+#endif
--+
--+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
--+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
--+# define INCLUDE_DEFAULTS_MUSL_LOCAL
--+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
--+# define INCLUDE_DEFAULTS_MUSL_NATIVE
--+#else
--+# undef INCLUDE_DEFAULTS_MUSL_CROSS
--+# define INCLUDE_DEFAULTS_MUSL_CROSS
--+#endif
--+
--+#undef INCLUDE_DEFAULTS
--+#define INCLUDE_DEFAULTS \
--+ { \
--+ INCLUDE_DEFAULTS_MUSL_GPP \
--+ INCLUDE_DEFAULTS_MUSL_PREFIX \
--+ INCLUDE_DEFAULTS_MUSL_CROSS \
--+ INCLUDE_DEFAULTS_MUSL_TOOL \
--+ INCLUDE_DEFAULTS_MUSL_NATIVE \
--+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
--+ { 0, 0, 0, 0, 0, 0 } \
--+ }
--+#endif
--+
-- #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
-- /* This is a *uclinux* target. We don't define below macros to normal linux
-- versions, because doing so would require *uclinux* targets to include
----- a/gcc/config/linux.opt
--+++ b/gcc/config/linux.opt
--@@ -30,3 +30,7 @@ Use GNU C library
-- muclibc
-- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
-- Use uClibc C library
--+
--+mmusl
--+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
--+Use musl C library
----- a/gcc/ginclude/stddef.h
--+++ b/gcc/ginclude/stddef.h
--@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #ifndef _GCC_SIZE_T
-- #ifndef _SIZET_
-- #ifndef __size_t
--+#ifndef __DEFINED_size_t /* musl */
-- #define __size_t__ /* BeOS */
-- #define __SIZE_T__ /* Cray Unicos/Mk */
-- #define _SIZE_T
--@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
-- #define ___int_size_t_h
-- #define _GCC_SIZE_T
-- #define _SIZET_
--+#define __DEFINED_size_t /* musl */
-- #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
-- || defined(__FreeBSD_kernel__)
-- /* __size_t is a typedef on FreeBSD 5, must not trash it. */
--@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
-- typedef long ssize_t;
-- #endif /* __BEOS__ */
-- #endif /* !(defined (__GNUG__) && defined (size_t)) */
--+#endif /* __DEFINED_size_t */
-- #endif /* __size_t */
-- #endif /* _SIZET_ */
-- #endif /* _GCC_SIZE_T */
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -77,6 +77,23 @@
-- %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
-- %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
--
--+/* For ARM musl currently supports four dynamic linkers:
--+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
--+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
--+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
--+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
--+ musl does not support the legacy OABI mode.
--+ All the dynamic linkers live in /lib.
--+ We default to soft-float, EL. */
--+#undef MUSL_DYNAMIC_LINKER
--+#if TARGET_BIG_ENDIAN_DEFAULT
--+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
--+#endif
--+#define MUSL_DYNAMIC_LINKER \
--+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
----- a/libitm/config/arm/hwcap.cc
--+++ b/libitm/config/arm/hwcap.cc
--@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
--
-- #ifdef __linux__
-- #include <unistd.h>
--+#ifdef __GLIBC__
-- #include <sys/fcntl.h>
--+#else
--+#include <fcntl.h>
--+#endif
-- #include <elf.h>
--
-- static void __attribute__((constructor))
+++ /dev/null
----- a/gcc/config/mips/linux.h
--+++ b/gcc/config/mips/linux.h
--@@ -23,3 +23,10 @@ along with GCC; see the file COPYING3.
-- #undef UCLIBC_DYNAMIC_LINKER
-- #define UCLIBC_DYNAMIC_LINKER \
-- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
--+
--+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
--+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
--+#endif
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
+++ /dev/null
----- a/gcc/config.gcc
--+++ b/gcc/config.gcc
--@@ -2344,6 +2344,10 @@ powerpc*-*-linux*)
-- powerpc*-*-linux*paired*)
-- tm_file="${tm_file} rs6000/750cl.h" ;;
-- esac
--+ case ${target} in
--+ *-linux*-musl*)
--+ enable_secureplt=yes ;;
--+ esac
-- if test x${enable_secureplt} = xyes; then
-- tm_file="rs6000/secureplt.h ${tm_file}"
-- fi
----- a/gcc/config/rs6000/linux64.h
--+++ b/gcc/config/rs6000/linux64.h
--@@ -371,17 +371,21 @@ extern int dot_symbols;
-- #endif
-- #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-- #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
-- #if DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
-- #elif DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif
-- #define GNU_USER_DYNAMIC_LINKER32 \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
-- #define GNU_USER_DYNAMIC_LINKER64 \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
--
-- #undef DEFAULT_ASM_ENDIAN
-- #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
----- a/gcc/config/rs6000/secureplt.h
--+++ b/gcc/config/rs6000/secureplt.h
--@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
-- <http://www.gnu.org/licenses/>. */
--
-- #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
--+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
----- a/gcc/config/rs6000/sysv4.h
--+++ b/gcc/config/rs6000/sysv4.h
--@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
-- #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
-- #define CC1_SECURE_PLT_DEFAULT_SPEC ""
-- #endif
--+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
--+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
--+#endif
--
-- /* Pass -G xxx to the compiler. */
-- #define CC1_SPEC "%{G*} %(cc1_cpu)" \
--@@ -585,7 +588,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
--
-- /* Override the default target of the linker. */
-- #define LINK_TARGET_SPEC \
--- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
--+ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
--+ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
--
-- /* Any specific OS flags. */
-- #define LINK_OS_SPEC "\
--@@ -763,15 +767,18 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-- #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
-- #if DEFAULT_LIBC == LIBC_UCLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
--+#elif DEFAULT_LIBC == LIBC_MUSL
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
-- #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
---#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
--+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
-- #else
-- #error "Unsupported DEFAULT_LIBC"
-- #endif
-- #define GNU_USER_DYNAMIC_LINKER \
--- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
--+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
--
-- #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
-- %{rdynamic:-export-dynamic} \
--@@ -894,6 +901,7 @@ ncrtn.o%s"
-- { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
-- { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
-- { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
--+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
-- { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
-- { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
-- { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
+++ /dev/null
----- a/gcc/config/sh/linux.h
--+++ b/gcc/config/sh/linux.h
--@@ -43,7 +43,14 @@ along with GCC; see the file COPYING3.
--
-- #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--
--+#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
--+#define MUSL_DYNAMIC_LINKER_E "eb"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E
--+#endif
--+
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
--
-- #undef SUBTARGET_LINK_EMUL_SUFFIX
-- #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+++ /dev/null
----- a/gcc/config/i386/linux.h
--+++ b/gcc/config/i386/linux.h
--@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
--
-- #define GNU_USER_LINK_EMULATION "elf_i386"
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
----- a/gcc/config/i386/linux64.h
--+++ b/gcc/config/i386/linux64.h
--@@ -30,3 +30,7 @@ see the files COPYING3 and COPYING.RUNTI
-- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-- #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
--+
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
--+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
----- a/libitm/config/linux/x86/tls.h
--+++ b/libitm/config/linux/x86/tls.h
--@@ -25,16 +25,19 @@
-- #ifndef LIBITM_X86_TLS_H
-- #define LIBITM_X86_TLS_H 1
--
---#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
--+#if defined(__GLIBC_PREREQ)
--+#if __GLIBC_PREREQ(2, 10)
-- /* Use slots in the TCB head rather than __thread lookups.
-- GLIBC has reserved words 10 through 13 for TM. */
-- #define HAVE_ARCH_GTM_THREAD 1
-- #define HAVE_ARCH_GTM_THREAD_DISP 1
-- #endif
--+#endif
--
-- #include "config/generic/tls.h"
--
---#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
--+#if defined(__GLIBC_PREREQ)
--+#if __GLIBC_PREREQ(2, 10)
-- namespace GTM HIDDEN {
--
-- #ifdef __x86_64__
--@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
--
-- } // namespace GTM
-- #endif /* >= GLIBC 2.10 */
--+#endif
--
-- #endif // LIBITM_X86_TLS_H
+++ /dev/null
----- a/gcc/config/aarch64/aarch64-linux.h
--+++ b/gcc/config/aarch64/aarch64-linux.h
--@@ -23,6 +23,8 @@
--
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
--
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
--+
-- #define CPP_SPEC "%{pthread:-D_REENTRANT}"
--
-- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
----- a/fixincludes/mkfixinc.sh
--+++ b/fixincludes/mkfixinc.sh
--@@ -19,7 +19,8 @@ case $machine in
-- powerpc-*-eabi* | \
-- powerpc-*-rtems* | \
-- powerpcle-*-eabisim* | \
--- powerpcle-*-eabi* )
--+ powerpcle-*-eabi* | \
--+ *-musl* )
-- # IF there is no include fixing,
-- # THEN create a no-op fixer and exit
-- (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
+++ /dev/null
----- a/libgomp/config/posix/time.c
--+++ b/libgomp/config/posix/time.c
--@@ -28,6 +28,8 @@
-- The following implementation uses the most simple POSIX routines.
-- If present, POSIX 4 clocks should be used instead. */
--
--+#define _POSIX_C_SOURCE 199309L /* for clocks */
--+
-- #include "libgomp.h"
-- #include <unistd.h>
-- #if TIME_WITH_SYS_TIME
+++ /dev/null
----- a/libstdc++-v3/configure.host
--+++ b/libstdc++-v3/configure.host
--@@ -263,6 +263,13 @@ case "${host_os}" in
-- os_include_dir="os/bsd/freebsd"
-- ;;
-- gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
--+ # check for musl by target
--+ case "${host_os}" in
--+ *-musl*)
--+ os_include_dir="os/generic"
--+ ;;
--+ *)
--+
-- if [ "$uclibc" = "yes" ]; then
-- os_include_dir="os/uclibc"
-- elif [ "$bionic" = "yes" ]; then
--@@ -271,6 +278,9 @@ case "${host_os}" in
-- os_include_dir="os/gnu-linux"
-- fi
-- ;;
--+
--+ esac
--+ ;;
-- hpux*)
-- os_include_dir="os/hpux"
-- ;;
+++ /dev/null
----- a/libsanitizer/interception/interception_type_test.cc
--+++ b/libsanitizer/interception/interception_type_test.cc
--@@ -31,7 +31,7 @@ COMPILER_CHECK(sizeof(OFF64_T) == sizeof
-- // rest (they depend on _FILE_OFFSET_BITS setting when building an application).
-- # if defined(__ANDROID__) || !defined _FILE_OFFSET_BITS || \
-- _FILE_OFFSET_BITS != 64
---COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
--+// COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
-- # endif
--
-- #endif
+++ /dev/null
----- a/gcc/config/mips/linux.h
--+++ b/gcc/config/mips/linux.h
--@@ -29,4 +29,4 @@ along with GCC; see the file COPYING3.
-- #else
-- #define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
-- #endif
---#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
--+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+++ /dev/null
----- a/gcc/config/mips/linux64.h
--+++ b/gcc/config/mips/linux64.h
--@@ -39,6 +39,16 @@ along with GCC; see the file COPYING3.
-- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
--
-- #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
--+
--+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
--+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
--+#else
--+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
--+#endif
--+
--+#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
--+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
--+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-- #define GNU_USER_DYNAMIC_LINKERN32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
--- BIONIC_DYNAMIC_LINKERN32)
--+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+++ /dev/null
----- a/gcc/config/arm/arm.h
--+++ b/gcc/config/arm/arm.h
--@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att
-- /* Thumb-1 only. */
-- #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
--
---#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
--+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
-- && !TARGET_THUMB1)
--
-- #define TARGET_CRC32 (arm_arch_crc)
+++ /dev/null
----- a/libgcc/config/arm/t-linux
--+++ b/libgcc/config/arm/t-linux
--@@ -1,6 +1,10 @@
-- LIB1ASMSRC = arm/lib1funcs.S
-- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
--- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
--+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
--+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
--+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
--+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
--+ _arm_fixsfsi _arm_fixunssfsi
--
-- # Just for these, we omit the frame pointer since it makes such a big
-- # difference.
----- a/gcc/config/arm/linux-elf.h
--+++ b/gcc/config/arm/linux-elf.h
--@@ -60,8 +60,6 @@
-- %{shared:-lc} \
-- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
--
---#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
---
-- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--
-- #define LINUX_TARGET_LINK_SPEC "%{h*} \
+++ /dev/null
----- a/libgcc/Makefile.in
--+++ b/libgcc/Makefile.in
--@@ -881,11 +881,12 @@ $(libgcov-driver-objects): %$(objext): $
--
-- # Static libraries.
-- libgcc.a: $(libgcc-objects)
--+libgcc_pic.a: $(libgcc-s-objects)
-- libgcov.a: $(libgcov-objects)
-- libunwind.a: $(libunwind-objects)
-- libgcc_eh.a: $(libgcc-eh-objects)
--
---libgcc.a libgcov.a libunwind.a libgcc_eh.a:
--+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-- -rm -f $@
--
-- objects="$(objects)"; \
--@@ -907,7 +908,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
-- endif
--
-- ifeq ($(enable_shared),yes)
---all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
--+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
-- ifneq ($(LIBUNWIND),)
-- all: libunwind$(SHLIB_EXT)
-- endif
--@@ -1090,6 +1091,10 @@ install-shared:
-- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
--
--+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
--+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
--+
-- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
-- @shlib_base_name@,libgcc_s,$(subst \
-- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+++ /dev/null
--http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
--
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -45,7 +45,7 @@
-- The ARM10TDMI core is the default for armv5t, so set
-- SUBTARGET_CPU_DEFAULT to achieve this. */
-- #undef SUBTARGET_CPU_DEFAULT
---#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
--+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
--
-- /* TARGET_BIG_ENDIAN_DEFAULT is set in
-- config.gcc for big endian configurations. */
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -94,10 +94,15 @@
-- #define MUSL_DYNAMIC_LINKER \
-- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
--
--+/* For armv4 we pass --fix-v4bx to linker to support EABI */
--+#undef TARGET_FIX_V4BX_SPEC
--+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
--+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
--+
-- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
-- use the GNU/Linux version, not the generic BPABI version. */
-- #undef LINK_SPEC
---#define LINK_SPEC EABI_LINK_SPEC \
--+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
-- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
-- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
--
+++ /dev/null
----- a/gcc/config/arm/linux-eabi.h
--+++ b/gcc/config/arm/linux-eabi.h
--@@ -131,10 +131,6 @@
-- #define ENDFILE_SPEC \
-- LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
--
---/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
--- do not use -lfloat. */
---#undef LIBGCC_SPEC
---
-- /* Clear the instruction cache from `beg' to `end'. This is
-- implemented in lib1funcs.S, so ensure an error if this definition
-- is used. */
----- a/gcc/config/linux.h
--+++ b/gcc/config/linux.h
--@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
-- builtin_assert ("system=posix"); \
-- } while (0)
--
--+#ifndef LIBGCC_SPEC
--+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
--+#endif
--+
-- /* Determine which dynamic linker to use depending on whether GLIBC or
-- uClibc or Bionic is the default C library and whether
-- -muclibc or -mglibc or -mbionic has been passed to change the default. */
----- a/libgcc/mkmap-symver.awk
--+++ b/libgcc/mkmap-symver.awk
--@@ -132,5 +132,5 @@ function output(lib) {
-- else if (inherit[lib])
-- printf("} %s;\n", inherit[lib]);
-- else
--- printf ("\n local:\n\t*;\n};\n");
--+ printf ("\n\t*;\n};\n");
-- }
----- a/gcc/config/rs6000/linux.h
--+++ b/gcc/config/rs6000/linux.h
--@@ -62,6 +62,9 @@
-- #undef CPLUSPLUS_CPP_SPEC
-- #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
--
--+#undef LIBGCC_SPEC
--+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
--+
-- #undef LINK_SHLIB_SPEC
-- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
--
+++ /dev/null
----- a/libgcc/config/t-libunwind
--+++ b/libgcc/config/t-libunwind
--@@ -2,8 +2,7 @@
--
-- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
--
---LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
--- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
--+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
--
-- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
+++ /dev/null
----- a/libgcc/unwind-dw2-fde-dip.c
--+++ b/libgcc/unwind-dw2-fde-dip.c
--@@ -46,33 +46,13 @@
-- #include "unwind-compat.h"
-- #include "gthr.h"
--
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__BIONIC__)
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__FreeBSD__) && __FreeBSD__ >= 7
---# define ElfW __ElfN
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(__OpenBSD__)
---# define ElfW(type) Elf_##type
---# define USE_PT_GNU_EH_FRAME
---#endif
---
---#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--- && defined(TARGET_DL_ITERATE_PHDR) \
--- && defined(__sun__) && defined(__svr4__)
--+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
-- # define USE_PT_GNU_EH_FRAME
--+# ifdef __OpenBSD__
--+# define ElfW(type) Elf_##type
--+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
--+# define ElfW __ElfN
--+# endif
-- #endif
--
-- #if defined(USE_PT_GNU_EH_FRAME)
+++ /dev/null
----- a/gcc/config/rs6000/rs6000.c
--+++ b/gcc/config/rs6000/rs6000.c
--@@ -20869,7 +20869,7 @@ rs6000_savres_strategy (rs6000_stack_t *
-- /* Define cutoff for using out-of-line functions to save registers. */
-- if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
-- {
--- if (!optimize_size)
--+ if (1)
-- {
-- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
-- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
+++ /dev/null
----- a/gcc/defaults.h
--+++ b/gcc/defaults.h
--@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
-- /* If we have named section and we support weak symbols, then use the
-- .jcr section for recording java classes which need to be registered
-- at program start-up time. */
---#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
--+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
-- #ifndef JCR_SECTION_NAME
-- #define JCR_SECTION_NAME ".jcr"
-- #endif
+++ /dev/null
----- a/libgcc/config/mips/t-mips16
--+++ b/libgcc/config/mips/t-mips16
--@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
--
-- # Version these symbols if building libgcc.so.
-- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
--+
--+CRTSTUFF_T_CFLAGS += -mno-mips16
--+CRTSTUFF_T_CFLAGS_S += -mno-mips16
+++ /dev/null
--
-- This patch brings over a few features from MirBSD:
-- * -fhonour-copts
-- If this option is not given, it's warned (depending
-- on environment variables). This is to catch errors
-- of misbuilt packages which override CFLAGS themselves.
-- * -Werror-maybe-reset
-- Has the effect of -Wno-error if GCC_NO_WERROR is
-- set and not '0', a no-operation otherwise. This is
-- to be able to use -Werror in "make" but prevent
-- GNU autoconf generated configure scripts from
-- freaking out.
--
-- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
-- with copyright assignment to the FSF in effect.
--
----- a/gcc/c-family/c-opts.c
--+++ b/gcc/c-family/c-opts.c
--@@ -105,6 +105,9 @@ static size_t include_cursor;
-- /* Whether any standard preincluded header has been preincluded. */
-- static bool done_preinclude;
--
--+/* Check if a port honours COPTS. */
--+static int honour_copts = 0;
--+
-- static void handle_OPT_d (const char *);
-- static void set_std_cxx98 (int);
-- static void set_std_cxx11 (int);
--@@ -384,6 +387,9 @@ c_common_handle_option (size_t scode, co
-- cpp_opts->warn_endif_labels = value;
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ break;
--+
-- case OPT_Winvalid_pch:
-- cpp_opts->warn_invalid_pch = value;
-- break;
--@@ -492,6 +498,12 @@ c_common_handle_option (size_t scode, co
-- flag_no_builtin = !value;
-- break;
--
--+ case OPT_fhonour_copts:
--+ if (c_language == clk_c) {
--+ honour_copts++;
--+ }
--+ break;
--+
-- case OPT_fconstant_string_class_:
-- constant_string_class_name = arg;
-- break;
--@@ -1048,6 +1060,47 @@ c_common_init (void)
-- return false;
-- }
--
--+ if (c_language == clk_c) {
--+ char *ev = getenv ("GCC_HONOUR_COPTS");
--+ int evv;
--+ if (ev == NULL)
--+ evv = -1;
--+ else if ((*ev == '0') || (*ev == '\0'))
--+ evv = 0;
--+ else if (*ev == '1')
--+ evv = 1;
--+ else if (*ev == '2')
--+ evv = 2;
--+ else if (*ev == 's')
--+ evv = -1;
--+ else {
--+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
--+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
--+ }
--+ if (evv == 1) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in lenient mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ warning (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ } else if (evv == 2) {
--+ if (honour_copts == 0) {
--+ error ("someone does not honour COPTS at all in strict mode");
--+ return false;
--+ } else if (honour_copts != 1) {
--+ error ("someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ return false;
--+ }
--+ } else if (evv == 0) {
--+ if (honour_copts != 1)
--+ inform (0, "someone does not honour COPTS correctly, passed %d times",
--+ honour_copts);
--+ }
--+ }
--+
-- return true;
-- }
--
----- a/gcc/c-family/c.opt
--+++ b/gcc/c-family/c.opt
--@@ -391,6 +391,10 @@ Wfloat-conversion
-- C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
-- Warn for implicit type conversions that cause loss of floating point precision
--
--+Werror-maybe-reset
--+C ObjC C++ ObjC++
--+; Documented in common.opt
--+
-- Wfloat-equal
-- C ObjC C++ ObjC++ Var(warn_float_equal) Warning
-- Warn if testing floating point numbers for equality
--@@ -972,6 +976,9 @@ C++ ObjC++ Optimization Alias(fexception
-- fhonor-std
-- C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
--
--+fhonour-copts
--+C ObjC C++ ObjC++ RejectNegative
--+
-- fhosted
-- C ObjC
-- Assume normal C execution environment
----- a/gcc/common.opt
--+++ b/gcc/common.opt
--@@ -549,6 +549,10 @@ Werror=
-- Common Joined
-- Treat specified warning as error
--
--+Werror-maybe-reset
--+Common
--+If environment variable GCC_NO_WERROR is set, act as -Wno-error
--+
-- Wextra
-- Common Var(extra_warnings) Warning
-- Print extra (possibly unwanted) warnings
--@@ -1287,6 +1291,9 @@ fguess-branch-probability
-- Common Report Var(flag_guess_branch_prob) Optimization
-- Enable guessing of branch probabilities
--
--+fhonour-copts
--+Common RejectNegative
--+
-- ; Nonzero means ignore `#ident' directives. 0 means handle them.
-- ; Generate position-independent code for executables if possible
-- ; On SVR4 targets, it also controls whether or not to emit a
----- a/gcc/opts.c
--+++ b/gcc/opts.c
--@@ -1572,6 +1572,17 @@ common_handle_option (struct gcc_options
-- opts, opts_set, loc, dc);
-- break;
--
--+ case OPT_Werror_maybe_reset:
--+ {
--+ char *ev = getenv ("GCC_NO_WERROR");
--+ if ((ev != NULL) && (*ev != '0'))
--+ warnings_are_errors = 0;
--+ }
--+ break;
--+
--+ case OPT_fhonour_copts:
--+ break;
--+
-- case OPT_Wlarger_than_:
-- opts->x_larger_than_size = value;
-- opts->x_warn_larger_than = value != -1;
----- a/gcc/doc/cppopts.texi
--+++ b/gcc/doc/cppopts.texi
--@@ -163,6 +163,11 @@ in older programs. This warning is on b
-- Make all warnings into hard errors. Source code which triggers warnings
-- will be rejected.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
-- @item -Wsystem-headers
-- @opindex Wsystem-headers
-- Issue warnings for code in system headers. These are normally unhelpful
----- a/gcc/doc/invoke.texi
--+++ b/gcc/doc/invoke.texi
--@@ -243,7 +243,7 @@ Objective-C and Objective-C++ Dialects}.
-- -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
-- -Wno-deprecated -Wno-deprecated-declarations -Wdisabled-optimization @gol
-- -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
----Wno-endif-labels -Werror -Werror=* @gol
--+-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
-- -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-- -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-- -Wformat-security -Wformat-y2k @gol
--@@ -5042,6 +5042,22 @@ This option is only supported for C and
-- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
-- @option{-Wno-pointer-sign}.
--
--+ at item -Werror-maybe-reset
--+ at opindex Werror-maybe-reset
--+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
--+variable is set to anything other than 0 or empty.
--+
--+ at item -fhonour-copts
--+ at opindex fhonour-copts
--+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
--+given at least once, and warn if it is given more than once.
--+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
--+given exactly once.
--+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
--+is not given exactly once.
--+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
--+This flag and environment variable only affect the C language.
--+
-- @item -Wstack-protector
-- @opindex Wstack-protector
-- @opindex Wno-stack-protector
--@@ -7194,7 +7210,7 @@ so, the first branch is redirected to ei
-- second branch or a point immediately following it, depending on whether
-- the condition is known to be true or false.
--
---Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
--+Enabled at levels @option{-O3}.
--
-- @item -fsplit-wide-types
-- @opindex fsplit-wide-types
----- a/gcc/java/jvspec.c
--+++ b/gcc/java/jvspec.c
--@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
-- class name. Append dummy `.c' that can be stripped by set_input so %b
-- is correct. */
-- set_input (concat (main_class_name, "main.c", NULL));
--+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
-- err = do_spec (jvgenmain_spec);
-- if (err == 0)
-- {
+++ /dev/null
----- a/gcc/gcc.c
--+++ b/gcc/gcc.c
--@@ -8105,7 +8105,10 @@ getenv_spec_function (int argc, const ch
--
-- value = getenv (argv[0]);
-- if (!value)
--- fatal_error ("environment variable %qs not defined", argv[0]);
--+ {
--+ warning (0, "environment variable %qs not defined", argv[0]);
--+ value = "";
--+ }
--
-- /* We have to escape every character of the environment variable so
-- they are not interpreted as active spec characters. A
+++ /dev/null
--From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
--From: Andrew McDonnell <bugs@andrewmcdonnell.net>
--Date: Fri, 3 Oct 2014 19:09:00 +0930
--Subject: Add .note.GNU-stack section
--
--See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
--Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
--
--Re: [Patch, MIPS] Add .note.GNU-stack section
--
-- From: Steve Ellcey <sellcey at mips dot com>
--
--On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
-->
-->
--> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
--
--> This works except you did not update the assembly files in
--> libgcc or glibc. We (Cavium) have the same patch in our tree
--> for a few released versions.
--
--> Mind just checking yours in then Andrew?
--
--> Thanks!
--> -eric
--
--I talked to Andrew about what files he changed in GCC and created and
--tested this new patch. Andrew also mentioned changing some assembly
--files in glibc but I don't see any use of '.section .note.GNU-stack' in
--any assembly files in glibc (for any platform) so I wasn't planning on
--creating a glibc to add them to mips glibc assembly language files.
--
--OK to check in this patch?
--
--Steve Ellcey
--sellcey@mips.com
--
--
--
--2014-09-26 Steve Ellcey <sellcey@mips.com>
-----
-- gcc/config/mips/mips.c | 3 +++
-- libgcc/config/mips/crti.S | 4 ++++
-- libgcc/config/mips/crtn.S | 3 +++
-- libgcc/config/mips/mips16.S | 4 ++++
-- libgcc/config/mips/vr4120-div.S | 4 ++++
-- 5 files changed, 18 insertions(+)
--
----- a/gcc/config/mips/mips.c
--+++ b/gcc/config/mips/mips.c
--@@ -19142,6 +19142,9 @@ mips_atomic_assign_expand_fenv (tree *ho
-- #define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P \
-- mips_use_by_pieces_infrastructure_p
--
--+#undef TARGET_ASM_FILE_END
--+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--+
-- struct gcc_target targetm = TARGET_INITIALIZER;
-- \f
-- #include "gt-mips.h"
----- a/libgcc/config/mips/crti.S
--+++ b/libgcc/config/mips/crti.S
--@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-- <http://www.gnu.org/licenses/>. */
--
--+
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+
-- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
-- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--
----- a/libgcc/config/mips/crtn.S
--+++ b/libgcc/config/mips/crtn.S
--@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-- <http://www.gnu.org/licenses/>. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+
-- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
-- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--
----- a/libgcc/config/mips/mips16.S
--+++ b/libgcc/config/mips/mips16.S
--@@ -35,6 +35,10 @@ see the files COPYING3 and COPYING.RUNTI
-- values using the soft-float calling convention, but do the actual
-- operation using the hard floating point instructions. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+ .previous
--+
-- #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
--
-- /* This file contains 32-bit assembly code. */
----- a/libgcc/config/mips/vr4120-div.S
--+++ b/libgcc/config/mips/vr4120-div.S
--@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
-- -mfix-vr4120. div and ddiv do not give the correct result when one
-- of the operands is negative. */
--
--+/* An executable stack is *not* required for these functions. */
--+ .section .note.GNU-stack,"",%progbits
--+ .previous
--+
-- .set nomips16
--
-- #define DIV \
+++ /dev/null
----- a/libstdc++-v3/include/Makefile.in
--+++ b/libstdc++-v3/include/Makefile.in
--@@ -1366,7 +1366,7 @@ stamp-bits: ${bits_headers}
-- @$(STAMP) stamp-bits
--
-- stamp-bits-sup: stamp-bits ${bits_sup_headers}
--- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
--+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
-- @$(STAMP) stamp-bits-sup
--
-- stamp-c_base: ${c_base_headers}
--- /dev/null
--- /dev/null
++Revert of:
++
++commit 275035b56823b26d5fb7e90fad945b998648edf2
++Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Thu Sep 5 14:09:07 2013 +0000
++
++ PR target/58139
++ * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
++ looking for widest mode.
++
++
++ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
++
++
++--- a/gcc/reginfo.c
+++++ b/gcc/reginfo.c
++@@ -665,35 +665,40 @@ choose_hard_reg_mode (unsigned int regno
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
++ if (found_mode != VOIDmode)
--- /dev/null
--- /dev/null
++--- a/include/filenames.h
+++++ b/include/filenames.h
++@@ -43,11 +43,6 @@ extern "C" {
++ # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
++ #else /* not DOSish */
++-# if defined(__APPLE__)
++-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
++-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
++-# endif
++-# endif /* __APPLE__ */
++ # define HAS_DRIVE_SPEC(f) (0)
++ # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
--- /dev/null
--- /dev/null
++--- a/gcc/Makefile.in
+++++ b/gcc/Makefile.in
++@@ -2941,18 +2941,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
++ doc/gccint.info: $(TEXI_GCCINT_FILES)
++ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
++
++-doc/%.info: %.texi
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/%.info:
++
++ # Duplicate entry to handle renaming of gccinstall.info
++-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/gccinstall.info:
++
++ doc/cpp.dvi: $(TEXI_CPP_FILES)
++ doc/gcc.dvi: $(TEXI_GCC_FILES)
--- /dev/null
--- /dev/null
++--- a/gcc/calls.c
+++++ b/gcc/calls.c
++@@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ
++ && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
++ ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
++ : memory_address (FUNCTION_MODE, funexp));
+++ else if (flag_pic && !flag_plt && fndecl_or_type
+++ && TREE_CODE (fndecl_or_type) == FUNCTION_DECL
+++ && !targetm.binds_local_p (fndecl_or_type))
+++ {
+++ funexp = force_reg (Pmode, funexp);
+++ }
++ else if (! sibcallp)
++ {
++ #ifndef NO_FUNCTION_CSE
++--- a/gcc/common.opt
+++++ b/gcc/common.opt
++@@ -1779,6 +1779,10 @@ fpie
++ Common Report Var(flag_pie,1) Negative(fPIC)
++ Generate position-independent code for executables if possible (small mode)
++
+++fplt
+++Common Report Var(flag_plt) Init(1)
+++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
+++
++ fplugin=
++ Common Joined RejectNegative Var(common_deferred_options) Defer
++ Specify a plugin to load
--- /dev/null
--- /dev/null
++Fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932
++
++--- a/gcc/config/arm/arm.h
+++++ b/gcc/config/arm/arm.h
++@@ -628,16 +628,10 @@ extern int arm_arch_crc;
++ type, but kept valid in the wider mode. The signedness of the
++ extension may differ from that of the type. */
++
++-/* It is far faster to zero extend chars than to sign extend them */
++-
++ #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
++ if (GET_MODE_CLASS (MODE) == MODE_INT \
++ && GET_MODE_SIZE (MODE) < 4) \
++ { \
++- if (MODE == QImode) \
++- UNSIGNEDP = 1; \
++- else if (MODE == HImode) \
++- UNSIGNEDP = 1; \
++ (MODE) = SImode; \
++ }
++
--- /dev/null
--- /dev/null
++--- a/gcc/config/mips/mips.c
+++++ b/gcc/config/mips/mips.c
++@@ -8001,9 +8001,17 @@ mask_low_and_shift_p (machine_mode mode,
++ bool
++ and_operands_ok (machine_mode mode, rtx op1, rtx op2)
++ {
++- return (memory_operand (op1, mode)
++- ? and_load_operand (op2, mode)
++- : and_reg_operand (op2, mode));
+++ if (!memory_operand (op1, mode))
+++ return and_reg_operand (op2, mode);
+++
+++ if (!and_load_operand (op2, mode))
+++ return false;
+++
+++ if (!TARGET_MIPS16 || si_mask_operand(op2, mode))
+++ return true;
+++
+++ op1 = XEXP (op1, 0);
+++ return !(REG_P (op1) && REGNO (op1) == STACK_POINTER_REGNUM);
++ }
++
++ /* The canonical form of a mask-low-and-shift-left operation is
--- /dev/null
--- /dev/null
++Upstream commit r233720
++
++diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
++index 68acd3d..214ecf6 100644
++--- a/gcc/cp/cfns.gperf
+++++ b/gcc/cp/cfns.gperf
++@@ -1,3 +1,5 @@
+++%language=C++
+++%define class-name libc_name
++ %{
++ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
++
++@@ -16,14 +18,6 @@ for more details.
++ You should have received a copy of the GNU General Public License
++ along with GCC; see the file COPYING3. If not see
++ <http://www.gnu.org/licenses/>. */
++-#ifdef __GNUC__
++-__inline
++-#endif
++-static unsigned int hash (const char *, unsigned int);
++-#ifdef __GNUC__
++-__inline
++-#endif
++-const char * libc_name_p (const char *, unsigned int);
++ %}
++ %%
++ # The standard C library functions, for feeding to gperf; the result is used
++diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
++index 1c6665d..596f413 100644
++--- a/gcc/cp/cfns.h
+++++ b/gcc/cp/cfns.h
++@@ -1,5 +1,5 @@
++-/* ANSI-C code produced by gperf version 3.0.3 */
++-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
+++/* C++ code produced by gperf version 3.0.4 */
+++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
++
++ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
++ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
++@@ -28,7 +28,7 @@
++ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
++ #endif
++
++-#line 1 "cfns.gperf"
+++#line 3 "cfns.gperf"
++
++ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
++
++@@ -47,25 +47,18 @@ for more details.
++ You should have received a copy of the GNU General Public License
++ along with GCC; see the file COPYING3. If not see
++ <http://www.gnu.org/licenses/>. */
++-#ifdef __GNUC__
++-__inline
++-#endif
++-static unsigned int hash (const char *, unsigned int);
++-#ifdef __GNUC__
++-__inline
++-#endif
++-const char * libc_name_p (const char *, unsigned int);
++ /* maximum key range = 391, duplicates = 0 */
++
++-#ifdef __GNUC__
++-__inline
++-#else
++-#ifdef __cplusplus
++-inline
++-#endif
++-#endif
++-static unsigned int
++-hash (register const char *str, register unsigned int len)
+++class libc_name
+++{
+++private:
+++ static inline unsigned int hash (const char *str, unsigned int len);
+++public:
+++ static const char *libc_name_p (const char *str, unsigned int len);
+++};
+++
+++inline unsigned int
+++libc_name::hash (register const char *str, register unsigned int len)
++ {
++ static const unsigned short asso_values[] =
++ {
++@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
++ return hval + asso_values[(unsigned char)str[len - 1]];
++ }
++
++-#ifdef __GNUC__
++-__inline
++-#ifdef __GNUC_STDC_INLINE__
++-__attribute__ ((__gnu_inline__))
++-#endif
++-#endif
++ const char *
++-libc_name_p (register const char *str, register unsigned int len)
+++libc_name::libc_name_p (register const char *str, register unsigned int len)
++ {
++ enum
++ {
++diff --git a/gcc/cp/except.c b/gcc/cp/except.c
++index 3ff1ce6..2f2e396 100644
++--- a/gcc/cp/except.c
+++++ b/gcc/cp/except.c
++@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
++ unless the system headers are playing rename tricks, and if
++ they are, we don't want to be confused by them. */
++ id = DECL_NAME (fn);
++- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
+++ IDENTIFIER_LENGTH (id));
++ }
++
++ /* Returns nonzero if an exception of type FROM will be caught by a
++--
++1.7.1
++
--- /dev/null
--- /dev/null
++--- a/contrib/regression/objs-gcc.sh
+++++ b/contrib/regression/objs-gcc.sh
++@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
++ then
++ make all-gdb all-dejagnu all-ld || exit 1
++ make install-gdb install-dejagnu install-ld || exit 1
+++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+++ then
+++ make all-gdb all-dejagnu all-ld || exit 1
+++ make install-gdb install-dejagnu install-ld || exit 1
++ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
++ make bootstrap || exit 1
++ make install || exit 1
++--- a/libjava/classpath/ltconfig
+++++ b/libjava/classpath/ltconfig
++@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
++
++ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
++ case $host_os in
++-linux-gnu*) ;;
+++linux-gnu*|linux-uclibc*) ;;
++ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
++ esac
++
++@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
++ ;;
++
++ # This must be Linux ELF.
++-linux-gnu*)
+++linux*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Fri, 8 May 2015 08:25:47 +0000 (+0000)
++Subject: [PATCH 2/13] musl libc config
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb
++
++[PATCH 2/13] musl libc config
++
++2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config.gcc (LIBC_MUSL): New tm_defines macro.
++ * config/linux.h (OPTION_MUSL): Define.
++ (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,)
++ (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,)
++ (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
++ (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
++ (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
++ * config/linux.opt (mmusl): New option.
++ * doc/invoke.texi (GNU/Linux Options): Document -mmusl.
++ * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*.
++ (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*.
++ * configure: Regenerate.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config.gcc
+++++ b/gcc/config.gcc
++@@ -575,7 +575,7 @@ case ${target} in
++ esac
++
++ # Common C libraries.
++-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
+++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
++
++ # 32-bit x86 processors supported by --with-arch=. Each processor
++ # MUST be separated by exactly one space.
++@@ -720,6 +720,9 @@ case ${target} in
++ *-*-*uclibc*)
++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
++ ;;
+++ *-*-*musl*)
+++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
+++ ;;
++ *)
++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
++ ;;
++--- a/gcc/config/linux.h
+++++ b/gcc/config/linux.h
++@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
++ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
++ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
++ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
++ #else
++ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
++ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
++ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
++ #endif
++
++ #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
++@@ -50,21 +52,25 @@ see the files COPYING3 and COPYING.RUNTI
++ } while (0)
++
++ /* Determine which dynamic linker to use depending on whether GLIBC or
++- uClibc or Bionic is the default C library and whether
++- -muclibc or -mglibc or -mbionic has been passed to change the default. */
+++ uClibc or Bionic or musl is the default C library and whether
+++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
+++ the default. */
++
++-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
++- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
+++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
+++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
++
++ #if DEFAULT_LIBC == LIBC_GLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
++- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
+++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
++ #elif DEFAULT_LIBC == LIBC_UCLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
++- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
+++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
++ #elif DEFAULT_LIBC == LIBC_BIONIC
++-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
++- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
+++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
+++#elif DEFAULT_LIBC == LIBC_MUSL
+++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
++ #else
++ #error "Unsupported DEFAULT_LIBC"
++ #endif /* DEFAULT_LIBC */
++@@ -81,24 +87,100 @@ see the files COPYING3 and COPYING.RUNTI
++ #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
++ #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
++ #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
+++/* Should be redefined for each target that supports musl. */
+++#define MUSL_DYNAMIC_LINKER "/dev/null"
+++#define MUSL_DYNAMIC_LINKER32 "/dev/null"
+++#define MUSL_DYNAMIC_LINKER64 "/dev/null"
+++#define MUSL_DYNAMIC_LINKERX32 "/dev/null"
++
++ #define GNU_USER_DYNAMIC_LINKER \
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
++- BIONIC_DYNAMIC_LINKER)
+++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
++ #define GNU_USER_DYNAMIC_LINKER32 \
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
++- BIONIC_DYNAMIC_LINKER32)
+++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
++ #define GNU_USER_DYNAMIC_LINKER64 \
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
++- BIONIC_DYNAMIC_LINKER64)
+++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
++ #define GNU_USER_DYNAMIC_LINKERX32 \
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
++- BIONIC_DYNAMIC_LINKERX32)
+++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
++
++ /* Whether we have Bionic libc runtime */
++ #undef TARGET_HAS_BIONIC
++ #define TARGET_HAS_BIONIC (OPTION_BIONIC)
++
+++/* musl avoids problematic includes by rearranging the include directories.
+++ * Unfortunately, this is mostly duplicated from cppdefault.c */
+++#if DEFAULT_LIBC == LIBC_MUSL
+++#define INCLUDE_DEFAULTS_MUSL_GPP \
+++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+++
+++#ifdef LOCAL_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_LOCAL
+++#endif
+++
+++#ifdef PREFIX_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_PREFIX
+++#endif
+++
+++#ifdef CROSS_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_CROSS \
+++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_CROSS
+++#endif
+++
+++#ifdef TOOL_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_TOOL \
+++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_TOOL
+++#endif
+++
+++#ifdef NATIVE_SYSTEM_HEADER_DIR
+++#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_NATIVE
+++#endif
+++
+++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+++# define INCLUDE_DEFAULTS_MUSL_LOCAL
+++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+++# define INCLUDE_DEFAULTS_MUSL_NATIVE
+++#else
+++# undef INCLUDE_DEFAULTS_MUSL_CROSS
+++# define INCLUDE_DEFAULTS_MUSL_CROSS
+++#endif
+++
+++#undef INCLUDE_DEFAULTS
+++#define INCLUDE_DEFAULTS \
+++ { \
+++ INCLUDE_DEFAULTS_MUSL_GPP \
+++ INCLUDE_DEFAULTS_MUSL_PREFIX \
+++ INCLUDE_DEFAULTS_MUSL_CROSS \
+++ INCLUDE_DEFAULTS_MUSL_TOOL \
+++ INCLUDE_DEFAULTS_MUSL_NATIVE \
+++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+++ { 0, 0, 0, 0, 0, 0 } \
+++ }
+++#endif
+++
++ #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
++ /* This is a *uclinux* target. We don't define below macros to normal linux
++ versions, because doing so would require *uclinux* targets to include
++--- a/gcc/config/linux.opt
+++++ b/gcc/config/linux.opt
++@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l
++ Use GNU C library
++
++ muclibc
++-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
++ Use uClibc C library
+++
+++mmusl
+++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
+++Use musl C library
++--- a/gcc/configure
+++++ b/gcc/configure
++@@ -27802,6 +27802,9 @@ if test "${gcc_cv_libc_provides_ssp+set}
++ else
++ gcc_cv_libc_provides_ssp=no
++ case "$target" in
+++ *-*-musl*)
+++ # All versions of musl provide stack protector
+++ gcc_cv_libc_provides_ssp=yes;;
++ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
++ # glibc 2.4 and later provides __stack_chk_fail and
++ # either __stack_chk_guard, or TLS access to stack guard canary.
++@@ -27834,6 +27837,7 @@ fi
++ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
++ # simply assert that glibc does provide this, which is true for all
++ # realistically usable GNU/Hurd configurations.
+++ # All supported versions of musl provide it as well
++ gcc_cv_libc_provides_ssp=yes;;
++ *-*-darwin* | *-*-freebsd*)
++ ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
++@@ -27930,6 +27934,9 @@ case "$target" in
++ gcc_cv_target_dl_iterate_phdr=no
++ fi
++ ;;
+++ *-linux-musl*)
+++ gcc_cv_target_dl_iterate_phdr=yes
+++ ;;
++ esac
++
++ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
++--- a/gcc/configure.ac
+++++ b/gcc/configure.ac
++@@ -5282,6 +5282,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
++ gcc_cv_libc_provides_ssp,
++ [gcc_cv_libc_provides_ssp=no
++ case "$target" in
+++ *-*-musl*)
+++ # All versions of musl provide stack protector
+++ gcc_cv_libc_provides_ssp=yes;;
++ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
++ # glibc 2.4 and later provides __stack_chk_fail and
++ # either __stack_chk_guard, or TLS access to stack guard canary.
++@@ -5308,6 +5311,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
++ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
++ # simply assert that glibc does provide this, which is true for all
++ # realistically usable GNU/Hurd configurations.
+++ # All supported versions of musl provide it as well
++ gcc_cv_libc_provides_ssp=yes;;
++ *-*-darwin* | *-*-freebsd*)
++ AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
++@@ -5381,6 +5385,9 @@ case "$target" in
++ gcc_cv_target_dl_iterate_phdr=no
++ fi
++ ;;
+++ *-linux-musl*)
+++ gcc_cv_target_dl_iterate_phdr=yes
+++ ;;
++ esac
++ GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
++ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
++--- a/gcc/doc/invoke.texi
+++++ b/gcc/doc/invoke.texi
++@@ -667,7 +667,7 @@ Objective-C and Objective-C++ Dialects}.
++ -mcpu=@var{cpu}}
++
++ @emph{GNU/Linux Options}
++-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
+++@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
++ -tno-android-cc -tno-android-ld}
++
++ @emph{H8/300 Options}
++@@ -15325,13 +15325,19 @@ These @samp{-m} options are defined for
++ @item -mglibc
++ @opindex mglibc
++ Use the GNU C library. This is the default except
++-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
+++on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
+++@samp{*-*-linux-*android*} targets.
++
++ @item -muclibc
++ @opindex muclibc
++ Use uClibc C library. This is the default on
++ @samp{*-*-linux-*uclibc*} targets.
++
+++@item -mmusl
+++@opindex mmusl
+++Use the musl C library. This is the default on
+++@samp{*-*-linux-*musl*} targets.
+++
++ @item -mbionic
++ @opindex mbionic
++ Use Bionic C library. This is the default on
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 27 May 2015 13:17:11 +0000 (+0000)
++Subject: [PATCH 4/13] arm musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=de799bd087ab9a179768fea75bd195a31d3432a4
++
++[PATCH 4/13] arm musl support
++
++On behalf of szabolcs.nagy@arm.com
++
++2015-05-27 Gregor Richards <gregor.richards@uwaterloo.ca>
++
++ * config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -77,6 +77,23 @@
++ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
++ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
++
+++/* For ARM musl currently supports four dynamic linkers:
+++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
+++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
+++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
+++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
+++ musl does not support the legacy OABI mode.
+++ All the dynamic linkers live in /lib.
+++ We default to soft-float, EL. */
+++#undef MUSL_DYNAMIC_LINKER
+++#if TARGET_BIG_ENDIAN_DEFAULT
+++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
+++#else
+++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
+++#endif
+++#define MUSL_DYNAMIC_LINKER \
+++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
+++
++ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
++ use the GNU/Linux version, not the generic BPABI version. */
++ #undef LINK_SPEC
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Fri, 8 May 2015 15:16:50 +0000 (+0000)
++Subject: [PATCH 6/13] mips musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2550b6a866c887472b587bef87d433c51cf1ebc8
++
++[PATCH 6/13] mips musl support
++
++2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define.
++ (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define.
++ (GNU_USER_DYNAMIC_LINKERN32): Update.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config/mips/linux.h
+++++ b/gcc/config/mips/linux.h
++@@ -37,7 +37,13 @@ along with GCC; see the file COPYING3.
++ #define UCLIBC_DYNAMIC_LINKERN32 \
++ "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
++
+++#undef MUSL_DYNAMIC_LINKER32
+++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
+++#undef MUSL_DYNAMIC_LINKER64
+++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
+++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
+++
++ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++ #define GNU_USER_DYNAMIC_LINKERN32 \
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
++- BIONIC_DYNAMIC_LINKERN32)
+++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
--- /dev/null
--- /dev/null
++
++gcc/Changelog:
++
++2015-04-24 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config.gcc (secure_plt): Add *-linux*-musl*.
++ * config/rs6000/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
++ (MUSL_DYNAMIC_LINKER64): Define.
++ (GNU_USER_DYNAMIC_LINKER32): Update.
++ (GNU_USER_DYNAMIC_LINKER64): Update.
++ (CHOOSE_DYNAMIC_LINKER): Update.
++
++ * config/rs6000/secureplt.h (LINK_SECURE_PLT_DEFAULT_SPEC): Define.
++ * config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Update.
++ (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER_E,)
++ (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
++ (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
++ (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
++ (LINK_SECURE_PLT_DEFAULT_SPEC): Define.
++ (CHOOSE_DYNAMIC_LINKER, LINK_TARGET_SPEC, LINK_OS_LINUX_SPEC): Update.
++
++ * config/rs6000/sysv4le.h (MUSL_DYNAMIC_LINKER_E): Define.
++
++--- a/gcc/config/rs6000/linux64.h
+++++ b/gcc/config/rs6000/linux64.h
++@@ -365,17 +365,21 @@ extern int dot_symbols;
++ #endif
++ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
++ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
+++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1"
++ #if DEFAULT_LIBC == LIBC_UCLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++ #elif DEFAULT_LIBC == LIBC_GLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+++#elif DEFAULT_LIBC == LIBC_MUSL
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
++ #else
++ #error "Unsupported DEFAULT_LIBC"
++ #endif
++ #define GNU_USER_DYNAMIC_LINKER32 \
++- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
+++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
++ #define GNU_USER_DYNAMIC_LINKER64 \
++- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
+++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
++
++ #undef DEFAULT_ASM_ENDIAN
++ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
++--- a/gcc/config/rs6000/secureplt.h
+++++ b/gcc/config/rs6000/secureplt.h
++@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
++ <http://www.gnu.org/licenses/>. */
++
++ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
+++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
++--- a/gcc/config/rs6000/sysv4.h
+++++ b/gcc/config/rs6000/sysv4.h
++@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
++ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
++ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
++ #endif
+++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
+++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
+++#endif
++
++ /* Pass -G xxx to the compiler. */
++ #undef CC1_SPEC
++@@ -574,7 +577,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
++ %{R*} \
++ %(link_shlib) \
++ %{!T*: %(link_start) } \
++-%(link_os)"
+++%(link_os)" \
+++"%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
++
++ /* Shared libraries are not default. */
++ #define LINK_SHLIB_SPEC "\
++@@ -757,17 +761,22 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
++
++ #define LINK_START_LINUX_SPEC ""
++
+++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
+++
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
++ #if DEFAULT_LIBC == LIBC_UCLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+++#elif DEFAULT_LIBC == LIBC_MUSL
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
++ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
++-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
+++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++ #else
++ #error "Unsupported DEFAULT_LIBC"
++ #endif
++ #define GNU_USER_DYNAMIC_LINKER \
++- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
+++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
++
++ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
++ %{rdynamic:-export-dynamic} \
++@@ -889,6 +898,7 @@ ncrtn.o%s"
++ { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
++ { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
++ { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
+++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
++ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
++ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
++ { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
++@@ -943,3 +953,72 @@ ncrtn.o%s"
++ /* This target uses the sysv4.opt file. */
++ #define TARGET_USES_SYSV4_OPT 1
++
+++/* Include order changes for musl, same as in generic linux.h. */
+++#if DEFAULT_LIBC == LIBC_MUSL
+++#define INCLUDE_DEFAULTS_MUSL_GPP \
+++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+++
+++#ifdef LOCAL_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_LOCAL
+++#endif
+++
+++#ifdef PREFIX_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_PREFIX
+++#endif
+++
+++#ifdef CROSS_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_CROSS \
+++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_CROSS
+++#endif
+++
+++#ifdef TOOL_INCLUDE_DIR
+++#define INCLUDE_DEFAULTS_MUSL_TOOL \
+++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_TOOL
+++#endif
+++
+++#ifdef NATIVE_SYSTEM_HEADER_DIR
+++#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+++#else
+++#define INCLUDE_DEFAULTS_MUSL_NATIVE
+++#endif
+++
+++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+++# define INCLUDE_DEFAULTS_MUSL_LOCAL
+++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+++# define INCLUDE_DEFAULTS_MUSL_NATIVE
+++#else
+++# undef INCLUDE_DEFAULTS_MUSL_CROSS
+++# define INCLUDE_DEFAULTS_MUSL_CROSS
+++#endif
+++
+++#undef INCLUDE_DEFAULTS
+++#define INCLUDE_DEFAULTS \
+++ { \
+++ INCLUDE_DEFAULTS_MUSL_GPP \
+++ INCLUDE_DEFAULTS_MUSL_PREFIX \
+++ INCLUDE_DEFAULTS_MUSL_CROSS \
+++ INCLUDE_DEFAULTS_MUSL_TOOL \
+++ INCLUDE_DEFAULTS_MUSL_NATIVE \
+++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+++ { 0, 0, 0, 0, 0, 0 } \
+++ }
+++#endif
++--- a/gcc/config/rs6000/sysv4le.h
+++++ b/gcc/config/rs6000/sysv4le.h
++@@ -31,3 +31,5 @@
++ /* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */
++ #define LINUX64_DEFAULT_ABI_ELFv2
++
+++#undef MUSL_DYNAMIC_LINKER_E
+++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","le")
++--- a/gcc/config.gcc
+++++ b/gcc/config.gcc
++@@ -2416,6 +2416,10 @@ powerpc*-*-linux*)
++ powerpc*-*-linux*paired*)
++ tm_file="${tm_file} rs6000/750cl.h" ;;
++ esac
+++ case ${target} in
+++ *-linux*-musl*)
+++ enable_secureplt=yes ;;
+++ esac
++ if test x${enable_secureplt} = xyes; then
++ tm_file="rs6000/secureplt.h ${tm_file}"
++ fi
--- /dev/null
--- /dev/null
++gcc/Changelog:
++
++2015-04-27 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config/sh/linux.h (MUSL_DYNAMIC_LINKER): Define.
++ (MUSL_DYNAMIC_LINKER_E, MUSL_DYNAMIC_LINKER_FP): Define.
++
++--- a/gcc/config/sh/linux.h
+++++ b/gcc/config/sh/linux.h
++@@ -43,6 +43,28 @@ along with GCC; see the file COPYING3.
++
++ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+++#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
+++#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}"
+++#else
+++#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}"
+++#endif
+++
+++#if TARGET_CPU_DEFAULT & ( MASK_HARD_SH2A_DOUBLE | MASK_SH4 )
+++/* "-nofpu" if any nofpu option is specified */
+++#define MUSL_DYNAMIC_LINKER_FP \
+++ "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \
+++ "m4-340|m4-400|m4-500|m4al|m5-32media-nofpu|m5-64media-nofpu|" \
+++ "m5-compact-nofpu:-nofpu}"
+++#else
+++/* "-nofpu" if none of the hard fpu options are specified */
+++#define MUSL_DYNAMIC_LINKER_FP \
+++ "%{m2a|m4|m4-100|m4-200|m4-300|m4a|m5-32media|m5-64media|m5-compact:;:-nofpu}"
+++#endif
+++
+++#undef MUSL_DYNAMIC_LINKER
+++#define MUSL_DYNAMIC_LINKER \
+++ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP ".so.1"
+++
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++
++ #undef SUBTARGET_LINK_EMUL_SUFFIX
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Fri, 15 May 2015 13:20:01 +0000 (+0000)
++Subject: [PATCH 9/13] x86 musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=5551c8d927c17f60837f15f8dfe46f945ba3fa9c
++
++[PATCH 9/13] x86 musl support
++
++On behalf of Szabolcs Nagy.
++
++2015-05-15 Gregor Richards <gregor.richards@uwaterloo.ca>
++
++ * config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define.
++ * config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
++ (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config/i386/linux.h
+++++ b/gcc/config/i386/linux.h
++@@ -21,3 +21,6 @@ along with GCC; see the file COPYING3.
++
++ #define GNU_USER_LINK_EMULATION "elf_i386"
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+++
+++#undef MUSL_DYNAMIC_LINKER
+++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
++--- a/gcc/config/i386/linux64.h
+++++ b/gcc/config/i386/linux64.h
++@@ -30,3 +30,10 @@ see the files COPYING3 and COPYING.RUNTI
++ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
++ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
++ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+++
+++#undef MUSL_DYNAMIC_LINKER32
+++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
+++#undef MUSL_DYNAMIC_LINKER64
+++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
+++#undef MUSL_DYNAMIC_LINKERX32
+++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
--- /dev/null
--- /dev/null
++From: jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 27 May 2015 16:46:39 +0000 (+0000)
++Subject: [PATCH 3/13] aarch64 musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=b3ff21cf0531be91bc3fb8200296a7633090ec78
++
++[PATCH 3/13] aarch64 musl support
++
++gcc/Changelog:
++
++2015-05-27 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define.
++
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config/aarch64/aarch64-linux.h
+++++ b/gcc/config/aarch64/aarch64-linux.h
++@@ -23,6 +23,9 @@
++
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++
+++#undef MUSL_DYNAMIC_LINKER
+++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+++
++ #undef ASAN_CC1_SPEC
++ #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
++
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 22 Apr 2015 14:18:16 +0000 (+0000)
++Subject: fixincludes update for musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2dc727de2e87c2756a514cbb43cea23c99deaa3d
++
++fixincludes update for musl support
++
++On behalf of Szabolcs.Nagy@arm.com
++
++2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
++
++ * mkfixinc.sh: Add *-musl* with no fixes.
++
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222327 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/fixincludes/mkfixinc.sh
+++++ b/fixincludes/mkfixinc.sh
++@@ -19,7 +19,8 @@ case $machine in
++ powerpc-*-eabi* | \
++ powerpc-*-rtems* | \
++ powerpcle-*-eabisim* | \
++- powerpcle-*-eabi* )
+++ powerpcle-*-eabi* | \
+++ *-musl* )
++ # IF there is no include fixing,
++ # THEN create a no-op fixer and exit
++ (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 22 Apr 2015 14:24:11 +0000 (+0000)
++Subject: libstdc++, libgfortran gthr workaround for musl
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=1e5f711c11cb80ce609db9e9c1d8b2da0f7b5b61
++
++libstdc++, libgfortran gthr workaround for musl
++
++On behalf of szabolcs.nagy@arm.com
++
++[libstdc++-v3/]
++2015-04-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define.
++ * configure.host (os_include_dir): Set to "os/generic" for linux-musl*.
++
++[libgfortran/]
++2015-04-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*.
++ * configure: Regenerate.
++
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222329 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/libgfortran/acinclude.m4
+++++ b/libgfortran/acinclude.m4
++@@ -100,7 +100,7 @@ void foo (void);
++ [Define to 1 if the target supports #pragma weak])
++ fi
++ case "$host" in
++- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
+++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
++ AC_DEFINE(GTHREAD_USE_WEAK, 0,
++ [Define to 0 if the target shouldn't use #pragma weak])
++ ;;
++--- a/libgfortran/configure
+++++ b/libgfortran/configure
++@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con
++
++ fi
++ case "$host" in
++- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
+++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
++
++ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
++
++--- a/libstdc++-v3/config/os/generic/os_defines.h
+++++ b/libstdc++-v3/config/os/generic/os_defines.h
++@@ -33,4 +33,9 @@
++ // System-specific #define, typedefs, corrections, etc, go here. This
++ // file will come before all others.
++
+++// Disable the weak reference logic in gthr.h for os/generic because it
+++// is broken on every platform unless there is implementation specific
+++// workaround in gthr-posix.h and at link-time for static linking.
+++#define _GLIBCXX_GTHREAD_USE_WEAK 0
+++
++ #endif
++--- a/libstdc++-v3/configure.host
+++++ b/libstdc++-v3/configure.host
++@@ -273,6 +273,9 @@ case "${host_os}" in
++ freebsd*)
++ os_include_dir="os/bsd/freebsd"
++ ;;
+++ linux-musl*)
+++ os_include_dir="os/generic"
+++ ;;
++ gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++ if [ "$uclibc" = "yes" ]; then
++ os_include_dir="os/uclibc"
--- /dev/null
--- /dev/null
++--- a/gcc/gcc.c
+++++ b/gcc/gcc.c
++@@ -727,7 +727,9 @@ proper position among the other output f
++ #endif
++
++ #ifndef LINK_SSP_SPEC
++-#ifdef TARGET_LIBC_PROVIDES_SSP
+++#if DEFAULT_LIBC == LIBC_MUSL
+++#define LINK_SSP_SPEC "-lssp_nonshared"
+++#elif defined(TARGET_LIBC_PROVIDES_SSP)
++ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
++ "|fstack-protector-strong|fstack-protector-explicit:}"
++ #else
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 22 Apr 2015 14:11:25 +0000 (+0000)
++Subject: libitm fixes for musl support
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=e53a4d49c3d03ab8eaddb073cf972c1c46d75338
++
++libitm fixes for musl support
++
++On behalf of Szabolcs.Nagy@arm.com
++
++2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
++
++ * config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h.
++ * config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined.
++
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222325 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/libitm/config/arm/hwcap.cc
+++++ b/libitm/config/arm/hwcap.cc
++@@ -40,7 +40,7 @@ int GTM_hwcap HIDDEN = 0
++
++ #ifdef __linux__
++ #include <unistd.h>
++-#include <sys/fcntl.h>
+++#include <fcntl.h>
++ #include <elf.h>
++
++ static void __attribute__((constructor))
++--- a/libitm/config/linux/x86/tls.h
+++++ b/libitm/config/linux/x86/tls.h
++@@ -25,16 +25,19 @@
++ #ifndef LIBITM_X86_TLS_H
++ #define LIBITM_X86_TLS_H 1
++
++-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+++#if defined(__GLIBC_PREREQ)
+++#if __GLIBC_PREREQ(2, 10)
++ /* Use slots in the TCB head rather than __thread lookups.
++ GLIBC has reserved words 10 through 13 for TM. */
++ #define HAVE_ARCH_GTM_THREAD 1
++ #define HAVE_ARCH_GTM_THREAD_DISP 1
++ #endif
+++#endif
++
++ #include "config/generic/tls.h"
++
++-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+++#if defined(__GLIBC_PREREQ)
+++#if __GLIBC_PREREQ(2, 10)
++ namespace GTM HIDDEN {
++
++ #ifdef __x86_64__
++@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
++
++ } // namespace GTM
++ #endif /* >= GLIBC 2.10 */
+++#endif
++
++ #endif // LIBITM_X86_TLS_H
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Fri, 8 May 2015 08:30:40 +0000 (+0000)
++Subject: [PATCH 0/13] Add musl support to GCC
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e
++
++[PATCH 0/13] Add musl support to GCC
++
++2015-05-08 Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * config/glibc-stdint.h (OPTION_MUSL): Define.
++ (INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE):
++ Change the definition based on OPTION_MUSL for 64 bit targets.
++ * config/linux.h (OPTION_MUSL): Redefine.
++ * config/alpha/linux.h (OPTION_MUSL): Redefine.
++ * config/rs6000/linux.h (OPTION_MUSL): Redefine.
++ * config/rs6000/linux64.h (OPTION_MUSL): Redefine.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/gcc/config/alpha/linux.h
+++++ b/gcc/config/alpha/linux.h
++@@ -61,10 +61,14 @@ along with GCC; see the file COPYING3.
++ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
++ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
++ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
++ #else
++ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
++ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
++ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
++ #endif
++
++ /* Determine what functions are present at the runtime;
++--- a/gcc/config/glibc-stdint.h
+++++ b/gcc/config/glibc-stdint.h
++@@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Except
++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
++ <http://www.gnu.org/licenses/>. */
++
+++/* Systems using musl libc should use this header and make sure
+++ OPTION_MUSL is defined correctly before using the TYPE macros. */
+++#ifndef OPTION_MUSL
+++#define OPTION_MUSL 0
+++#endif
+++
++ #define SIG_ATOMIC_TYPE "int"
++
++ #define INT8_TYPE "signed char"
++@@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTI
++ #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++ #define INT_FAST8_TYPE "signed char"
++-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+++#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
+++#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
++ #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++ #define UINT_FAST8_TYPE "unsigned char"
++-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
++-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
+++#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
+++#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
++ #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++ #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++--- a/gcc/config/linux.h
+++++ b/gcc/config/linux.h
++@@ -32,11 +32,13 @@ see the files COPYING3 and COPYING.RUNTI
++ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
++ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
++ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+++#undef OPTION_MUSL
++ #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
++ #else
++ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
++ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
++ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+++#undef OPTION_MUSL
++ #define OPTION_MUSL (linux_libc == LIBC_MUSL)
++ #endif
++
++--- a/gcc/config/rs6000/linux.h
+++++ b/gcc/config/rs6000/linux.h
++@@ -30,10 +30,14 @@
++ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
++ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
++ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
++ #else
++ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
++ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
++ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
++ #endif
++
++ /* Determine what functions are present at the runtime;
++--- a/gcc/config/rs6000/linux64.h
+++++ b/gcc/config/rs6000/linux64.h
++@@ -299,10 +299,14 @@ extern int dot_symbols;
++ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
++ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
++ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
++ #else
++ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
++ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
++ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+++#undef OPTION_MUSL
+++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
++ #endif
++
++ /* Determine what functions are present at the runtime;
--- /dev/null
--- /dev/null
++From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Wed, 22 Apr 2015 14:20:01 +0000 (+0000)
++Subject: unwind fix for musl
++X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a2e31d0681d8a47389b8a3552622fbd9827bcef4
++
++unwind fix for musl
++
++On behalf of szabolcs.nagy@arm.com
++
++2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
++ Szabolcs Nagy <szabolcs.nagy@arm.com>
++
++ * unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on
++ Linux if target provides dl_iterate_phdr.
++
++
++git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4
++---
++
++--- a/libgcc/unwind-dw2-fde-dip.c
+++++ b/libgcc/unwind-dw2-fde-dip.c
++@@ -59,6 +59,12 @@
++
++ #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++ && defined(TARGET_DL_ITERATE_PHDR) \
+++ && defined(__linux__)
+++# define USE_PT_GNU_EH_FRAME
+++#endif
+++
+++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+++ && defined(TARGET_DL_ITERATE_PHDR) \
++ && (defined(__DragonFly__) || defined(__FreeBSD__))
++ # define ElfW __ElfN
++ # define USE_PT_GNU_EH_FRAME
--- /dev/null
--- /dev/null
++--- a/gcc/config/rs6000/linux64.h
+++++ b/gcc/config/rs6000/linux64.h
++@@ -369,8 +369,8 @@ extern int dot_symbols;
++ #endif
++ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
++ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
++-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1"
+++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++ #if DEFAULT_LIBC == LIBC_UCLIBC
++ #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++ #elif DEFAULT_LIBC == LIBC_GLIBC
++--- a/gcc/config/rs6000/sysv4.h
+++++ b/gcc/config/rs6000/sysv4.h
++@@ -765,7 +765,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
++
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
+++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++ #if DEFAULT_LIBC == LIBC_UCLIBC
++ #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++ #elif DEFAULT_LIBC == LIBC_MUSL
--- /dev/null
--- /dev/null
++--- a/gcc/config/arm/arm.h
+++++ b/gcc/config/arm/arm.h
++@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att
++ /* Thumb-1 only. */
++ #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
++
++-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
+++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
++ && !TARGET_THUMB1)
++
++ #define TARGET_CRC32 (arm_arch_crc)
--- /dev/null
--- /dev/null
++--- a/libgcc/config/arm/t-linux
+++++ b/libgcc/config/arm/t-linux
++@@ -1,6 +1,10 @@
++ LIB1ASMSRC = arm/lib1funcs.S
++ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
++- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+++ _arm_fixsfsi _arm_fixunssfsi
++
++ # Just for these, we omit the frame pointer since it makes such a big
++ # difference.
++--- a/gcc/config/arm/linux-elf.h
+++++ b/gcc/config/arm/linux-elf.h
++@@ -60,8 +60,6 @@
++ %{shared:-lc} \
++ %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
++
++-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
++-
++ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++
++ #define LINUX_TARGET_LINK_SPEC "%{h*} \
--- /dev/null
--- /dev/null
++--- a/libgcc/Makefile.in
+++++ b/libgcc/Makefile.in
++@@ -887,11 +887,12 @@ $(libgcov-driver-objects): %$(objext): $
++
++ # Static libraries.
++ libgcc.a: $(libgcc-objects)
+++libgcc_pic.a: $(libgcc-s-objects)
++ libgcov.a: $(libgcov-objects)
++ libunwind.a: $(libunwind-objects)
++ libgcc_eh.a: $(libgcc-eh-objects)
++
++-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
++ -rm -f $@
++
++ objects="$(objects)"; \
++@@ -913,7 +914,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
++ endif
++
++ ifeq ($(enable_shared),yes)
++-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
++ ifneq ($(LIBUNWIND),)
++ all: libunwind$(SHLIB_EXT)
++ endif
++@@ -1108,6 +1109,10 @@ install-shared:
++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++
+++ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++
++ $(subst @multilib_dir@,$(MULTIDIR),$(subst \
++ @shlib_base_name@,libgcc_s,$(subst \
++ @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
--- /dev/null
--- /dev/null
++http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
++
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -45,7 +45,7 @@
++ The ARM10TDMI core is the default for armv5t, so set
++ SUBTARGET_CPU_DEFAULT to achieve this. */
++ #undef SUBTARGET_CPU_DEFAULT
++-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
+++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
++
++ /* TARGET_BIG_ENDIAN_DEFAULT is set in
++ config.gcc for big endian configurations. */
--- /dev/null
--- /dev/null
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -94,10 +94,15 @@
++ #define MUSL_DYNAMIC_LINKER \
++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+++/* For armv4 we pass --fix-v4bx to linker to support EABI */
+++#undef TARGET_FIX_V4BX_SPEC
+++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+++ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+++
++ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
++ use the GNU/Linux version, not the generic BPABI version. */
++ #undef LINK_SPEC
++-#define LINK_SPEC EABI_LINK_SPEC \
+++#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
++ LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
++ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
++
--- /dev/null
--- /dev/null
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -131,10 +131,6 @@
++ #define ENDFILE_SPEC \
++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
++
++-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
++- do not use -lfloat. */
++-#undef LIBGCC_SPEC
++-
++ /* Clear the instruction cache from `beg' to `end'. This is
++ implemented in lib1funcs.S, so ensure an error if this definition
++ is used. */
++--- a/gcc/config/linux.h
+++++ b/gcc/config/linux.h
++@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI
++ builtin_assert ("system=posix"); \
++ } while (0)
++
+++#ifndef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+++#endif
+++
++ /* Determine which dynamic linker to use depending on whether GLIBC or
++ uClibc or Bionic or musl is the default C library and whether
++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
++--- a/libgcc/mkmap-symver.awk
+++++ b/libgcc/mkmap-symver.awk
++@@ -132,5 +132,5 @@ function output(lib) {
++ else if (inherit[lib])
++ printf("} %s;\n", inherit[lib]);
++ else
++- printf ("\n local:\n\t*;\n};\n");
+++ printf ("\n\t*;\n};\n");
++ }
++--- a/gcc/config/rs6000/linux.h
+++++ b/gcc/config/rs6000/linux.h
++@@ -60,6 +60,9 @@
++ #undef CPP_OS_DEFAULT_SPEC
++ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
++
+++#undef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+++
++ #undef LINK_SHLIB_SPEC
++ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
++
--- /dev/null
--- /dev/null
++--- a/libgcc/config/t-libunwind
+++++ b/libgcc/config/t-libunwind
++@@ -2,8 +2,7 @@
++
++ HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
++
++-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
++- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++ LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++
++ # Override the default value from t-slibgcc-elf-ver and mention -lunwind
--- /dev/null
--- /dev/null
++--- a/gcc/config/rs6000/rs6000.c
+++++ b/gcc/config/rs6000/rs6000.c
++@@ -21495,7 +21495,7 @@ rs6000_savres_strategy (rs6000_stack_t *
++ /* Define cutoff for using out-of-line functions to save registers. */
++ if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
++ {
++- if (!optimize_size)
+++ if (1)
++ {
++ strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
++ strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
--- /dev/null
--- /dev/null
++--- a/gcc/defaults.h
+++++ b/gcc/defaults.h
++@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
++ /* If we have named section and we support weak symbols, then use the
++ .jcr section for recording java classes which need to be registered
++ at program start-up time. */
++-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
++ #ifndef JCR_SECTION_NAME
++ #define JCR_SECTION_NAME ".jcr"
++ #endif
--- /dev/null
--- /dev/null
++--- a/libgcc/config/mips/t-mips16
+++++ b/libgcc/config/mips/t-mips16
++@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
++
++ # Version these symbols if building libgcc.so.
++ SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+++
+++CRTSTUFF_T_CFLAGS += -mno-mips16
+++CRTSTUFF_T_CFLAGS_S += -mno-mips16
--- /dev/null
--- /dev/null
++
++ This patch brings over a few features from MirBSD:
++ * -fhonour-copts
++ If this option is not given, it's warned (depending
++ on environment variables). This is to catch errors
++ of misbuilt packages which override CFLAGS themselves.
++ * -Werror-maybe-reset
++ Has the effect of -Wno-error if GCC_NO_WERROR is
++ set and not '0', a no-operation otherwise. This is
++ to be able to use -Werror in "make" but prevent
++ GNU autoconf generated configure scripts from
++ freaking out.
++
++ This patch was authored by Thorsten Glaser <tg at mirbsd.de>
++ with copyright assignment to the FSF in effect.
++
++--- a/gcc/c-family/c-opts.c
+++++ b/gcc/c-family/c-opts.c
++@@ -122,6 +122,9 @@ static int class_dump_flags;
++ /* Whether any standard preincluded header has been preincluded. */
++ static bool done_preinclude;
++
+++/* Check if a port honours COPTS. */
+++static int honour_copts = 0;
+++
++ static void handle_OPT_d (const char *);
++ static void set_std_cxx98 (int);
++ static void set_std_cxx11 (int);
++@@ -449,6 +452,12 @@ c_common_handle_option (size_t scode, co
++ flag_no_builtin = !value;
++ break;
++
+++ case OPT_fhonour_copts:
+++ if (c_language == clk_c) {
+++ honour_copts++;
+++ }
+++ break;
+++
++ case OPT_fconstant_string_class_:
++ constant_string_class_name = arg;
++ break;
++@@ -1034,6 +1043,47 @@ c_common_init (void)
++ return false;
++ }
++
+++ if (c_language == clk_c) {
+++ char *ev = getenv ("GCC_HONOUR_COPTS");
+++ int evv;
+++ if (ev == NULL)
+++ evv = -1;
+++ else if ((*ev == '0') || (*ev == '\0'))
+++ evv = 0;
+++ else if (*ev == '1')
+++ evv = 1;
+++ else if (*ev == '2')
+++ evv = 2;
+++ else if (*ev == 's')
+++ evv = -1;
+++ else {
+++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+++ }
+++ if (evv == 1) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in lenient mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ warning (0, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ } else if (evv == 2) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in strict mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ error ("someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ return false;
+++ }
+++ } else if (evv == 0) {
+++ if (honour_copts != 1)
+++ inform (0, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ }
+++
++ return true;
++ }
++
++--- a/gcc/c-family/c.opt
+++++ b/gcc/c-family/c.opt
++@@ -431,6 +431,10 @@ Wfloat-conversion
++ C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
++ Warn for implicit type conversions that cause loss of floating point precision
++
+++Werror-maybe-reset
+++C ObjC C++ ObjC++
+++; Documented in common.opt
+++
++ Wfloat-equal
++ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
++ Warn if testing floating point numbers for equality
++@@ -1161,6 +1165,9 @@ C++ ObjC++ Optimization Alias(fexception
++ fhonor-std
++ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
++
+++fhonour-copts
+++C ObjC C++ ObjC++ RejectNegative
+++
++ fhosted
++ C ObjC
++ Assume normal C execution environment
++--- a/gcc/common.opt
+++++ b/gcc/common.opt
++@@ -561,6 +561,10 @@ Werror=
++ Common Joined
++ Treat specified warning as error
++
+++Werror-maybe-reset
+++Common
+++If environment variable GCC_NO_WERROR is set, act as -Wno-error
+++
++ Wextra
++ Common Var(extra_warnings) Warning
++ Print extra (possibly unwanted) warnings
++@@ -1360,6 +1364,9 @@ fguess-branch-probability
++ Common Report Var(flag_guess_branch_prob) Optimization
++ Enable guessing of branch probabilities
++
+++fhonour-copts
+++Common RejectNegative
+++
++ ; Nonzero means ignore `#ident' directives. 0 means handle them.
++ ; Generate position-independent code for executables if possible
++ ; On SVR4 targets, it also controls whether or not to emit a
++--- a/gcc/opts.c
+++++ b/gcc/opts.c
++@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options
++ opts, opts_set, loc, dc);
++ break;
++
+++ case OPT_Werror_maybe_reset:
+++ {
+++ char *ev = getenv ("GCC_NO_WERROR");
+++ if ((ev != NULL) && (*ev != '0'))
+++ warnings_are_errors = 0;
+++ }
+++ break;
+++
+++ case OPT_fhonour_copts:
+++ break;
+++
++ case OPT_Wlarger_than_:
++ opts->x_larger_than_size = value;
++ opts->x_warn_larger_than = value != -1;
++--- a/gcc/doc/cppopts.texi
+++++ b/gcc/doc/cppopts.texi
++@@ -163,6 +163,11 @@ in older programs. This warning is on b
++ Make all warnings into hard errors. Source code which triggers warnings
++ will be rejected.
++
+++ at item -Werror-maybe-reset
+++ at opindex Werror-maybe-reset
+++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+++variable is set to anything other than 0 or empty.
+++
++ @item -Wsystem-headers
++ @opindex Wsystem-headers
++ Issue warnings for code in system headers. These are normally unhelpful
++--- a/gcc/doc/invoke.texi
+++++ b/gcc/doc/invoke.texi
++@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}.
++ -Wdisabled-optimization @gol
++ -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
++ -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
++--Wno-endif-labels -Werror -Werror=* @gol
+++-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
++ -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
++ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
++ -Wformat-security -Wformat-signedness -Wformat-y2k @gol
++@@ -5371,6 +5371,22 @@ This option is only supported for C and
++ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
++ @option{-Wno-pointer-sign}.
++
+++ at item -Werror-maybe-reset
+++ at opindex Werror-maybe-reset
+++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+++variable is set to anything other than 0 or empty.
+++
+++ at item -fhonour-copts
+++ at opindex fhonour-copts
+++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+++given at least once, and warn if it is given more than once.
+++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+++given exactly once.
+++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+++is not given exactly once.
+++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+++This flag and environment variable only affect the C language.
+++
++ @item -Wstack-protector
++ @opindex Wstack-protector
++ @opindex Wno-stack-protector
++@@ -7845,7 +7861,7 @@ so, the first branch is redirected to ei
++ second branch or a point immediately following it, depending on whether
++ the condition is known to be true or false.
++
++-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+++Enabled at levels @option{-O3}.
++
++ @item -fsplit-wide-types
++ @opindex fsplit-wide-types
++--- a/gcc/java/jvspec.c
+++++ b/gcc/java/jvspec.c
++@@ -629,6 +629,7 @@ lang_specific_pre_link (void)
++ class name. Append dummy `.c' that can be stripped by set_input so %b
++ is correct. */
++ set_input (concat (main_class_name, "main.c", NULL));
+++ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
++ err = do_spec (jvgenmain_spec);
++ if (err == 0)
++ {
--- /dev/null
--- /dev/null
++--- a/gcc/gcc.c
+++++ b/gcc/gcc.c
++@@ -8807,8 +8807,10 @@ getenv_spec_function (int argc, const ch
++
++ value = getenv (argv[0]);
++ if (!value)
++- fatal_error (input_location,
++- "environment variable %qs not defined", argv[0]);
+++ {
+++ warning (input_location, "environment variable %qs not defined", argv[0]);
+++ value = "";
+++ }
++
++ /* We have to escape every character of the environment variable so
++ they are not interpreted as active spec characters. A
--- /dev/null
--- /dev/null
++From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
++From: Andrew McDonnell <bugs@andrewmcdonnell.net>
++Date: Fri, 3 Oct 2014 19:09:00 +0930
++Subject: Add .note.GNU-stack section
++
++See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
++Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
++
++Re: [Patch, MIPS] Add .note.GNU-stack section
++
++ From: Steve Ellcey <sellcey at mips dot com>
++
++On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
++>
++>
++> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
++
++> This works except you did not update the assembly files in
++> libgcc or glibc. We (Cavium) have the same patch in our tree
++> for a few released versions.
++
++> Mind just checking yours in then Andrew?
++
++> Thanks!
++> -eric
++
++I talked to Andrew about what files he changed in GCC and created and
++tested this new patch. Andrew also mentioned changing some assembly
++files in glibc but I don't see any use of '.section .note.GNU-stack' in
++any assembly files in glibc (for any platform) so I wasn't planning on
++creating a glibc to add them to mips glibc assembly language files.
++
++OK to check in this patch?
++
++Steve Ellcey
++sellcey@mips.com
++
++
++
++2014-09-26 Steve Ellcey <sellcey@mips.com>
++---
++ gcc/config/mips/mips.c | 3 +++
++ libgcc/config/mips/crti.S | 4 ++++
++ libgcc/config/mips/crtn.S | 3 +++
++ libgcc/config/mips/mips16.S | 4 ++++
++ libgcc/config/mips/vr4120-div.S | 4 ++++
++ 5 files changed, 18 insertions(+)
++
++--- a/gcc/config/mips/mips.c
+++++ b/gcc/config/mips/mips.c
++@@ -19629,6 +19629,9 @@ mips_lra_p (void)
++ #undef TARGET_LRA_P
++ #define TARGET_LRA_P mips_lra_p
++
+++#undef TARGET_ASM_FILE_END
+++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+++
++ struct gcc_target targetm = TARGET_INITIALIZER;
++ \f
++ #include "gt-mips.h"
++--- a/libgcc/config/mips/crti.S
+++++ b/libgcc/config/mips/crti.S
++@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
++ <http://www.gnu.org/licenses/>. */
++
+++
+++/* An executable stack is *not* required for these functions. */
+++ .section .note.GNU-stack,"",%progbits
+++
++ /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
++ Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
++
++--- a/libgcc/config/mips/crtn.S
+++++ b/libgcc/config/mips/crtn.S
++@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
++ <http://www.gnu.org/licenses/>. */
++
+++/* An executable stack is *not* required for these functions. */
+++ .section .note.GNU-stack,"",%progbits
+++
++ /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
++ Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
++
++--- a/libgcc/config/mips/mips16.S
+++++ b/libgcc/config/mips/mips16.S
++@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI
++ values using the soft-float calling convention, but do the actual
++ operation using the hard floating point instructions. */
++
+++/* An executable stack is *not* required for these functions. */
+++ .section .note.GNU-stack,"",%progbits
+++ .previous
+++
++ #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
++
++ /* This file contains 32-bit assembly code. */
++--- a/libgcc/config/mips/vr4120-div.S
+++++ b/libgcc/config/mips/vr4120-div.S
++@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
++ -mfix-vr4120. div and ddiv do not give the correct result when one
++ of the operands is negative. */
++
+++/* An executable stack is *not* required for these functions. */
+++ .section .note.GNU-stack,"",%progbits
+++ .previous
+++
++ .set nomips16
++
++ #define DIV \
--- /dev/null
--- /dev/null
++--- a/libstdc++-v3/include/Makefile.in
+++++ b/libstdc++-v3/include/Makefile.in
++@@ -1420,7 +1420,7 @@ stamp-bits: ${bits_headers}
++ @$(STAMP) stamp-bits
++
++ stamp-bits-sup: stamp-bits ${bits_sup_headers}
++- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+++ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
++ @$(STAMP) stamp-bits-sup
++
++ stamp-c_base: ${c_base_headers}
--- /dev/null
--- /dev/null
++Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047
++
++--- a/gcc/c-family/c-opts.c
+++++ b/gcc/c-family/c-opts.c
++@@ -581,6 +581,10 @@ c_common_handle_option (size_t scode, co
++ add_path (xstrdup (arg), SYSTEM, 0, true);
++ break;
++
+++ case OPT_iremap:
+++ add_cpp_remap_path (arg);
+++ break;
+++
++ case OPT_iwithprefix:
++ add_prefixed_path (arg, SYSTEM);
++ break;
++--- a/gcc/c-family/c.opt
+++++ b/gcc/c-family/c.opt
++@@ -1528,6 +1528,10 @@ iquote
++ C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
++ -iquote <dir> Add <dir> to the end of the quote include path
++
+++iremap
+++C ObjC C++ ObjC++ Joined Separate
+++-iremap <src:dst> Convert <src> to <dst> if it occurs as prefix in __FILE__.
+++
++ iwithprefix
++ C ObjC C++ ObjC++ Joined Separate
++ -iwithprefix <dir> Add <dir> to the end of the system include path
++--- a/gcc/doc/cpp.texi
+++++ b/gcc/doc/cpp.texi
++@@ -4441,6 +4441,7 @@ without notice.
++ @c man begin SYNOPSIS
++ cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
++ [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}]
+++ [@option{-iremap}@var{src}:@var{dst}]
++ [@option{-W}@var{warn}@dots{}]
++ [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}]
++ [@option{-MP}] [@option{-MQ} @var{target}@dots{}]
++--- a/gcc/doc/cppopts.texi
+++++ b/gcc/doc/cppopts.texi
++@@ -532,6 +532,12 @@ Search @var{dir} only for header files r
++ If @var{dir} begins with @code{=}, then the @code{=} will be replaced
++ by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
++
+++@item -iremap @var{src}:@var{dst}
+++@opindex iremap
+++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
+++This option can be specified more than once. Processing stops at the first
+++match.
+++
++ @item -fdirectives-only
++ @opindex fdirectives-only
++ When preprocessing, handle directives, but do not expand macros.
++--- a/gcc/doc/invoke.texi
+++++ b/gcc/doc/invoke.texi
++@@ -494,8 +494,8 @@ Objective-C and Objective-C++ Dialects}.
++ @item Directory Options
++ @xref{Directory Options,,Options for Directory Search}.
++ @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
++--iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
++---sysroot=@var{dir} --no-sysroot-suffix}
+++-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -specs=@var{file} @gol
+++-I- --sysroot=@var{dir} --no-sysroot-suffix}
++
++ @item Machine Dependent Options
++ @xref{Submodel Options,,Hardware Models and Configurations}.
++@@ -11464,6 +11464,12 @@ be searched for header files only for th
++ "@var{file}"}; they are not searched for @code{#include <@var{file}>},
++ otherwise just like @option{-I}.
++
+++@item -iremap @var{src}:@var{dst}
+++@opindex iremap
+++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
+++This option can be specified more than once. Processing stops at the first
+++match.
+++
++ @item -L@var{dir}
++ @opindex L
++ Add directory @var{dir} to the list of directories to be searched
++--- a/libcpp/include/cpplib.h
+++++ b/libcpp/include/cpplib.h
++@@ -751,6 +751,9 @@ extern void cpp_set_lang (cpp_reader *,
++ /* Set the include paths. */
++ extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
++
+++/* Provide src:dst pair for __FILE__ remapping. */
+++extern void add_cpp_remap_path (const char *);
+++
++ /* Call these to get pointers to the options, callback, and deps
++ structures for a given reader. These pointers are good until you
++ call cpp_finish on that reader. You can either edit the callbacks
++--- a/libcpp/macro.c
+++++ b/libcpp/macro.c
++@@ -224,6 +224,64 @@ static const char * const monthnames[] =
++ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
++ };
++
+++static size_t remap_pairs;
+++static char **remap_src;
+++static char **remap_dst;
+++
+++void
+++add_cpp_remap_path (const char *arg)
+++{
+++ const char *arg_dst;
+++ size_t len;
+++
+++ arg_dst = strchr(arg, ':');
+++ if (arg_dst == NULL)
+++ {
+++ fprintf(stderr, "Invalid argument for -iremap\n");
+++ exit(1);
+++ }
+++
+++ len = arg_dst - arg;
+++ ++arg_dst;
+++
+++ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1));
+++ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1));
+++
+++ remap_src[remap_pairs] = (char *) xmalloc(len + 1);
+++ memcpy(remap_src[remap_pairs], arg, len);
+++ remap_src[remap_pairs][len] = '\0';
+++ remap_dst[remap_pairs] = xstrdup(arg_dst);
+++ ++remap_pairs;
+++}
+++
+++static const char *
+++cpp_remap_file (const char *arg, char **tmp_name)
+++{
+++ char *result;
+++ size_t i, len;
+++
+++ for (i = 0; i < remap_pairs; ++i)
+++ {
+++ len = strlen (remap_src[i]);
+++ if (strncmp (remap_src[i], arg, len))
+++ continue;
+++ if (arg[len] == '\0')
+++ return xstrdup (remap_dst[i]);
+++ if (arg[len] != '/')
+++ continue;
+++ arg += len;
+++ len = strlen (remap_dst[i]);
+++ result = (char *) xmalloc (len + strlen (arg) + 1);
+++ memcpy(result, remap_dst[i], len);
+++ strcpy(result + len, arg);
+++ *tmp_name = result;
+++
+++ return result;
+++ }
+++
+++ return arg;
+++}
+++
++ /* Helper function for builtin_macro. Returns the text generated by
++ a builtin macro. */
++ const uchar *
++@@ -286,6 +344,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
++ {
++ unsigned int len;
++ const char *name;
+++ char *tmp_name = NULL;
++ uchar *buf;
++
++ if (node->value.builtin == BT_FILE)
++@@ -297,6 +356,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
++ if (!name)
++ abort ();
++ }
+++ name = cpp_remap_file (name, &tmp_name);
++ len = strlen (name);
++ buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
++ result = buf;
++@@ -304,6 +364,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
++ buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len);
++ *buf++ = '"';
++ *buf = '\0';
+++ free (tmp_name);
++ }
++ break;
++
--- /dev/null
--- /dev/null
++Revert of:
++
++commit 275035b56823b26d5fb7e90fad945b998648edf2
++Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
++Date: Thu Sep 5 14:09:07 2013 +0000
++
++ PR target/58139
++ * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
++ looking for widest mode.
++
++
++ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
++
++
++--- a/gcc/reginfo.c
+++++ b/gcc/reginfo.c
++@@ -620,35 +620,40 @@ choose_hard_reg_mode (unsigned int regno
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
+++ if (found_mode != VOIDmode)
+++ return found_mode;
+++
++ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
++ mode != VOIDmode;
++ mode = GET_MODE_WIDER_MODE (mode))
++ if ((unsigned) hard_regno_nregs[regno][mode] == nregs
++ && HARD_REGNO_MODE_OK (regno, mode)
++- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
++- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
++ found_mode = mode;
++
++ if (found_mode != VOIDmode)
--- /dev/null
--- /dev/null
++--- /dev/null
+++++ b/gcc/testsuite/gcc.dg/visibility-21.c
++@@ -0,0 +1,14 @@
+++/* PR target/32219 */
+++/* { dg-do run } */
+++/* { dg-require-visibility "" } */
+++/* { dg-options "-fPIC" { target fpic } } */
+++
+++extern void f() __attribute__((weak,visibility("hidden")));
+++extern int puts( char const* );
+++int main()
+++{
+++ if (f)
+++ f();
+++ return 0;
+++}
+++
++--- a/gcc/varasm.c
+++++ b/gcc/varasm.c
++@@ -6677,6 +6677,10 @@ default_binds_local_p_1 (const_tree exp,
++ /* Static variables are always local. */
++ else if (! TREE_PUBLIC (exp))
++ local_p = true;
+++ /* hidden weak can't be overridden by something non-local, all
+++ that is possible is that it is not defined at all. */
+++ else if (DECL_WEAK (exp))
+++ local_p = false;
++ /* A variable is local if the user has said explicitly that it will
++ be. */
++ else if ((DECL_VISIBILITY_SPECIFIED (exp)
++@@ -6690,11 +6694,6 @@ default_binds_local_p_1 (const_tree exp,
++ local. */
++ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
++ local_p = true;
++- /* Default visibility weak data can be overridden by a strong symbol
++- in another module and so are not local. */
++- else if (DECL_WEAK (exp)
++- && !resolved_locally)
++- local_p = false;
++ /* If PIC, then assume that any global name can be overridden by
++ symbols resolved from other modules. */
++ else if (shlib)
--- /dev/null
--- /dev/null
++--- a/gcc/c/c-typeck.c
+++++ b/gcc/c/c-typeck.c
++@@ -62,9 +62,9 @@ int in_typeof;
++ if expr.original_code == SIZEOF_EXPR. */
++ tree c_last_sizeof_arg;
++
++-/* Nonzero if we've already printed a "missing braces around initializer"
++- message within this initializer. */
++-static int missing_braces_mentioned;
+++/* Nonzero if we might need to print a "missing braces around
+++ initializer" message within this initializer. */
+++static int found_missing_braces;
++
++ static int require_constant_value;
++ static int require_constant_elements;
++@@ -6363,6 +6363,9 @@ static int constructor_nonconst;
++ /* 1 if this constructor is erroneous so far. */
++ static int constructor_erroneous;
++
+++/* 1 if this constructor is the universal zero initializer { 0 }. */
+++static int constructor_zeroinit;
+++
++ /* Structure for managing pending initializer elements, organized as an
++ AVL tree. */
++
++@@ -6524,7 +6527,7 @@ start_init (tree decl, tree asmspec_tree
++ constructor_stack = 0;
++ constructor_range_stack = 0;
++
++- missing_braces_mentioned = 0;
+++ found_missing_braces = 0;
++
++ spelling_base = 0;
++ spelling_size = 0;
++@@ -6619,6 +6622,7 @@ really_start_incremental_init (tree type
++ constructor_type = type;
++ constructor_incremental = 1;
++ constructor_designated = 0;
+++ constructor_zeroinit = 1;
++ designator_depth = 0;
++ designator_erroneous = 0;
++
++@@ -6816,11 +6820,8 @@ push_init_level (int implicit, struct ob
++ set_nonincremental_init (braced_init_obstack);
++ }
++
++- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
++- {
++- missing_braces_mentioned = 1;
++- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
++- }
+++ if (implicit == 1)
+++ found_missing_braces = 1;
++
++ if (TREE_CODE (constructor_type) == RECORD_TYPE
++ || TREE_CODE (constructor_type) == UNION_TYPE)
++@@ -6953,16 +6954,23 @@ pop_init_level (int implicit, struct obs
++ }
++ }
++
+++ if (vec_safe_length (constructor_elements) != 1)
+++ constructor_zeroinit = 0;
+++
+++ /* Warn when some structs are initialized with direct aggregation. */
+++ if (!implicit && found_missing_braces && warn_missing_braces
+++ && !constructor_zeroinit)
+++ {
+++ warning_init (OPT_Wmissing_braces,
+++ "missing braces around initializer");
+++ }
+++
++ /* Warn when some struct elements are implicitly initialized to zero. */
++ if (warn_missing_field_initializers
++ && constructor_type
++ && TREE_CODE (constructor_type) == RECORD_TYPE
++ && constructor_unfilled_fields)
++ {
++- bool constructor_zeroinit =
++- (vec_safe_length (constructor_elements) == 1
++- && integer_zerop ((*constructor_elements)[0].value));
++-
++ /* Do not warn for flexible array members or zero-length arrays. */
++ while (constructor_unfilled_fields
++ && (!DECL_SIZE (constructor_unfilled_fields)
++@@ -8077,6 +8085,9 @@ process_init_element (struct c_expr valu
++ designator_depth = 0;
++ designator_erroneous = 0;
++
+++ if (!implicit && value.value && !integer_zerop (value.value))
+++ constructor_zeroinit = 0;
+++
++ /* Handle superfluous braces around string cst as in
++ char x[] = {"foo"}; */
++ if (string_flag
--- /dev/null
--- /dev/null
++--- a/include/filenames.h
+++++ b/include/filenames.h
++@@ -43,11 +43,6 @@ extern "C" {
++ # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
++ #else /* not DOSish */
++-# if defined(__APPLE__)
++-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
++-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
++-# endif
++-# endif /* __APPLE__ */
++ # define HAS_DRIVE_SPEC(f) (0)
++ # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
++ # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
--- /dev/null
--- /dev/null
++--- a/gcc/Makefile.in
+++++ b/gcc/Makefile.in
++@@ -4327,18 +4327,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
++ doc/gccint.info: $(TEXI_GCCINT_FILES)
++ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
++
++-doc/%.info: %.texi
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/%.info:
++
++ # Duplicate entry to handle renaming of gccinstall.info
++-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
++- if [ x$(BUILD_INFO) = xinfo ]; then \
++- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
++- -I $(gcc_docdir)/include -o $@ $<; \
++- fi
+++doc/gccinstall.info:
++
++ doc/cpp.dvi: $(TEXI_CPP_FILES)
++ doc/gcc.dvi: $(TEXI_GCC_FILES)
--- /dev/null
--- /dev/null
++--- a/gcc/calls.c
+++++ b/gcc/calls.c
++@@ -176,6 +176,12 @@ prepare_call_address (tree fndecl, rtx f
++ && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
++ ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
++ : memory_address (FUNCTION_MODE, funexp));
+++ else if (flag_pic && !flag_plt && fndecl
+++ && TREE_CODE (fndecl) == FUNCTION_DECL
+++ && !targetm.binds_local_p (fndecl))
+++ {
+++ funexp = force_reg (Pmode, funexp);
+++ }
++ else if (! sibcallp)
++ {
++ #ifndef NO_FUNCTION_CSE
++--- a/gcc/common.opt
+++++ b/gcc/common.opt
++@@ -1617,6 +1617,10 @@ fpie
++ Common Report Var(flag_pie,1) Negative(fPIC)
++ Generate position-independent code for executables if possible (small mode)
++
+++fplt
+++Common Report Var(flag_plt) Init(1)
+++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
+++
++ fplugin=
++ Common Joined RejectNegative Var(common_deferred_options) Defer
++ Specify a plugin to load
--- /dev/null
--- /dev/null
++--- a/contrib/regression/objs-gcc.sh
+++++ b/contrib/regression/objs-gcc.sh
++@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
++ then
++ make all-gdb all-dejagnu all-ld || exit 1
++ make install-gdb install-dejagnu install-ld || exit 1
+++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+++ then
+++ make all-gdb all-dejagnu all-ld || exit 1
+++ make install-gdb install-dejagnu install-ld || exit 1
++ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
++ make bootstrap || exit 1
++ make install || exit 1
++--- a/libjava/classpath/ltconfig
+++++ b/libjava/classpath/ltconfig
++@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
++
++ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
++ case $host_os in
++-linux-gnu*) ;;
+++linux-gnu*|linux-uclibc*) ;;
++ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
++ esac
++
++@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
++ ;;
++
++ # This must be Linux ELF.
++-linux-gnu*)
+++linux*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
--- /dev/null
--- /dev/null
++--- a/libsanitizer/interception/interception_type_test.cc
+++++ b/libsanitizer/interception/interception_type_test.cc
++@@ -31,7 +31,7 @@ COMPILER_CHECK(sizeof(OFF64_T) == sizeof
++ // rest (they depend on _FILE_OFFSET_BITS setting when building an application).
++ # if defined(__ANDROID__) || !defined _FILE_OFFSET_BITS || \
++ _FILE_OFFSET_BITS != 64
++-COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
+++// COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
++ # endif
++
++ #endif
--- /dev/null
--- /dev/null
++diff --git a/libgcc/config.host b/libgcc/config.host
++index e768389..aec10c7 100644
++--- a/libgcc/config.host
+++++ b/libgcc/config.host
++@@ -320,11 +320,11 @@ alpha*-dec-*vms*)
++ ;;
++ arc*-*-elf*)
++ tmake_file="arc/t-arc-newlib arc/t-arc"
++- extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o crttls_r25.o crttls_r30.o"
+++ extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o crtg.o crtgend.o crttls_r25.o crttls_r30.o"
++ ;;
++ arc*-*-linux-uclibc*)
++ tmake_file="${tmake_file} t-slibgcc-libgcc t-slibgcc-nolc-override arc/t-arc700-uClibc arc/t-arc"
++- extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o"
+++ extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o crtg.o crtgend.o"
++ ;;
++ arm-wrs-vxworks)
++ tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
--- /dev/null
--- /dev/null
++--- a/libgcc/Makefile.in
+++++ b/libgcc/Makefile.in
++@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
++
++ # Static libraries.
++ libgcc.a: $(libgcc-objects)
+++libgcc_pic.a: $(libgcc-s-objects)
++ libgcov.a: $(libgcov-objects)
++ libunwind.a: $(libunwind-objects)
++ libgcc_eh.a: $(libgcc-eh-objects)
++
++-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
++ -rm -f $@
++
++ objects="$(objects)"; \
++@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
++ endif
++
++ ifeq ($(enable_shared),yes)
++-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
++ ifneq ($(LIBUNWIND),)
++ all: libunwind$(SHLIB_EXT)
++ endif
++@@ -1058,6 +1059,10 @@ install-shared:
++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++
+++ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+++
++ $(subst @multilib_dir@,$(MULTIDIR),$(subst \
++ @shlib_base_name@,libgcc_s,$(subst \
++ @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
--- /dev/null
--- /dev/null
++--- a/gcc/config/arm/linux-eabi.h
+++++ b/gcc/config/arm/linux-eabi.h
++@@ -131,10 +131,6 @@
++ #define ENDFILE_SPEC \
++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
++
++-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
++- do not use -lfloat. */
++-#undef LIBGCC_SPEC
++-
++ /* Clear the instruction cache from `beg' to `end'. This is
++ implemented in lib1funcs.S, so ensure an error if this definition
++ is used. */
++--- a/gcc/config/linux.h
+++++ b/gcc/config/linux.h
++@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
++ builtin_assert ("system=posix"); \
++ } while (0)
++
+++#ifndef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+++#endif
+++
++ /* Determine which dynamic linker to use depending on whether GLIBC or
++ uClibc or Bionic is the default C library and whether
++ -muclibc or -mglibc or -mbionic has been passed to change the default. */
++--- a/libgcc/mkmap-symver.awk
+++++ b/libgcc/mkmap-symver.awk
++@@ -132,5 +132,5 @@ function output(lib) {
++ else if (inherit[lib])
++ printf("} %s;\n", inherit[lib]);
++ else
++- printf ("\n local:\n\t*;\n};\n");
+++ printf ("\n\t*;\n};\n");
++ }
++--- a/gcc/config/rs6000/linux.h
+++++ b/gcc/config/rs6000/linux.h
++@@ -61,6 +61,9 @@
++ #undef CPLUSPLUS_CPP_SPEC
++ #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
++
+++#undef LIBGCC_SPEC
+++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+++
++ #undef LINK_SHLIB_SPEC
++ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
++
--- /dev/null
--- /dev/null
++--- a/libgcc/config/t-libunwind
+++++ b/libgcc/config/t-libunwind
++@@ -2,8 +2,7 @@
++
++ HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
++
++-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
++- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++ LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++
++ # Override the default value from t-slibgcc-elf-ver and mention -lunwind
--- /dev/null
--- /dev/null
++--- a/libgcc/unwind-dw2-fde-dip.c
+++++ b/libgcc/unwind-dw2-fde-dip.c
++@@ -46,33 +46,13 @@
++ #include "unwind-compat.h"
++ #include "gthr.h"
++
++-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
++- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++-# define USE_PT_GNU_EH_FRAME
++-#endif
++-
++-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++- && defined(__BIONIC__)
++-# define USE_PT_GNU_EH_FRAME
++-#endif
++-
++-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++- && defined(__FreeBSD__) && __FreeBSD__ >= 7
++-# define ElfW __ElfN
++-# define USE_PT_GNU_EH_FRAME
++-#endif
++-
++-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++- && defined(__OpenBSD__)
++-# define ElfW(type) Elf_##type
++-# define USE_PT_GNU_EH_FRAME
++-#endif
++-
++-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++- && defined(TARGET_DL_ITERATE_PHDR) \
++- && defined(__sun__) && defined(__svr4__)
+++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
++ # define USE_PT_GNU_EH_FRAME
+++# ifdef __OpenBSD__
+++# define ElfW(type) Elf_##type
+++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
+++# define ElfW __ElfN
+++# endif
++ #endif
++
++ #if defined(USE_PT_GNU_EH_FRAME)
--- /dev/null
--- /dev/null
++--- a/gcc/config/rs6000/rs6000.c
+++++ b/gcc/config/rs6000/rs6000.c
++@@ -17662,7 +17662,7 @@ rs6000_savres_strategy (rs6000_stack_t *
++ /* Define cutoff for using out-of-line functions to save registers. */
++ if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
++ {
++- if (!optimize_size)
+++ if (1)
++ {
++ strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
++ strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
--- /dev/null
--- /dev/null
++--- a/gcc/defaults.h
+++++ b/gcc/defaults.h
++@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
++ /* If we have named section and we support weak symbols, then use the
++ .jcr section for recording java classes which need to be registered
++ at program start-up time. */
++-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
++ #ifndef JCR_SECTION_NAME
++ #define JCR_SECTION_NAME ".jcr"
++ #endif
--- /dev/null
--- /dev/null
++
++ This patch brings over a few features from MirBSD:
++ * -fhonour-copts
++ If this option is not given, it's warned (depending
++ on environment variables). This is to catch errors
++ of misbuilt packages which override CFLAGS themselves.
++ * -Werror-maybe-reset
++ Has the effect of -Wno-error if GCC_NO_WERROR is
++ set and not '0', a no-operation otherwise. This is
++ to be able to use -Werror in "make" but prevent
++ GNU autoconf generated configure scripts from
++ freaking out.
++ * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
++ the default for -O2/-Os, because they trigger gcc bugs
++ and can delete code with security implications.
++
++ This patch was authored by Thorsten Glaser <tg at mirbsd.de>
++ with copyright assignment to the FSF in effect.
++
++--- a/gcc/c-family/c-opts.c
+++++ b/gcc/c-family/c-opts.c
++@@ -104,6 +104,9 @@ static size_t include_cursor;
++ /* Whether any standard preincluded header has been preincluded. */
++ static bool done_preinclude;
++
+++/* Check if a port honours COPTS. */
+++static int honour_copts = 0;
+++
++ static void handle_OPT_d (const char *);
++ static void set_std_cxx98 (int);
++ static void set_std_cxx11 (int);
++@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
++ cpp_opts->warn_endif_labels = value;
++ break;
++
+++ case OPT_Werror_maybe_reset:
+++ break;
+++
++ case OPT_Winvalid_pch:
++ cpp_opts->warn_invalid_pch = value;
++ break;
++@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
++ flag_no_builtin = !value;
++ break;
++
+++ case OPT_fhonour_copts:
+++ if (c_language == clk_c) {
+++ honour_copts++;
+++ }
+++ break;
+++
++ case OPT_fconstant_string_class_:
++ constant_string_class_name = arg;
++ break;
++@@ -1027,6 +1039,47 @@ c_common_init (void)
++ return false;
++ }
++
+++ if (c_language == clk_c) {
+++ char *ev = getenv ("GCC_HONOUR_COPTS");
+++ int evv;
+++ if (ev == NULL)
+++ evv = -1;
+++ else if ((*ev == '0') || (*ev == '\0'))
+++ evv = 0;
+++ else if (*ev == '1')
+++ evv = 1;
+++ else if (*ev == '2')
+++ evv = 2;
+++ else if (*ev == 's')
+++ evv = -1;
+++ else {
+++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+++ }
+++ if (evv == 1) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in lenient mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ warning (0, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ } else if (evv == 2) {
+++ if (honour_copts == 0) {
+++ error ("someone does not honour COPTS at all in strict mode");
+++ return false;
+++ } else if (honour_copts != 1) {
+++ error ("someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ return false;
+++ }
+++ } else if (evv == 0) {
+++ if (honour_copts != 1)
+++ inform (0, "someone does not honour COPTS correctly, passed %d times",
+++ honour_copts);
+++ }
+++ }
+++
++ return true;
++ }
++
++--- a/gcc/c-family/c.opt
+++++ b/gcc/c-family/c.opt
++@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
++ C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
++ This switch is deprecated; use -Werror=implicit-function-declaration instead
++
+++Werror-maybe-reset
+++C ObjC C++ ObjC++
+++; Documented in common.opt
+++
++ Wfloat-equal
++ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
++ Warn if testing floating point numbers for equality
++@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
++ fhonor-std
++ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
++
+++fhonour-copts
+++C ObjC C++ ObjC++ RejectNegative
+++
++ fhosted
++ C ObjC
++ Assume normal C execution environment
++--- a/gcc/common.opt
+++++ b/gcc/common.opt
++@@ -541,6 +541,10 @@ Werror=
++ Common Joined
++ Treat specified warning as error
++
+++Werror-maybe-reset
+++Common
+++If environment variable GCC_NO_WERROR is set, act as -Wno-error
+++
++ Wextra
++ Common Var(extra_warnings) Warning
++ Print extra (possibly unwanted) warnings
++@@ -1242,6 +1246,9 @@ fguess-branch-probability
++ Common Report Var(flag_guess_branch_prob) Optimization
++ Enable guessing of branch probabilities
++
+++fhonour-copts
+++Common RejectNegative
+++
++ ; Nonzero means ignore `#ident' directives. 0 means handle them.
++ ; Generate position-independent code for executables if possible
++ ; On SVR4 targets, it also controls whether or not to emit a
++--- a/gcc/opts.c
+++++ b/gcc/opts.c
++@@ -468,8 +468,6 @@ static const struct default_options defa
++ { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
++ #endif
++ { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
++- { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
++- { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
++ { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
++ { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
++ { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
++@@ -489,6 +487,8 @@ static const struct default_options defa
++ { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
++
++ /* -O3 optimizations. */
+++ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
+++ { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
++ { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
++ { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
++ /* Inlining of functions reducing size is a good idea with -Os
++@@ -1435,6 +1435,17 @@ common_handle_option (struct gcc_options
++ opts, opts_set, loc, dc);
++ break;
++
+++ case OPT_Werror_maybe_reset:
+++ {
+++ char *ev = getenv ("GCC_NO_WERROR");
+++ if ((ev != NULL) && (*ev != '0'))
+++ warnings_are_errors = 0;
+++ }
+++ break;
+++
+++ case OPT_fhonour_copts:
+++ break;
+++
++ case OPT_Wlarger_than_:
++ opts->x_larger_than_size = value;
++ opts->x_warn_larger_than = value != -1;
++--- a/gcc/doc/cppopts.texi
+++++ b/gcc/doc/cppopts.texi
++@@ -163,6 +163,11 @@ in older programs. This warning is on b
++ Make all warnings into hard errors. Source code which triggers warnings
++ will be rejected.
++
+++ at item -Werror-maybe-reset
+++ at opindex Werror-maybe-reset
+++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+++variable is set to anything other than 0 or empty.
+++
++ @item -Wsystem-headers
++ @opindex Wsystem-headers
++ Issue warnings for code in system headers. These are normally unhelpful
++--- a/gcc/doc/invoke.texi
+++++ b/gcc/doc/invoke.texi
++@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
++ -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
++ -Wno-deprecated-declarations -Wdisabled-optimization @gol
++ -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
++--Wno-endif-labels -Werror -Werror=* @gol
+++-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
++ -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
++ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
++ -Wformat-security -Wformat-y2k @gol
++@@ -4817,6 +4817,22 @@ This option is only supported for C and
++ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
++ @option{-Wno-pointer-sign}.
++
+++ at item -Werror-maybe-reset
+++ at opindex Werror-maybe-reset
+++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+++variable is set to anything other than 0 or empty.
+++
+++ at item -fhonour-copts
+++ at opindex fhonour-copts
+++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+++given at least once, and warn if it is given more than once.
+++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+++given exactly once.
+++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+++is not given exactly once.
+++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+++This flag and environment variable only affect the C language.
+++
++ @item -Wstack-protector
++ @opindex Wstack-protector
++ @opindex Wno-stack-protector
++@@ -6928,7 +6944,7 @@ so, the first branch is redirected to ei
++ second branch or a point immediately following it, depending on whether
++ the condition is known to be true or false.
++
++-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+++Enabled at levels @option{-O3}.
++
++ @item -fsplit-wide-types
++ @opindex fsplit-wide-types
++--- a/gcc/java/jvspec.c
+++++ b/gcc/java/jvspec.c
++@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
++ class name. Append dummy `.c' that can be stripped by set_input so %b
++ is correct. */
++ set_input (concat (main_class_name, "main.c", NULL));
+++ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
++ err = do_spec (jvgenmain_spec);
++ if (err == 0)
++ {
--- /dev/null
--- /dev/null
++--- a/gcc/gcc.c
+++++ b/gcc/gcc.c
++@@ -8029,7 +8029,10 @@ getenv_spec_function (int argc, const ch
++
++ value = getenv (argv[0]);
++ if (!value)
++- fatal_error ("environment variable %qs not defined", argv[0]);
+++ {
+++ warning (0, "environment variable %qs not defined", argv[0]);
+++ value = "";
+++ }
++
++ /* We have to escape every character of the environment variable so
++ they are not interpreted as active spec characters. A
--- /dev/null
--- /dev/null
++--- a/libstdc++-v3/include/Makefile.in
+++++ b/libstdc++-v3/include/Makefile.in
++@@ -1342,7 +1342,7 @@
++ @$(STAMP) stamp-bits
++
++ stamp-bits-sup: stamp-bits ${bits_sup_headers}
++- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+++ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
++ @$(STAMP) stamp-bits-sup
++
++ stamp-c_base: ${c_base_headers}
#
--# Copyright (C) 2006-2013 OpenWrt.org
++# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=gdb
--PKG_REV:=7.6-2013.05
--PKG_VERSION_MAJOR:=7.6
--PKG_VERSION:=linaro-$(PKG_REV)
--PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
--PKG_MD5SUM:=816290b91cff03912320089d353e8a12
--PKG_SOURCE_URL:=https://releases.linaro.org/13.05/components/toolchain/gdb-linaro/
++ifeq ($(CONFIG_arc),y)
++PKG_VERSION:=arc-2015.06-gdb
++
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
++PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2015.06-gdb/
++PKG_MD5SUM:=d318829bfd2ed62714817f0d25706825
++GDB_DIR:=binutils-$(PKG_NAME)-$(PKG_VERSION)
++else
++PKG_VERSION:=7.11
++
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
++PKG_SOURCE_URL:=@GNU/gdb
++PKG_MD5SUM:=b5c784685e1cde65ba135feea86b6d75
++GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION)
++endif
++
++PATCH_DIR:=./patches/$(PKG_VERSION)
++
++HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GDB_DIR)
HOST_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/toolchain-build.mk
--define Host/Configure
-- (cd $(HOST_BUILD_DIR); \
-- gdb_cv_func_sigsetjmp=yes \
-- CFLAGS="-O2" \
-- $(HOST_BUILD_DIR)/configure \
-- --prefix=$(TOOLCHAIN_DIR) \
-- --build=$(GNU_HOST_NAME) \
-- --host=$(GNU_HOST_NAME) \
-- --target=$(REAL_GNU_TARGET_NAME) \
-- --disable-werror \
-- --without-uiout \
-- --disable-tui --disable-gdbtk --without-x \
-- --without-included-gettext \
-- --enable-threads \
-- );
--endef
++HOST_CONFIGURE_VARS += \
++ gdb_cv_func_sigsetjmp=yes
++
++HOST_CONFIGURE_ARGS = \
++ --prefix=$(TOOLCHAIN_DIR) \
++ --build=$(GNU_HOST_NAME) \
++ --host=$(GNU_HOST_NAME) \
++ --target=$(REAL_GNU_TARGET_NAME) \
++ --disable-werror \
++ --without-uiout \
++ --disable-tui --disable-gdbtk --without-x \
++ --without-included-gettext \
++ --enable-threads \
++ --with-expat \
++ --without-python \
++ --disable-binutils \
++ --disable-ld \
++ --disable-gas \
++ --disable-sim
define Host/Install
mkdir -p $(TOOLCHAIN_DIR)/bin
+++ /dev/null
----- a/sim/ppc/Makefile.in
--+++ b/sim/ppc/Makefile.in
--@@ -550,7 +550,7 @@ PACKAGE_SRC = @sim_pk_src@
-- PACKAGE_OBJ = @sim_pk_obj@
--
--
---psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) $(LIBINTL_DEP)
--+psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBINTL_DEP)
-- $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS)
--
-- run: psim
+++ /dev/null
----- a/sim/common/sim-arange.c
--+++ b/sim/common/sim-arange.c
--@@ -280,11 +280,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, a
-- build_search_tree (ar);
-- }
--
---#endif /* DEFINE_NON_INLINE_P */
---
---#if DEFINE_INLINE_P
---
---SIM_ARANGE_INLINE int
--+int
-- sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
-- {
-- ADDR_RANGE_TREE *t = ar->range_tree;
--@@ -301,4 +297,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, ad
-- return 0;
-- }
--
---#endif /* DEFINE_INLINE_P */
--+#endif /* DEFINE_NON_INLINE_P */
----- a/sim/common/sim-arange.h
--+++ b/sim/common/sim-arange.h
--@@ -62,7 +62,7 @@ extern void sim_addr_range_delete (ADDR_
--
-- /* Return non-zero if ADDR is in range AR, traversing the entire tree.
-- If no range is specified, that is defined to mean "everything". */
---extern INLINE int
--+extern int
-- sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
-- #define ADDR_RANGE_HIT_P(ar, addr) \
-- ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
+++ /dev/null
----- a/gdb/configure
--+++ b/gdb/configure
--@@ -834,8 +834,7 @@ MAKEINFOFLAGS
-- YACC
-- YFLAGS
-- XMKMF'
---ac_subdirs_all='testsuite
---gdbtk
--+ac_subdirs_all='gdbtk
-- multi-ice
-- gdbserver'
--
--@@ -5033,7 +5032,7 @@ $as_echo "$with_auto_load_safe_path" >&6
--
--
--
---subdirs="$subdirs testsuite"
--+subdirs="$subdirs"
--
--
-- # Check whether to support alternative target configurations
----- a/gdb/gdbserver/configure
--+++ b/gdb/gdbserver/configure
--@@ -2181,7 +2181,7 @@ $as_echo "$as_me: error: \`$ac_var' was
-- ac_cache_corrupted=: ;;
-- ,);;
-- *)
--- if test "x$ac_old_val" != "x$ac_new_val"; then
--+ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
-- # differences in whitespace do not lead to failure.
-- ac_old_val_w=`echo x $ac_old_val`
-- ac_new_val_w=`echo x $ac_new_val`
--- /dev/null
--- /dev/null
++--- a/sim/common/sim-arange.c
+++++ b/sim/common/sim-arange.c
++@@ -280,11 +280,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, a
++ build_search_tree (ar);
++ }
++
++-#endif /* DEFINE_NON_INLINE_P */
++-
++-#if DEFINE_INLINE_P
++-
++-SIM_ARANGE_INLINE int
+++int
++ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
++ {
++ ADDR_RANGE_TREE *t = ar->range_tree;
++@@ -301,4 +297,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, ad
++ return 0;
++ }
++
++-#endif /* DEFINE_INLINE_P */
+++#endif /* DEFINE_NON_INLINE_P */
++--- a/sim/common/sim-arange.h
+++++ b/sim/common/sim-arange.h
++@@ -73,7 +73,7 @@ extern void sim_addr_range_delete (ADDR_
++
++ /* Return non-zero if ADDR is in range AR, traversing the entire tree.
++ If no range is specified, that is defined to mean "everything". */
++-SIM_ARANGE_INLINE int
+++extern int
++ sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
++ #define ADDR_RANGE_HIT_P(ar, addr) \
++ ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
--- /dev/null
--- /dev/null
++--- a/gdb/configure
+++++ b/gdb/configure
++@@ -873,8 +873,7 @@ MAKEINFOFLAGS
++ YACC
++ YFLAGS
++ XMKMF'
++-ac_subdirs_all='testsuite
++-gdbtk
+++ac_subdirs_all='gdbtk
++ multi-ice
++ gdbserver'
++
++@@ -5660,7 +5660,7 @@ $as_echo "$with_auto_load_safe_path" >&6
++
++
++
++-subdirs="$subdirs testsuite"
+++subdirs="$subdirs"
++
++
++ # Check whether to support alternative target configurations
--- /dev/null
--- /dev/null
++--- a/gdb/gdbserver/configure
+++++ b/gdb/gdbserver/configure
++@@ -2520,7 +2520,7 @@ $as_echo "$as_me: error: \`$ac_var' was
++ ac_cache_corrupted=: ;;
++ ,);;
++ *)
++- if test "x$ac_old_val" != "x$ac_new_val"; then
+++ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
++ # differences in whitespace do not lead to failure.
++ ac_old_val_w=`echo x $ac_old_val`
++ ac_new_val_w=`echo x $ac_new_val`
--- /dev/null
--- /dev/null
++--- a/sim/common/sim-arange.c
+++++ b/sim/common/sim-arange.c
++@@ -280,11 +280,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, a
++ build_search_tree (ar);
++ }
++
++-#endif /* DEFINE_NON_INLINE_P */
++-
++-#if DEFINE_INLINE_P
++-
++-SIM_ARANGE_INLINE int
+++int
++ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
++ {
++ ADDR_RANGE_TREE *t = ar->range_tree;
++@@ -301,4 +297,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, ad
++ return 0;
++ }
++
++-#endif /* DEFINE_INLINE_P */
+++#endif /* DEFINE_NON_INLINE_P */
++--- a/sim/common/sim-arange.h
+++++ b/sim/common/sim-arange.h
++@@ -62,7 +62,7 @@ extern void sim_addr_range_delete (ADDR_
++
++ /* Return non-zero if ADDR is in range AR, traversing the entire tree.
++ If no range is specified, that is defined to mean "everything". */
++-extern INLINE int
+++extern int
++ sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
++ #define ADDR_RANGE_HIT_P(ar, addr) \
++ ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
--- /dev/null
--- /dev/null
++--- a/gdb/configure
+++++ b/gdb/configure
++@@ -855,8 +855,7 @@ MAKEINFOFLAGS
++ YACC
++ YFLAGS
++ XMKMF'
++-ac_subdirs_all='testsuite
++-gdbtk
+++ac_subdirs_all='gdbtk
++ multi-ice
++ gdbserver'
++
++@@ -5168,7 +5167,7 @@ $as_echo "$with_auto_load_safe_path" >&6
++
++
++
++-subdirs="$subdirs testsuite"
+++subdirs="$subdirs"
++
++
++ # Check whether to support alternative target configurations
--- /dev/null
--- /dev/null
++--- a/gdb/gdbserver/configure
+++++ b/gdb/gdbserver/configure
++@@ -2183,7 +2183,7 @@ $as_echo "$as_me: error: \`$ac_var' was
++ ac_cache_corrupted=: ;;
++ ,);;
++ *)
++- if test "x$ac_old_val" != "x$ac_new_val"; then
+++ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
++ # differences in whitespace do not lead to failure.
++ ac_old_val_w=`echo x $ac_old_val`
++ ac_new_val_w=`echo x $ac_new_val`
choice
prompt "(e)glibc version"
depends on TOOLCHAINOPTS && USE_GLIBC
-- default EGLIBC_USE_VERSION_2_19
++ default GLIBC_USE_VERSION_2_22
help
Select the version of glibc you wish to use.
-- 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
++ config GLIBC_USE_VERSION_2_22
++ bool "glibc 2.22"
++ select GLIBC_VERSION_2_22
endchoice
--
--menu "eglibc configuration"
-- depends on TOOLCHAINOPTS && USE_GLIBC && EGLIBC_USE_VERSION_2_19
-- source toolchain/glibc/config/Config.in
--endmenu
config GLIBC_VERSION
string
-- default "2.19" if EGLIBC_VERSION_2_19
-- default "2.21" if GLIBC_VERSION_2_21
++ default "2.22" if GLIBC_VERSION_2_22
--config EGLIBC_VERSION_2_19
++config GLIBC_VERSION_2_22
default y if !TOOLCHAINOPTS
bool
--config GLIBC_VERSION_2_21
-- bool
--
--config GLIBC_REVISION
-- string
-- default "25243" if EGLIBC_VERSION_2_19
-- default "4e42b5b8f8" if GLIBC_VERSION_2_21
-- default ""
--
endif
--
--menu "eglibc configuration"
-- depends on !TOOLCHAINOPTS && USE_GLIBC
-- source toolchain/glibc/config/Config.in
--endmenu
#
--# Copyright (C) 2006-2011 OpenWrt.org
++# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
++
++MD5SUM_2.19 = 42dad4edd3bcb38006d13b5640b00b38
++REVISION_2.19 = 25243
++
++MD5SUM_2.21 = 76050a65c444d58b5c4aa0d6034736ed
++REVISION_2.21 = 16d0a0c
++
++MD5SUM_2.22 = b575850e77b37d70f96472285290b391
++REVISION_2.22 = b995d95
++
++
PKG_NAME:=glibc
PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
--PKG_REVISION:=$(call qstrip,$(CONFIG_GLIBC_REVISION))
++
++PKG_REVISION:=$(REVISION_$(PKG_VERSION))
++PKG_MIRROR_MD5SUM:=$(MD5SUM_$(PKG_VERSION))
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_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REVISION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
GLIBC_PATH:=
--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
PATCH_DIR:=$(PATH_PREFIX)/patches/$(PKG_VERSION)
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
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; \
$(GLIBC_CONFIGURE) \
);
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
--endif
endef
define Host/Clean
+++ /dev/null
--config EGLIBC_OPTION_EGLIBC_ADVANCED_INET6
-- bool "IPv6 Advanced Sockets API support (RFC3542)"
-- default y
-- select EGLIBC_OPTION_EGLIBC_INET
-- help
-- This option group includes the functions specified by RFC 3542,
-- "Advanced Sockets Application Program Interface (API) for
-- IPv6".
--
-- This option group includes the following functions:
--
-- inet6_opt_append
-- inet6_opt_find
-- inet6_opt_finish
-- inet6_opt_get_val
-- inet6_opt_init
-- inet6_option_alloc
-- inet6_option_append
-- inet6_option_find
-- inet6_option_init
-- inet6_option_next
-- inet6_option_space
-- inet6_opt_next
-- inet6_opt_set_val
-- inet6_rth_add
-- inet6_rth_getaddr
-- inet6_rth_init
-- inet6_rth_reverse
-- inet6_rth_segments
-- inet6_rth_space
--
--
--config EGLIBC_OPTION_EGLIBC_BACKTRACE
-- bool "Functions for producing backtraces"
-- default y
-- help
-- This option group includes functions for producing a list of
-- the function calls that are currently active in a thread, from
-- within the thread itself. These functions are often used
-- within signal handlers, to produce diagnostic output.
--
-- This option group includes the following functions:
--
-- backtrace
-- backtrace_symbols
-- backtrace_symbols_fd
--
--
--config EGLIBC_OPTION_EGLIBC_BIG_MACROS
-- bool "Use extensive inline code"
-- default y
-- help
-- This option group specifies whether certain pieces of code
-- should be inlined to achieve maximum speed. If this option
-- group is not selected, function calls will be used instead,
-- hence reducing the library footprint.
--
--
--config EGLIBC_OPTION_EGLIBC_BSD
-- bool "BSD-specific functions, and their compatibility stubs"
-- default y
-- help
-- This option group includes functions specific to BSD kernels.
-- A number of these functions have stub versions that are also
-- included in libraries built for non-BSD systems for
-- compatibility.
--
-- This option group includes the following functions:
--
-- chflags
-- fchflags
-- lchmod
-- revoke
-- setlogin
--
--
--config EGLIBC_OPTION_EGLIBC_CXX_TESTS
-- bool "Tests that link against the standard C++ library."
-- default y
-- select EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-- select EGLIBC_OPTION_EGLIBC_LIBM
-- help
-- This option group does not include any C library functions;
-- instead, it controls which EGLIBC tests an ordinary 'make
-- tests' runs. With this group disabled, tests that would
-- normally link against the standard C++ library are not
-- run.
--
-- The standard C++ library depends on the math library 'libm' and
-- the wide character I/O functions included in EGLIBC. If those
-- option groups are disabled, this test must also be disabled.
--
--
--config EGLIBC_OPTION_EGLIBC_CATGETS
-- bool "Functions for accessing message catalogs"
-- default y
-- select EGLIBC_OPTION_EGLIBC_LOCALE_CODE
-- help
-- This option group includes functions for accessing message
-- catalogs: catopen, catclose, and catgets.
--
-- This option group depends on the EGLIBC_OPTION_EGLIBC_LOCALE_CODE
-- option group; if you disable that, you must also disable this.
--
--
--config EGLIBC_OPTION_EGLIBC_CHARSETS
-- bool "iconv/gconv character set conversion libraries"
-- default y
-- help
--
-- This option group includes support for character sets other
-- than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
-- various encodings. This affects both the character sets
-- supported by the wide and multibyte character functions, and
-- those supported by the 'iconv' functions.
--
-- With this option group disabled, EGLIBC supports only the
-- following character sets:
--
-- ANSI_X3.4 - ASCII
-- ANSI_X3.4-1968
-- ANSI_X3.4-1986
-- ASCII
-- CP367
-- CSASCII
-- IBM367
-- ISO-IR-6
-- ISO646-US
-- ISO_646.IRV:1991
-- OSF00010020
-- US
-- US-ASCII
--
-- 10646-1:1993 - ISO 10646, in big-endian UCS4 form
-- 10646-1:1993/UCS4
-- CSUCS4
-- ISO-10646
-- ISO-10646/UCS4
-- OSF00010104
-- OSF00010105
-- OSF00010106
-- UCS-4
-- UCS-4BE
-- UCS4
--
-- UCS-4LE - ISO 10646, in little-endian UCS4 form
--
-- ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
-- ISO-10646/UTF8
-- ISO-IR-193
-- OSF05010001
-- UTF-8
-- UTF8
--
-- ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
-- OSF00010100
-- OSF00010101
-- OSF00010102
-- UCS-2
-- UCS2
--
-- UCS-2BE - ISO 10646, in big-endian UCS2 form
-- UNICODEBIG
--
-- UCS-2LE - ISO 10646, in little-endian UCS2 form
-- UNICODELITTLE
--
-- WCHAR_T - EGLIBC's internal form (target-endian,
-- 32-bit ISO 10646)
--
--
--config EGLIBC_OPTION_EGLIBC_CRYPT
-- bool "Encryption library"
-- default y
-- help
-- This option group includes the `libcrypt' library which
-- provides functions for one-way encryption. Supported
-- encryption algorithms include MD5, SHA-256, SHA-512 and DES.
--
--
--config EGLIBC_OPTION_EGLIBC_CRYPT_UFC
-- bool "Ultra fast `crypt' implementation"
-- default y
-- select EGLIBC_OPTION_EGLIBC_CRYPT
-- help
-- This option group provides ultra fast DES-based implementation of
-- the `crypt' function. When this option group is disabled,
-- (a) the library will not provide the setkey[_r] and encrypt[_r]
-- functions and (b) the crypt[_r] function will return NULL and set the
-- errno to ENOSYS if /salt/ passed does not correspond to either MD5,
-- SHA-256 or SHA-512 algorithm.
--
--
--config EGLIBC_OPTION_EGLIBC_DB_ALIASES
-- bool "Functions for accessing the mail aliases database"
-- default y
-- help
-- This option group includes functions for looking up mail
-- aliases in '/etc/aliases' or using nsswitch. It includes the
-- following functions:
--
-- endaliasent
-- getaliasbyname
-- getaliasbyname_r
-- getaliasent
-- getaliasent_r
-- setaliasent
--
-- When this option group is disabled, the NSS service libraries
-- also lack support for querying their mail alias tables.
--
--
--config EGLIBC_OPTION_EGLIBC_ENVZ
-- bool "Functions for handling envz-style environment vectors."
-- default y
-- help
-- This option group contains functions for creating and operating
-- on envz vectors. An "envz vector" is a vector of strings in a
-- contiguous block of memory, where each element is a name-value
-- pair, and elements are separated from their neighbors by null
-- characters.
--
-- This option group includes the following functions:
--
-- envz_add envz_merge
-- envz_entry envz_remove
-- envz_get envz_strip
--
--
--config EGLIBC_OPTION_EGLIBC_FCVT
-- bool "Functions for converting floating-point numbers to strings"
-- default y
-- help
-- This option group includes functions for converting
-- floating-point numbers to strings.
--
-- This option group includes the following functions:
--
-- ecvt qecvt
-- ecvt_r qecvt_r
-- fcvt qfcvt
-- fcvt_r qfcvt_r
-- gcvt qgcvt
--
--
--config EGLIBC_OPTION_EGLIBC_FMTMSG
-- bool "Functions for formatting messages"
-- default y
-- help
-- This option group includes the following functions:
--
-- addseverity fmtmsg
--
--
--config EGLIBC_OPTION_EGLIBC_FSTAB
-- bool "Access functions for 'fstab'"
-- default y
-- help
-- This option group includes functions for reading the mount
-- point specification table, '/etc/fstab'. These functions are
-- not included in the POSIX standard, which provides the
-- 'getmntent' family of functions instead.
--
-- This option group includes the following functions:
--
-- endfsent getfsspec
-- getfsent setfsent
-- getfsfile
--
--
--config EGLIBC_OPTION_EGLIBC_FTRAVERSE
-- bool "Functions for traversing file hierarchies"
-- default y
-- help
-- This option group includes functions for traversing file
-- UNIX file hierachies.
--
-- This option group includes the following functions:
--
-- fts_open ftw
-- fts_read nftw
-- fts_children ftw64
-- fts_set nftw64
-- fts_close
--
--
--config EGLIBC_OPTION_EGLIBC_GETLOGIN
-- bool "The getlogin function"
-- default y
-- select EGLIBC_OPTION_EGLIBC_UTMP
-- help
-- This function group includes the 'getlogin' and 'getlogin_r'
-- functions, which return the user name associated by the login
-- activity with the current process's controlling terminal.
--
-- With this option group disabled, the 'glob' function will not
-- fall back on 'getlogin' to find the user's login name for tilde
-- expansion when the 'HOME' environment variable is not set.
--
--
--config EGLIBC_OPTION_EGLIBC_IDN
-- bool "International domain names support"
-- default y
-- help
-- This option group includes the `libcidn' library which
-- provides support for international domain names.
--
--
--config EGLIBC_OPTION_EGLIBC_INET
-- bool "Networking support"
-- default y
-- help
-- This option group includes networking-specific functions and
-- data. With EGLIBC_OPTION_EGLIBC_INET disabled, the EGLIBC
-- installation and API changes as follows:
--
-- - The following libraries are not installed:
--
-- libanl
-- libnsl
-- libnss_compat
-- libnss_dns
-- libnss_hesiod
-- libnss_nis
-- libnss_nisplus
-- libresolv
--
-- - The following functions and variables are omitted from libc:
--
-- authdes_create hstrerror svc_fdset
-- authdes_getucred htonl svc_getreq
-- authdes_pk_create htons svc_getreq_common
-- authnone_create if_freenameindex svc_getreq_poll
-- authunix_create if_indextoname svc_getreqset
-- authunix_create_default if_nameindex svc_max_pollfd
-- bindresvport if_nametoindex svc_pollfd
-- callrpc in6addr_any svcraw_create
-- cbc_crypt in6addr_loopback svc_register
-- clnt_broadcast inet6_opt_append svc_run
-- clnt_create inet6_opt_find svc_sendreply
-- clnt_pcreateerror inet6_opt_finish svctcp_create
-- clnt_perrno inet6_opt_get_val svcudp_bufcreate
-- clnt_perror inet6_opt_init svcudp_create
-- clntraw_create inet6_option_alloc svcudp_enablecache
-- clnt_spcreateerror inet6_option_append svcunix_create
-- clnt_sperrno inet6_option_find svcunixfd_create
-- clnt_sperror inet6_option_init svc_unregister
-- clnttcp_create inet6_option_next user2netname
-- clntudp_bufcreate inet6_option_space xdecrypt
-- clntudp_create inet6_opt_next xdr_accepted_reply
-- clntunix_create inet6_opt_set_val xdr_array
-- des_setparity inet6_rth_add xdr_authdes_cred
-- ecb_crypt inet6_rth_getaddr xdr_authdes_verf
-- endaliasent inet6_rth_init xdr_authunix_parms
-- endhostent inet6_rth_reverse xdr_bool
-- endnetent inet6_rth_segments xdr_bytes
-- endnetgrent inet6_rth_space xdr_callhdr
-- endprotoent inet_addr xdr_callmsg
-- endrpcent inet_aton xdr_char
-- endservent inet_lnaof xdr_cryptkeyarg
-- ether_aton inet_makeaddr xdr_cryptkeyarg2
-- ether_aton_r inet_netof xdr_cryptkeyres
-- ether_hostton inet_network xdr_des_block
-- ether_line inet_nsap_addr xdr_double
-- ether_ntoa inet_nsap_ntoa xdr_enum
-- ether_ntoa_r inet_ntoa xdr_float
-- ether_ntohost inet_ntop xdr_free
-- freeaddrinfo inet_pton xdr_getcredres
-- freeifaddrs innetgr xdr_hyper
-- gai_strerror iruserok xdr_int
-- getaddrinfo iruserok_af xdr_int16_t
-- getaliasbyname key_decryptsession xdr_int32_t
-- getaliasbyname_r key_decryptsession_pk xdr_int64_t
-- getaliasent key_encryptsession xdr_int8_t
-- getaliasent_r key_encryptsession_pk xdr_keybuf
-- gethostbyaddr key_gendes xdr_key_netstarg
-- gethostbyaddr_r key_get_conv xdr_key_netstres
-- gethostbyname key_secretkey_is_set xdr_keystatus
-- gethostbyname2 key_setnet xdr_long
-- gethostbyname2_r key_setsecret xdr_longlong_t
-- gethostbyname_r netname2host xdrmem_create
-- gethostent netname2user xdr_netnamestr
-- gethostent_r ntohl xdr_netobj
-- getifaddrs ntohs xdr_opaque
-- getipv4sourcefilter passwd2des xdr_opaque_auth
-- get_myaddress pmap_getmaps xdr_pmap
-- getnameinfo pmap_getport xdr_pmaplist
-- getnetbyaddr pmap_rmtcall xdr_pointer
-- getnetbyaddr_r pmap_set xdr_quad_t
-- getnetbyname pmap_unset xdrrec_create
-- getnetbyname_r rcmd xdrrec_endofrecord
-- getnetent rcmd_af xdrrec_eof
-- getnetent_r registerrpc xdrrec_skiprecord
-- getnetgrent res_init xdr_reference
-- getnetgrent_r rexec xdr_rejected_reply
-- getnetname rexec_af xdr_replymsg
-- getprotobyname rexecoptions xdr_rmtcall_args
-- getprotobyname_r rpc_createerr xdr_rmtcallres
-- getprotobynumber rresvport xdr_short
-- getprotobynumber_r rresvport_af xdr_sizeof
-- getprotoent rtime xdrstdio_create
-- getprotoent_r ruserok xdr_string
-- getpublickey ruserok_af xdr_u_char
-- getrpcbyname ruserpass xdr_u_hyper
-- getrpcbyname_r setaliasent xdr_u_int
-- getrpcbynumber sethostent xdr_uint16_t
-- getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
-- getrpcent setnetent xdr_uint64_t
-- getrpcent_r setnetgrent xdr_uint8_t
-- getrpcport setprotoent xdr_u_long
-- getsecretkey setrpcent xdr_u_longlong_t
-- getservbyname setservent xdr_union
-- getservbyname_r setsourcefilter xdr_unixcred
-- getservbyport svcauthdes_stats xdr_u_quad_t
-- getservbyport_r svcerr_auth xdr_u_short
-- getservent svcerr_decode xdr_vector
-- getservent_r svcerr_noproc xdr_void
-- getsourcefilter svcerr_noprog xdr_wrapstring
-- h_errlist svcerr_progvers xencrypt
-- h_errno svcerr_systemerr xprt_register
-- herror svcerr_weakauth xprt_unregister
-- h_nerr svc_exit
-- host2netname svcfd_create
--
-- - The rpcgen, nscd, and rpcinfo commands are not installed.
--
-- - The 'rpc' file (a text file listing RPC services) is not installed.
--
-- Socket-related system calls do not fall in this option group,
-- because many are also used for other inter-process
-- communication mechanisms. For example, the 'syslog' routines
-- use Unix-domain sockets to communicate with the syslog daemon;
-- syslog is valuable in non-networked contexts.
--
--
--config EGLIBC_OPTION_EGLIBC_INET_ANL
-- bool "Asynchronous name lookup"
-- default y
-- select EGLIBC_OPTION_EGLIBC_INET
-- help
-- This option group includes the `libanl' library which
-- provides support for asynchronous name lookup.
--
--
--config EGLIBC_OPTION_EGLIBC_LIBM
-- bool "libm (math library)"
-- default y
-- help
-- This option group includes the 'libm' library, containing
-- mathematical functions. If this option group is omitted, then
-- an EGLIBC installation does not include shared or unshared versions
-- of the math library.
--
-- Note that this does not remove all floating-point related
-- functionality from EGLIBC; for example, 'printf' and 'scanf'
-- can still print and read floating-point values with this option
-- group disabled.
--
-- Note that the ISO Standard C++ library 'libstdc++' depends on
-- EGLIBC's math library 'libm'. If you disable this option
-- group, you will not be able to build 'libstdc++' against the
-- resulting EGLIBC installation.
--
--
--config EGLIBC_OPTION_EGLIBC_LIBM_BIG
-- bool "Math library size"
-- default y
-- help
-- This option group enables default configuration of the math library.
-- Not selecting this option group removes most of the extended and
-- double precision math functions and replaces them with wrappers
-- to the single precision couterparts.
-- Doing so greatly degrades quality of calculations carried
-- out by the functions of the math library, but also significantly
-- reduces the size of the libm.
-- This option group is useful for systems that do not rely on precise
-- floating point math.
--
--
--config EGLIBC_OPTION_EGLIBC_LOCALES
-- bool "Locale definitions"
-- default y
-- help
-- This option group includes all locale definitions other than
-- that for the "C" locale. If this option group is omitted, then
-- only the "C" locale is supported.
--
--
--config EGLIBC_OPTION_EGLIBC_LOCALE_CODE
-- bool "Locale functions"
-- default y
-- select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR
-- help
-- This option group includes locale support functions, programs,
-- and libraries. With EGLIBC_OPTION_EGLIBC_LOCALE_CODE disabled,
-- EGLIBC supports only the 'C' locale (also known as 'POSIX'),
-- and ignores the settings of the 'LANG' and 'LC_*' environment
-- variables.
--
-- With EGLIBC_OPTION_EGLIBC_LOCALE_CODE disabled, the following
-- functions are omitted from libc:
--
-- duplocale localeconv nl_langinfo rpmatch strfmon_l
-- freelocale newlocale nl_langinfo_l strfmon uselocale
--
-- Furthermore, only the LC_CTYPE and LC_TIME categories of the
-- standard "C" locale are available.
--
-- The EGLIBC_OPTION_EGLIBC_CATGETS option group depends on this option
-- group; if you disable EGLIBC_OPTION_EGLIBC_LOCALE_CODE, you must also
-- disable EGLIBC_OPTION_EGLIBC_CATGETS.
--
--
--config EGLIBC_OPTION_EGLIBC_MEMUSAGE
-- bool "Memory profiling library"
-- default y
-- help
-- This option group includes the `libmemusage' library and
-- the `memusage' and `memusagestat' utilities.
-- These components provide memory profiling functions.
--
-- EGLIBC_OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
--
-- Libmemusage library buffers the profiling data in memory
-- before writing it out to disk. By default, the library
-- allocates 1.5M buffer, which can be substantial for some
-- systems. EGLIBC_OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
-- allows to change the default buffer size. It specifies
-- the number of entries the buffer should have.
-- On most architectures one buffer entry amounts to 48 bytes,
-- so setting this option to the value of 512 will reduce the size of
-- the memory buffer to 24K.
--
--
--config EGLIBC_OPTION_EGLIBC_NIS
-- bool "Support for NIS, NIS+, and the special 'compat' services."
-- default n
-- select EGLIBC_OPTION_EGLIBC_INET
-- select EGLIBC_OPTION_EGLIBC_SUNRPC
-- help
-- This option group includes the NIS, NIS+, and 'compat' Name
-- Service Switch service libraries. When it is disabled, those
-- services libraries are not installed; you should remove any
-- references to them from your 'nsswitch.conf' file.
--
-- This option group depends on the EGLIBC_OPTION_EGLIBC_INET option
-- group; you must enable that to enable this option group.
--
--
--config EGLIBC_OPTION_EGLIBC_NSSWITCH
-- bool "Name service switch (nsswitch) support"
-- default y
-- select EGLIBC_OPTION_EGLIBC_INET
-- help
--
-- This option group includes support for the 'nsswitch' facility.
-- With this option group enabled, all EGLIBC functions for
-- accessing various system databases (passwords and groups;
-- networking; aliases; public keys; and so on) consult the
-- '/etc/nsswitch.conf' configuration file to decide how to handle
-- queries.
--
-- With this option group disabled, EGLIBC uses a fixed list of
-- services to satisfy queries on each database, as requested by
-- configuration files specified when EGLIBC is built. Your
-- 'option-groups.config' file must set the following two
-- variables:
--
-- EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
--
-- Set this to the name of a file whose contents observe the
-- same syntax as an ordinary '/etc/nsswitch.conf' file. The
-- EGLIBC build process parses this file just as EGLIBC would
-- at run time if EGLIBC_NSSWITCH were enabled, and
-- produces a C library that uses the nsswitch service
-- libraries to search for database entries as this file
-- specifies, instead of consulting '/etc/nsswitch.conf' at run
-- time.
--
-- This should be an absolute filename. The EGLIBC build
-- process may use it from several different working
-- directories. It may include references to Makefile
-- variables like 'common-objpfx' (the top of the build tree,
-- with a trailing slash), or '..' (the top of the source tree,
-- with a trailing slash).
--
-- The EGLIBC source tree includes a sample configuration file
-- named 'nss/fixed-nsswitch.conf'; for simple configurations,
-- you will probably want to delete references to databases not
-- needed on your system.
--
-- EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
--
-- The EGLIBC build process uses this file to decide which
-- functions to make available from which service libraries.
-- The file 'nss/fixed-nsswitch.functions' serves as a sample
-- configuration file for this setting, and explains its syntax
-- and meaning in more detail.
--
-- This should be an absolute file name. The EGLIBC build
-- process may use it from several different working
-- directories. It may include references to Makefile
-- variables like 'common-objpfx' (the top of the build tree,
-- with a trailing slash), or '..' (the top of the source tree,
-- with a trailing slash).
--
-- Be sure to mention each function in each service you wish to
-- use. If you do not mention a service's function here, the
-- EGLIBC database access functions will not find it, even if
-- it is listed in the EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
-- file.
--
-- In this arrangement, EGLIBC will not use the 'dlopen' and
-- 'dlsym' functions to find database access functions. Instead,
-- libc hard-codes references to the service libraries' database
-- access functions. You must explicitly link your program
-- against the name service libraries (those whose names start
-- with 'libnss_', in the sysroot's '/lib' directory) whose
-- functions you intend to use. This arrangement helps
-- system-wide static analysis tools decide which functions a
-- system actually uses.
--
-- Note that some nsswitch service libraries require other option
-- groups to be enabled; for example, the EGLIBC_OPTION_EGLIBC_INET
-- option group must be enabled to use the 'libnss_dns.so.2'
-- service library, which uses the Domain Name System network
-- protocol to answer queries.
--
--
--config EGLIBC_OPTION_EGLIBC_RCMD
-- bool "Support for 'rcmd' and related library functions"
-- default y
-- select EGLIBC_OPTION_EGLIBC_INET
-- help
-- This option group includes functions for running commands on
-- remote machines via the 'rsh' protocol, and doing authentication
-- related to those functions. This also includes functions that
-- use the 'rexec' protocol.
--
-- This option group includes the following functions:
--
-- rcmd ruserok
-- rcmd_af ruserok_af
-- rexec iruserok
-- rexec_af iruserok_af
-- rresvport ruserpass
-- rresvport_af
--
--
--config EGLIBC_OPTION_EGLIBC_RTLD_DEBUG
-- bool "Runtime linker debug print outs"
-- default y
-- help
-- This option group enables debug output of the runtime linker
-- which is activated via LD_DEBUG and LD_TRACE_PRELINKING
-- environment variables. Disabling this option group yields
-- a smaller runtime linker binary.
-- BEWARE: Disabling this option group is likely to break
-- the `ldd' utility which may also be used by the prelinker.
-- In particular, the `--unused' ldd option will not work correctly.
--
--
--config EGLIBC_OPTION_EGLIBC_SPAWN
-- bool "Support for POSIX posix_spawn functions"
-- default y
-- help
-- This option group includes the POSIX functions for executing
-- programs in child processes without using 'fork' or 'vfork'.
--
-- This option group includes the following functions:
--
-- posix_spawn
-- posix_spawnattr_destroy
-- posix_spawnattr_getflags
-- posix_spawnattr_getpgroup
-- posix_spawnattr_getschedparam
-- posix_spawnattr_getschedpolicy
-- posix_spawnattr_getsigdefault
-- posix_spawnattr_getsigmask
-- posix_spawnattr_init
-- posix_spawnattr_setflags
-- posix_spawnattr_setpgroup
-- posix_spawnattr_setschedparam
-- posix_spawnattr_setschedpolicy
-- posix_spawnattr_setsigdefault
-- posix_spawnattr_setsigmask
-- posix_spawn_file_actions_addclose
-- posix_spawn_file_actions_adddup2
-- posix_spawn_file_actions_addopen
-- posix_spawn_file_actions_destroy
-- posix_spawn_file_actions_init
-- posix_spawnp
--
-- This option group also provides the ability for the iconv,
-- localedef, and locale programs to operate transparently on
-- compressed charset definitions. When this option group is
-- disabled, those programs will only operate on uncompressed
-- charmap files.
--
--
--config EGLIBC_OPTION_EGLIBC_STREAMS
-- bool "Support for accessing STREAMS."
-- default y
-- help
-- This option group includes functions for reading and writing
-- messages to and from STREAMS. The STREAMS interface provides a
-- uniform mechanism for implementing networking services and other
-- character-based I/O. (STREAMS are not to be confused with
-- <stdio.h> FILE objects, also called 'streams'.)
--
-- This option group includes the following functions:
--
-- getmsg putpmsg
-- getpmsg fattach
-- isastream fdetach
-- putmsg
--
--
--config EGLIBC_OPTION_EGLIBC_SUNRPC
-- bool "Support for the Sun 'RPC' protocol."
-- default n
-- select EGLIBC_OPTION_EGLIBC_INET
-- help
-- This option group includes support for the Sun RPC protocols,
-- including the 'rpcgen' and 'rpcinfo' programs.
--
--
--config EGLIBC_OPTION_EGLIBC_UTMP
-- bool "Older access functions for 'utmp' login records"
-- default y
-- help
-- This option group includes the older 'utent' family of
-- functions for accessing user login records in the 'utmp' file.
-- POSIX omits these functions in favor of the 'utxent' family,
-- and they are obsolete on systems other than Linux.
--
-- This option group includes the following functions:
--
-- endutent
-- getutent
-- getutent_r
-- getutid
-- getutid_r
-- getutline
-- getutline_r
-- logwtmp
-- pututline
-- setutent
-- updwtmp
-- utmpname
--
-- This option group includes the following libraries:
--
-- libutil.so (and libutil.a)
--
--
--config EGLIBC_OPTION_EGLIBC_UTMPX
-- bool "POSIX access functions for 'utmp' login records"
-- default y
-- select EGLIBC_OPTION_EGLIBC_UTMP
-- help
-- This option group includes the POSIX functions for reading and
-- writing user login records in the 'utmp' file (usually
-- '/var/run/utmp'). The POSIX functions operate on 'struct
-- utmpx' structures, as opposed to the family of older 'utent'
-- functions, which operate on 'struct utmp' structures.
--
-- This option group includes the following functions:
--
-- endutxent
-- getutmp
-- getutmpx
-- getutxent
-- getutxid
-- getutxline
-- pututxline
-- setutxent
-- updwtmpx
-- utmpxname
--
--
--config EGLIBC_OPTION_EGLIBC_WORDEXP
-- bool "Shell-style word expansion"
-- default y
-- help
-- This option group includes the 'wordexp' function for
-- performing word expansion in the manner of the shell, and the
-- accompanying 'wordfree' function.
--
--
--config EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR
-- bool "ISO C library wide character functions, excluding I/O"
-- default y
-- help
-- This option group includes the functions defined by the ISO C
-- standard for working with wide and multibyte characters in
-- memory. Functions for reading and writing wide and multibyte
-- characters from and to files call in the
-- EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO option group.
--
-- This option group includes the following functions:
--
-- btowc mbsinit wcscspn wcstoll
-- iswalnum mbsrtowcs wcsftime wcstombs
-- iswalpha mbstowcs wcslen wcstoul
-- iswblank mbtowc wcsncat wcstoull
-- iswcntrl swprintf wcsncmp wcstoumax
-- iswctype swscanf wcsncpy wcsxfrm
-- iswdigit towctrans wcspbrk wctob
-- iswgraph towlower wcsrchr wctomb
-- iswlower towupper wcsrtombs wctrans
-- iswprint vswprintf wcsspn wctype
-- iswpunct vswscanf wcsstr wmemchr
-- iswspace wcrtomb wcstod wmemcmp
-- iswupper wcscat wcstof wmemcpy
-- iswxdigit wcschr wcstoimax wmemmove
-- mblen wcscmp wcstok wmemset
-- mbrlen wcscoll wcstol
-- mbrtowc wcscpy wcstold
--
--
--config EGLIBC_OPTION_POSIX_REGEXP
-- bool "Regular expressions"
-- default y
-- help
-- This option group includes the POSIX regular expression
-- functions, and the associated non-POSIX extensions and
-- compatibility functions.
--
-- With EGLIBC_OPTION_POSIX_REGEXP disabled, the following functions are
-- omitted from libc:
--
-- re_comp re_max_failures regcomp
-- re_compile_fastmap re_search regerror
-- re_compile_pattern re_search_2 regexec
-- re_exec re_set_registers regfree
-- re_match re_set_syntax rpmatch
-- re_match_2 re_syntax_options
--
-- Furthermore, the compatibility regexp interface defined in the
-- <regexp.h> header file, 'compile', 'step', and 'advance', is
-- omitted.
--
--
--config EGLIBC_OPTION_POSIX_REGEXP_GLIBC
-- bool "Regular expressions from GLIBC"
-- default y
-- select EGLIBC_OPTION_POSIX_REGEXP
-- help
-- This option group specifies which regular expression
-- library to use. The choice is between regex
-- implementation from GLIBC and regex implementation from
-- libiberty. The GLIBC variant is fully POSIX conformant and
-- optimized for speed; regex from libiberty is more than twice
-- as small while still is enough for most practical purposes.
--
--
--config EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-- bool "Input and output functions for wide characters"
-- default y
-- select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR
-- help
-- This option group includes functions for reading and writing
-- wide characters to and from <stdio.h> streams.
--
-- This option group includes the following functions:
--
-- fgetwc fwprintf putwchar vwscanf
-- fgetws fwscanf ungetwc wprintf
-- fputwc getwc vfwprintf wscanf
-- fputws getwchar vfwscanf
-- fwide putwc vwprintf
--
-- This option group further includes the following unlocked
-- variants of the above functions:
--
-- fgetwc_unlocked getwc_unlocked
-- fgetws_unlocked getwchar_unlocked
-- fputwc_unlocked putwc_unlocked
-- fputws_unlocked putwchar_unlocked
--
-- Note that the GNU standard C++ library, 'libstdc++.so', uses
-- some of these functions; you will not be able to link or run
-- C++ programs if you disable this option group.
--
-- This option group also affects the behavior of the following
-- functions:
--
-- fdopen
-- fopen
-- fopen64
-- freopen
-- freopen64
--
-- These functions all take an OPENTYPE parameter which may
-- contain a string of the form ",ccs=CHARSET", indicating that
-- the underlying file uses the character set named CHARSET.
-- This produces a wide-oriented stream, which is only useful
-- when the functions included in this option group are present.
-- If the user attempts to open a file specifying a character set
-- in the OPENTYPE parameter, and EGLIBC was built with this
-- option group disabled, the function returns NULL, and sets
-- errno to EINVAL.
+++ /dev/null
----- 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])
+++ /dev/null
----- 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.]*\)],
+++ /dev/null
--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
+++ /dev/null
----- 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);
--
-- }
+++ /dev/null
----- 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,
+++ /dev/null
----- 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 $@
+++ /dev/null
--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)
+++ /dev/null
----- 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);
--
-- }
+++ /dev/null
--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)
+++ /dev/null
--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
+++ /dev/null
----- 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);
--
-- }
+++ /dev/null
--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)
--- /dev/null
--- /dev/null
++--- 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);
++
++ }
--- /dev/null
--- /dev/null
++add /usr/lib to default search path for the dynamic linker
++
++--- a/Makeconfig
+++++ b/Makeconfig
++@@ -527,6 +527,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)
$(CP) \
$(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
$(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
-- $(if $(call kernel_patchver_ge,3.15.0),$(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h) \
++ $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
$(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
endef
endif
+++ /dev/null
--# Debug version.
--
--config MUSL_ENABLE_DEBUG
-- bool "Build with debug information"
-- depends on TOOLCHAINOPTS && USE_MUSL
-- default n
config MUSL_VERSION
string
depends on USE_MUSL
-- default "1.1.9"
++ default "1.1.14"
endif
PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
PKG_RELEASE=1
--PKG_MD5SUM:=14e8c5ac74f887d53256b3dcaf9b4aaa
++PKG_MD5SUM:=d529ce4a2f7f79d8c3fd4b8329417b57
PKG_SOURCE_URL:=http://www.musl-libc.org/releases
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/toolchain-build.mk
++include $(INCLUDE_DIR)/hardening.mk
++
++# Please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67260
++ifeq ($(CONFIG_sh3),y)
++TARGET_CFLAGS+= \
++ -fno-optimize-sibling-calls
++endif
MUSL_CONFIGURE:= \
$(TARGET_CONFIGURE_OPTS) \
--prefix=/ \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
-- --disable-gcc-wrapper
--
--ifeq ($(CONFIG_MUSL_ENABLE_DEBUG),y)
--MUSL_CONFIGURE+= \
-- --enable-debug
--endif
++ --disable-gcc-wrapper \
++ --enable-debug
define Host/Prepare
$(call Host/Prepare/Default)
+++ /dev/null
--commit b6a6cd703ffefa6352249fb01f4da28d85d17306
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu Jun 4 11:45:17 2015 -0400
--
-- fix dynamic linker regression processing R_*_NONE type relocations
--
-- commit f3ddd173806fd5c60b3f034528ca24542aecc5b9 inadvertently removed
-- the early check for "none" type relocations, causing the address
-- dso->base+0 to be dereferenced to obtain an addend. shared libraries,
-- (including libc.so) and PIE executables were unaffected, since their
-- base addresses are the actual address of their mappings and are
-- readable. non-PIE main executables, however, have a base address of 0
-- because their load addresses are absolute and not offset at load time.
--
-- in practice none-type relocations do not arise with toolchains that
-- are in use except on mips, and on mips it's moderately rare for a
-- non-PIE executable to have a relocation table, since the mips-specific
-- got processing serves in its place for most purposes.
--
--commit 585ba14df4799d50ec9682ce75825d2eafec2a6a
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed Jun 3 02:00:44 2015 -0400
--
-- add additional Makefile dependency rules for rcrt1.o PIE start file
--
--commit 2b4fcfdacf93c3dfd6ac15e31790a9e154374679
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 28 23:08:12 2015 -0400
--
-- fix failure of ungetc and ungetwc to work on files in eof status
--
-- these functions were written to handle clearing eof status, but failed
-- to account for the __toread function's handling of eof. with this
-- patch applied, __toread still returns EOF when the file is in eof
-- status, so that read operations will fail, but it also sets up valid
-- buffer pointers for read mode, which are set to the end of the buffer
-- rather than the beginning in order to make the whole buffer available
-- to ungetc/ungetwc.
--
-- minor changes to __uflow were needed since it's now possible to have
-- non-zero buffer pointers while in eof status. as made, these changes
-- remove a 'fast path' bypassing the function call to __toread, which
-- could be reintroduced with slightly different logic, but since
-- ordinary files have a syscall in f->read, optimizing the code path
-- does not seem worthwhile.
--
-- the __stdio_read function is also updated not to zero the read buffer
-- pointers on eof/error. while not necessary for correctness, this
-- change avoids the overhead of calling __toread in ungetc after
-- reaching eof, and it also reduces code size and increases consistency
-- with the fmemopen read operation which does not zero the pointers.
--
--commit b6e7c664677ab7c77f183b8c41105f2be519800c
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 28 15:37:23 2015 -0400
--
-- add missing legacy LFS64 macros in sys/resource.h
--
-- based on patch by Felix Janda, with RLIM64_SAVED_CUR and
-- RLIM64_SAVED_MAX added for completeness.
--
--commit fc431d3f76bb9bde34a89e4a3e4d0c27de959855
--Author: Shiz <hi@shiz.me>
--Date: Thu May 28 05:52:22 2015 +0200
--
-- configure: work around compilers that merely warn for unknown options
--
-- some compilers (such as clang) accept unknown options without error,
-- but then print warnings on each invocation, cluttering the build
-- output and burying meaningful warnings. this patch makes configure's
-- tryflag and tryldflag functions use additional options to turn the
-- unknown-option warnings into errors, if available, but only at check
-- time. these options are not output in config.mak to avoid the risk of
-- spurious build breakage; if they work, they will have already done
-- their job at configure time.
--
--commit aeeac9ca5490d7d90fe061ab72da446c01ddf746
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed May 27 15:54:47 2015 -0400
--
-- implement fail-safe static locales for newlocale
--
-- this frees applications which need to make temporary use of the C
-- locale (via uselocale) from the possibility that newlocale might fail.
--
-- the C.UTF-8 locale is also provided as a static locale. presently they
-- behave the same, but this may change in the future.
--
--commit 11858d31aa020df3e7e7dedf49f9870ce12f31cc
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed May 27 03:32:46 2015 -0400
--
-- rename internal locale file handling locale maps
--
-- since the __setlocalecat function was removed, the filename
-- __setlocalecat.c no longer made sense.
--
--commit 61a3364d246e72b903da8b76c2e27a225a51351e
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed May 27 03:22:52 2015 -0400
--
-- overhaul locale internals to treat categories roughly uniformly
--
-- previously, LC_MESSAGES was treated specially as the only category
-- which could be set to a locale name without a definition file, in
-- order to facilitate gettext message translations when no libc locale
-- was available. LC_NUMERIC was completely un-settable, and LC_CTYPE
-- stored a flag intended to be used for a possible future byte-based C
-- locale, instead of storing a __locale_map pointer like the other
-- categories use.
--
-- this patch changes all categories to be represented by pointers to
-- __locale_map structures, and allows locale names without definition
-- files to be treated as valid locales with trivial definition when used
-- in any category. outwardly visible functional changes should be minor,
-- limited mainly to the strings read back from setlocale and the way
-- gettext handles translations in categories other than LC_MESSAGES.
--
-- various internal refactoring has also been performed, and improvements
-- in const correctness have been made.
--
--commit 63c188ec42e76ff768e81f6b65b11c68fc43351e
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed May 27 00:22:43 2015 -0400
--
-- replace atomics with locks in locale-setting code
--
-- this is part of a general program of removing direct use of atomics
-- where they are not necessary to meet correctness or performance needs,
-- but in this case it's also an optimization. only the global locale
-- needs synchronization; allocated locales referenced with locale_t
-- handles are immutable during their lifetimes, and using atomics to
-- initialize them increases their cost of setup.
--
--commit dc031ee0b1ba11baa00cd7f0769e461a5f396c71
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Tue May 26 03:37:41 2015 -0400
--
-- add rcrt1 start file for fully static-linked PIE
--
-- static-linked PIE files need startup code to relocate themselves, much
-- like the dynamic linker does. rcrt1.c reuses the code in dlstart.c,
-- stage 1 of the dynamic linker, which in turn reuses crt_arch.h, to
-- achieve static PIE with no new code. only relative relocations are
-- supported.
--
-- existing toolchains that don't yet support static PIE directly can be
-- repurposed by passing "-shared -Wl,-Bstatic -Wl,-Bsymbolic" instead of
-- "-static -pie" and substituting rcrt1.o in place of crt1.o.
--
-- all libraries being linked must be built as PIC/PIE; TEXTRELs are not
-- supported at this time.
--
--commit ed0c8249825161036356a3616e8c5247c15d0927
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Tue May 26 02:31:04 2015 -0400
--
-- fix incorrect application of visibility to Scrt1.o
--
-- commit de2b67f8d41e08caa56bf6540277f6561edb647f attempted to avoid
-- having vis.h affect crt files, but the Makefile variable used,
-- CRT_LIBS, refers to the final output copies in the lib directory, not
-- the copies in the crt build directory, and thus the -DCRT was not
-- applied.
--
-- while unlikely to be noticed, this regression probably broke
-- production of PIE executables whose main functions are not in the
-- executable but rather a shared library.
--
--commit 9bbddf730f7837cf87f4c789fbb41a312e295d6c
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 23:33:59 2015 -0400
--
-- reprocess all libc/ldso symbolic relocations in dynamic linking stage 3
--
-- commit f3ddd173806fd5c60b3f034528ca24542aecc5b9 introduced early
-- relocations and subsequent reprocessing as part of the dynamic linker
-- bootstrap overhaul, to allow use of arbitrary libc functions before
-- the main application and libraries are loaded, but only reprocessed
-- GOT/PLT relocation types.
--
-- commit c093e2e8201524db0d638920e76bcb6b1d925f3a added reprocessing of
-- non-GOT/PLT relocations to fix an actual regression that was observed
-- on powerpc, but only for RELA format tables with out-of-line addends.
-- REL table (inline addends at the relocation address) reprocessing is
-- trickier because the first relocation pass clobbers the addends.
--
-- this patch extends symbolic relocation reprocessing for libc/ldso to
-- support all relocation types, whether REL or RELA format tables are
-- used. it is believed not to alter behavior on any existing archs for
-- the current dynamic linker and libc code. the motivations for this
-- change are consistency and future-proofing. it ensures that behavior
-- does not differ depending on whether REL or RELA tables are used,
-- which could lead to undetected arch-specific bugs. it also ensures
-- that, if in the future code depending on additional relocation types
-- is added to libc.so, either at the source level or as part of the
-- compiler runtime that gets pulled in (for example, soft-float with TLS
-- for fenv), the new code will work properly.
--
-- the implementation concept is simple: stage 2 of the dynamic linker
-- counts the number of symbolic relocations in the libc/ldso REL table
-- and allocates a VLA to save their addends into; stage 3 then uses the
-- saved addends in place of the inline ones which were clobbered. for
-- stack safety, a hard limit (currently 4k) is imposed on the number of
-- such addends; this should be a couple orders of magnitude larger than
-- the actual need. this number is not a runtime variable that could
-- break fail-safety; it is constant for a given libc.so build.
--
--commit 768b82c6de24e480267c4c251c440edfc71800e3
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 19:15:17 2015 -0400
--
-- move call to dynamic linker stage-3 into stage-2 function
--
-- this move eliminates a duplicate "by-hand" symbol lookup loop from the
-- stage-1 code and replaces it with a call to find_sym, which can be
-- used once we're in stage 2. it reduces the size of the stage 1 code,
-- which is helpful because stage 1 will become the crt start file for
-- static-PIE executables, and it will allow stage 3 to access stage 2's
-- automatic storage, which will be important in an upcoming commit.
--
--commit 967bcbf67c3ffac587de4d79abc1e5e072d83e3e
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 16:02:49 2015 -0400
--
-- mark mips crt code as code
--
-- otherwise disassemblers treat it as data.
--
--commit 7b75c4877ddf22f219f944c61d939df1dee4f6d3
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 15:56:36 2015 -0400
--
-- mark mips cancellable syscall code as code
--
-- otherwise disassemblers treat it as data.
--
--commit 0e0e49421f08cfd670975ecd3604f7f9015e1833
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 00:32:37 2015 -0400
--
-- simplify/shrink relocation processing in dynamic linker stage 1
--
-- the outer-loop approach made sense when we were also processing
-- DT_JMPREL, which might be in REL or RELA form, to avoid major code
-- duplication. commit 09db855b35709aa627d7055c57a98e1e471920ab removed
-- processing of DT_JMPREL, and in the remaining two tables, the format
-- (REL or RELA) is known by the name of the table. simply writing two
-- versions of the loop results in smaller and simpler code.
--
--commit 09db855b35709aa627d7055c57a98e1e471920ab
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 25 00:25:56 2015 -0400
--
-- remove processing of DT_JMPREL from dynamic linker stage 1 bootstrap
--
-- the DT_JMPREL relocation table necessarily consists entirely of
-- JMP_SLOT (REL_PLT in internal nomenclature) relocations, which are
-- symbolic; they cannot be resolved in stage 1, so there is no point in
-- processing them.
--
--commit 9f26ebded188ed78c3571a4ca1477dd6351bc647
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Sun May 24 23:03:47 2015 -0400
--
-- fix stack alignment code in mips crt_arch.h
--
-- the instruction used to align the stack, "and $sp, $sp, -8", does not
-- actually exist; it's expanded to 2 instructions using the 'at'
-- (assembler temporary) register, and thus cannot be used in a branch
-- delay slot. since alignment mod 16 commutes with subtracting 8, simply
-- swapping these two operations fixes the problem.
--
-- crt1.o was not affected because it's still being generated from a
-- dedicated asm source file. dlstart.lo was not affected because the
-- stack pointer it receives is already aligned by the kernel. but
-- Scrt1.o was affected in cases where the dynamic linker gave it a
-- misaligned stack pointer.
--
--commit 63caf1d207d143fe405bbe0cda9aac8deca1171a
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Fri May 22 01:50:05 2015 -0400
--
-- add .text section directive to all crt_arch.h files missing it
--
-- i386 and x86_64 versions already had the .text directive; other archs
-- did not. normally, top-level (file scope) __asm__ starts in the .text
-- section anyway, but problems were reported with some versions of
-- clang, and it seems preferable to set it explicitly anyway, at least
-- for the sake of consistency between archs.
--
--commit 3b0e83264d156f9e496ab32badd89e4447b807aa
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 21 17:06:28 2015 -0400
--
-- remove outdated and misleading comment in iconv.c
--
-- the comment claimed that EUC/GBK/Big5 are not implemented, which has
-- been incorrect since commit 19b4a0a20efc6b9df98b6a43536ecdd628ba4643.
--
--commit 39b8ce66f2ed9c17427ec3a48be9bda29b93b9d7
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 21 17:01:23 2015 -0400
--
-- in iconv_open, accept "CHAR" and "" as aliases for "UTF-8"
--
-- while not a requirement, it's common convention in other iconv
-- implementations to accept "CHAR" as an alias for nl_langinfo(CODESET),
-- meaning the encoding used for char[] strings in the current locale,
-- and also "" as an alternate form. supporting this is not costly and
-- improves compatibility.
--
--commit c648cefb27984db60474ec1747cbfde83c2856d0
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Wed May 20 00:17:35 2015 -0400
--
-- fix inconsistency in a_and and a_or argument types on x86[_64]
--
-- conceptually, and on other archs, these functions take a pointer to
-- int, but in the i386, x86_64, and x32 versions of atomic.h, they took
-- a pointer to void instead.
--
--commit 390f93ef69153bf2087fcf3baa1776ad9a6765ab
--Author: Bobby Bingham <koorogi@koorogi.info>
--Date: Sun May 17 13:46:38 2015 -0500
--
-- inline llsc atomics when building for sh4a
--
-- If we're building for sh4a, the compiler is already free to use
-- instructions only available on sh4a, so we can do the same and inline the
-- llsc atomics. If we're building for an older processor, we still do the
-- same runtime atomics selection as before.
--
--commit c093e2e8201524db0d638920e76bcb6b1d925f3a
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 18 16:51:54 2015 -0400
--
-- reprocess libc/ldso RELA relocations in stage 3 of dynamic linking
--
-- this fixes a regression on powerpc that was introduced in commit
-- f3ddd173806fd5c60b3f034528ca24542aecc5b9. global data accesses on
-- powerpc seem to be using a translation-unit-local GOT filled via
-- R_PPC_ADDR32 relocations rather than R_PPC_GLOB_DAT. being a non-GOT
-- relocation type, these were not reprocessed after adding the main
-- application and its libraries to the chain, causing libc code not to
-- see copy relocations in the main program, and therefore to use the
-- pre-copy-relocation addresses for global data objects (like environ).
--
-- the motivation for the dynamic linker only reprocessing GOT/PLT
-- relocation types in stage 3 is that these types always have a zero
-- addend, making them safe to process again even if the storage for the
-- addend has been clobbered. other relocation types which can be used
-- for address constants in initialized data objects may have non-zero
-- addends which will be clobbered during the first pass of relocation
-- processing if they're stored inline (REL form) rather than out-of-line
-- (RELA form).
--
-- powerpc generally uses only RELA, so this patch is sufficient to fix
-- the regression in practice, but is not fully general, and would not
-- suffice if an alternate toolchain generated REL for powerpc.
--
--commit 43e9f652bf4b2195b04fc14c93db591b30a7b790
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Mon May 18 12:11:25 2015 -0400
--
-- fix null pointer dereference in dcngettext under specific conditions
--
-- if setlocale has not been called, the current locale's messages_name
-- may be a null pointer. the code path where it's assumed to be non-null
-- was only reachable if bindtextdomain had already been called, which is
-- normally not done in programs which do not call setlocale, so the
-- omitted check went unnoticed.
--
-- patch from Void Linux, with description rewritten.
--
--commit 68630b55c0c7219fe9df70dc28ffbf9efc8021d8
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Sat May 16 01:53:54 2015 -0400
--
-- eliminate costly tricks to avoid TLS access for current locale state
--
-- the code being removed used atomics to track whether any threads might
-- be using a locale other than the current global locale, and whether
-- any threads might have abstract 8-bit (non-UTF-8) LC_CTYPE active, a
-- feature which was never committed (still pending). the motivations
-- were to support early execution prior to setup of the thread pointer,
-- to partially support systems (ancient kernels) where thread pointer
-- setup is not possible, and to avoid high performance cost on archs
-- where accessing the thread pointer may be very slow.
--
-- since commit 19a1fe670acb3ab9ead0fe31859ca7d4fe40dd54, the thread
-- pointer is always available, so these hacks are no longer needed.
-- removing them greatly simplifies the affected code.
--
--commit 707d7c30f3379441de9b320536ddfd354f4c2143
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Sat May 16 01:15:40 2015 -0400
--
-- in i386 __set_thread_area, don't assume %gs register is initially zero
--
-- commit f630df09b1fd954eda16e2f779da0b5ecc9d80d3 added logic to handle
-- the case where __set_thread_area is called more than once by reusing
-- the GDT slot already in the %gs register, and only setting up a new
-- GDT slot when %gs is zero. this created a hidden assumption that %gs
-- is zero when a new process image starts, which is true in practice on
-- Linux, but does not seem to be documented ABI, and fails to hold under
-- qemu app-level emulation.
--
-- while it would in theory be possible to zero %gs in the entry point
-- code, this code is shared between static and dynamic binaries, and
-- dynamic binaries must not clobber the value of %gs already setup by
-- the dynamic linker.
--
-- the alternative solution implemented in this commit simply uses global
-- data to store the GDT index that's selected. __set_thread_area should
-- only be called in the initial thread anyway (subsequent threads get
-- their thread pointer setup by __clone), but even if it were called by
-- another thread, it would simply read and write back the same GDT index
-- that was already assigned to the initial thread, and thus (in the x86
-- memory model) there is no data race.
--
--commit c0f10cf06725bd0de37f3ced7954a653bf9f1049
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 14 18:51:27 2015 -0400
--
-- make arm reloc.h CRTJMP macro compatible with thumb
--
-- compilers targeting armv7 may be configured to produce thumb2 code
-- instead of arm code by default, and in the future we may wish to
-- support targets where only the thumb instruction set is available.
--
-- the instructions this patch omits in thumb mode are needed only for
-- non-thumb versions of armv4 or earlier, which are not supported by any
-- current compilers/toolchains and thus rather pointless to have. at
-- some point these compatibility return sequences may be removed from
-- all asm source files, and in that case it would make sense to remove
-- them here too and remove the ifdef.
--
--commit 83340c7a580e91b22f58321b7cf6d976af61084c
--Author: Rich Felker <dalias@aerifal.cx>
--Date: Thu May 14 18:26:16 2015 -0400
--
-- make arm crt_arch.h compatible with thumb code generation
--
-- compilers targeting armv7 may be configured to produce thumb2 code
-- instead of arm code by default, and in the future we may wish to
-- support targets where only the thumb instruction set is available.
--
-- the changes made here avoid operating directly on the sp register,
-- which is not possible in thumb code, and address an issue with the way
-- the address of _DYNAMIC is computed.
--
-- previously, the relative address of _DYNAMIC was stored with an
-- additional offset of -8 versus the pc-relative add instruction, since
-- on arm the pc register evaluates to ".+8". in thumb code, it instead
-- evaluates to ".+4". both are two (normal-size) instructions beyond "."
-- in the current execution mode, so the numbered label 2 used in the
-- relative address expression is simply moved two instructions ahead to
-- be compatible with both instruction sets.
--
----- a/Makefile
--+++ b/Makefile
--@@ -44,7 +44,7 @@ ALL_INCLUDES = $(sort $(wildcard include
--
-- EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl
-- EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a)
---CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/crti.o lib/crtn.o
--+CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rcrt1.o lib/crti.o lib/crtn.o
-- STATIC_LIBS = lib/libc.a
-- SHARED_LIBS = lib/libc.so
-- TOOL_LIBS = lib/musl-gcc.specs
--@@ -85,11 +85,13 @@ src/internal/version.h: $(wildcard VERSI
--
-- src/internal/version.lo: src/internal/version.h
--
---src/ldso/dlstart.lo src/ldso/dynlink.lo: src/internal/dynlink.h arch/$(ARCH)/reloc.h
--+crt/rcrt1.o src/ldso/dlstart.lo src/ldso/dynlink.lo: src/internal/dynlink.h arch/$(ARCH)/reloc.h
--
---crt/crt1.o crt/Scrt1.o src/ldso/dlstart.lo: $(wildcard arch/$(ARCH)/crt_arch.h)
--+crt/crt1.o crt/Scrt1.o crt/rcrt1.o src/ldso/dlstart.lo: $(wildcard arch/$(ARCH)/crt_arch.h)
--
---crt/Scrt1.o: CFLAGS += -fPIC
--+crt/rcrt1.o: src/ldso/dlstart.c
--+
--+crt/Scrt1.o crt/rcrt1.o: CFLAGS += -fPIC
--
-- OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=src/%))
-- $(OPTIMIZE_SRCS:%.c=%.o) $(OPTIMIZE_SRCS:%.c=%.lo): CFLAGS += -O3
--@@ -104,7 +106,7 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
-- src/ldso/dlstart.c src/ldso/dynlink.c
-- $(NOSSP_SRCS:%.c=%.o) $(NOSSP_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_NOSSP)
--
---$(CRT_LIBS): CFLAGS += -DCRT
--+$(CRT_LIBS:lib/%=crt/%): CFLAGS += -DCRT
--
-- # This incantation ensures that changes to any subarch asm files will
-- # force the corresponding object file to be rebuilt, even if the implicit
----- a/arch/aarch64/crt_arch.h
--+++ b/arch/aarch64/crt_arch.h
--@@ -1,4 +1,5 @@
-- __asm__(
--+".text \n"
-- ".global " START "\n"
-- ".type " START ",%function\n"
-- START ":\n"
----- a/arch/arm/crt_arch.h
--+++ b/arch/arm/crt_arch.h
--@@ -1,15 +1,18 @@
-- __asm__(
--+".text \n"
-- ".global " START " \n"
-- ".type " START ",%function \n"
-- START ": \n"
-- " mov fp, #0 \n"
-- " mov lr, #0 \n"
---" mov a1, sp \n"
-- " ldr a2, 1f \n"
---"2: add a2, pc, a2 \n"
---" and sp, sp, #-16 \n"
--+" add a2, pc, a2 \n"
--+" mov a1, sp \n"
--+"2: and ip, a1, #-16 \n"
--+" mov sp, ip \n"
-- " bl " START "_c \n"
-- ".weak _DYNAMIC \n"
-- ".hidden _DYNAMIC \n"
---"1: .word _DYNAMIC-2b-8 \n"
--+".align 2 \n"
--+"1: .word _DYNAMIC-2b \n"
-- );
----- a/arch/arm/reloc.h
--+++ b/arch/arm/reloc.h
--@@ -28,5 +28,10 @@
-- #define REL_TPOFF R_ARM_TLS_TPOFF32
-- //#define REL_TLSDESC R_ARM_TLS_DESC
--
--+#ifdef __thumb__
--+#define CRTJMP(pc,sp) __asm__ __volatile__( \
--+ "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
--+#else
-- #define CRTJMP(pc,sp) __asm__ __volatile__( \
-- "mov sp,%1 ; tst %0,#1 ; moveq pc,%0 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
--+#endif
----- a/arch/i386/atomic.h
--+++ b/arch/i386/atomic.h
--@@ -50,16 +50,16 @@ static inline int a_cas(volatile int *p,
-- return t;
-- }
--
---static inline void a_or(volatile void *p, int v)
--+static inline void a_or(volatile int *p, int v)
-- {
-- __asm__( "lock ; orl %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
---static inline void a_and(volatile void *p, int v)
--+static inline void a_and(volatile int *p, int v)
-- {
-- __asm__( "lock ; andl %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
-- static inline int a_swap(volatile int *x, int v)
----- a/arch/microblaze/crt_arch.h
--+++ b/arch/microblaze/crt_arch.h
--@@ -1,4 +1,5 @@
-- __asm__(
--+".text \n"
-- ".global " START " \n"
-- ".align 2 \n"
-- START ": \n"
----- a/arch/mips/crt_arch.h
--+++ b/arch/mips/crt_arch.h
--@@ -1,6 +1,7 @@
-- __asm__(
-- ".set push\n"
-- ".set noreorder\n"
--+".text \n"
-- ".global _" START "\n"
-- ".global " START "\n"
-- ".type _" START ", @function\n"
--@@ -21,8 +22,8 @@ __asm__(
-- " addu $5, $5, $gp \n"
-- " lw $25, 4($ra) \n"
-- " addu $25, $25, $gp \n"
---" subu $sp, $sp, 16 \n"
--+" and $sp, $sp, -8 \n"
-- " jalr $25 \n"
---" and $sp, $sp, -8 \n"
--+" subu $sp, $sp, 16 \n"
-- ".set pop \n"
-- );
----- a/arch/or1k/crt_arch.h
--+++ b/arch/or1k/crt_arch.h
--@@ -1,4 +1,5 @@
-- __asm__(
--+".text \n"
-- ".global " START " \n"
-- ".align 4 \n"
-- START ": \n"
----- a/arch/powerpc/crt_arch.h
--+++ b/arch/powerpc/crt_arch.h
--@@ -1,4 +1,5 @@
-- __asm__(
--+".text \n"
-- ".global " START " \n"
-- ".type " START ", %function \n"
-- START ": \n"
----- a/arch/sh/atomic.h
--+++ b/arch/sh/atomic.h
--@@ -22,6 +22,88 @@ static inline int a_ctz_64(uint64_t x)
-- return a_ctz_l(y);
-- }
--
--+#define LLSC_CLOBBERS "r0", "t", "memory"
--+#define LLSC_START(mem) "synco\n" \
--+ "0: movli.l @" mem ", r0\n"
--+#define LLSC_END(mem) \
--+ "1: movco.l r0, @" mem "\n" \
--+ " bf 0b\n" \
--+ " synco\n"
--+
--+static inline int __sh_cas_llsc(volatile int *p, int t, int s)
--+{
--+ int old;
--+ __asm__ __volatile__(
--+ LLSC_START("%1")
--+ " mov r0, %0\n"
--+ " cmp/eq %0, %2\n"
--+ " bf 1f\n"
--+ " mov %3, r0\n"
--+ LLSC_END("%1")
--+ : "=&r"(old) : "r"(p), "r"(t), "r"(s) : LLSC_CLOBBERS);
--+ return old;
--+}
--+
--+static inline int __sh_swap_llsc(volatile int *x, int v)
--+{
--+ int old;
--+ __asm__ __volatile__(
--+ LLSC_START("%1")
--+ " mov r0, %0\n"
--+ " mov %2, r0\n"
--+ LLSC_END("%1")
--+ : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
--+ return old;
--+}
--+
--+static inline int __sh_fetch_add_llsc(volatile int *x, int v)
--+{
--+ int old;
--+ __asm__ __volatile__(
--+ LLSC_START("%1")
--+ " mov r0, %0\n"
--+ " add %2, r0\n"
--+ LLSC_END("%1")
--+ : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
--+ return old;
--+}
--+
--+static inline void __sh_store_llsc(volatile int *p, int x)
--+{
--+ __asm__ __volatile__(
--+ " synco\n"
--+ " mov.l %1, @%0\n"
--+ " synco\n"
--+ : : "r"(p), "r"(x) : "memory");
--+}
--+
--+static inline void __sh_and_llsc(volatile int *x, int v)
--+{
--+ __asm__ __volatile__(
--+ LLSC_START("%0")
--+ " and %1, r0\n"
--+ LLSC_END("%0")
--+ : : "r"(x), "r"(v) : LLSC_CLOBBERS);
--+}
--+
--+static inline void __sh_or_llsc(volatile int *x, int v)
--+{
--+ __asm__ __volatile__(
--+ LLSC_START("%0")
--+ " or %1, r0\n"
--+ LLSC_END("%0")
--+ : : "r"(x), "r"(v) : LLSC_CLOBBERS);
--+}
--+
--+#ifdef __SH4A__
--+#define a_cas(p,t,s) __sh_cas_llsc(p,t,s)
--+#define a_swap(x,v) __sh_swap_llsc(x,v)
--+#define a_fetch_add(x,v) __sh_fetch_add_llsc(x, v)
--+#define a_store(x,v) __sh_store_llsc(x, v)
--+#define a_and(x,v) __sh_and_llsc(x, v)
--+#define a_or(x,v) __sh_or_llsc(x, v)
--+#else
--+
-- int __sh_cas(volatile int *, int, int);
-- int __sh_swap(volatile int *, int);
-- int __sh_fetch_add(volatile int *, int);
--@@ -35,6 +117,7 @@ void __sh_or(volatile int *, int);
-- #define a_store(x,v) __sh_store(x, v)
-- #define a_and(x,v) __sh_and(x, v)
-- #define a_or(x,v) __sh_or(x, v)
--+#endif
--
-- static inline void *a_cas_p(volatile void *p, void *t, void *s)
-- {
----- a/arch/sh/crt_arch.h
--+++ b/arch/sh/crt_arch.h
--@@ -1,4 +1,5 @@
-- __asm__(
--+".text \n"
-- ".global " START " \n"
-- START ": \n"
-- " mova 1f, r0 \n"
----- a/arch/sh/src/atomic.c
--+++ b/arch/sh/src/atomic.c
--@@ -1,12 +1,7 @@
---#include "libc.h"
--+#ifndef __SH4A__
--
---#define LLSC_CLOBBERS "r0", "t", "memory"
---#define LLSC_START(mem) "synco\n" \
--- "0: movli.l @" mem ", r0\n"
---#define LLSC_END(mem) \
--- "1: movco.l r0, @" mem "\n" \
--- " bf 0b\n" \
--- " synco\n"
--+#include "atomic.h"
--+#include "libc.h"
--
-- /* gusa is a hack in the kernel which lets you create a sequence of instructions
-- * which will be restarted if the process is preempted in the middle of the
--@@ -34,114 +29,74 @@
--
-- int __sh_cas(volatile int *p, int t, int s)
-- {
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_cas_llsc(p, t, s);
--+
-- int old;
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- LLSC_START("%1")
--- " mov r0, %0\n"
--- " cmp/eq %0, %2\n"
--- " bf 1f\n"
--- " mov %3, r0\n"
--- LLSC_END("%1")
--- : "=&r"(old) : "r"(p), "r"(t), "r"(s) : LLSC_CLOBBERS);
--- } else {
--- __asm__ __volatile__(
--- GUSA_START_EVEN("%1", "%0")
--- " cmp/eq %0, %2\n"
--- " bf 1f\n"
--- GUSA_END("%1", "%3")
--- : "=&r"(old) : "r"(p), "r"(t), "r"(s) : GUSA_CLOBBERS, "t");
--- }
--+ __asm__ __volatile__(
--+ GUSA_START_EVEN("%1", "%0")
--+ " cmp/eq %0, %2\n"
--+ " bf 1f\n"
--+ GUSA_END("%1", "%3")
--+ : "=&r"(old) : "r"(p), "r"(t), "r"(s) : GUSA_CLOBBERS, "t");
-- return old;
-- }
--
-- int __sh_swap(volatile int *x, int v)
-- {
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_swap_llsc(x, v);
--+
-- int old;
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- LLSC_START("%1")
--- " mov r0, %0\n"
--- " mov %2, r0\n"
--- LLSC_END("%1")
--- : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
--- } else {
--- __asm__ __volatile__(
--- GUSA_START_EVEN("%1", "%0")
--- GUSA_END("%1", "%2")
--- : "=&r"(old) : "r"(x), "r"(v) : GUSA_CLOBBERS);
--- }
--+ __asm__ __volatile__(
--+ GUSA_START_EVEN("%1", "%0")
--+ GUSA_END("%1", "%2")
--+ : "=&r"(old) : "r"(x), "r"(v) : GUSA_CLOBBERS);
-- return old;
-- }
--
-- int __sh_fetch_add(volatile int *x, int v)
-- {
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_fetch_add_llsc(x, v);
--+
-- int old, dummy;
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- LLSC_START("%1")
--- " mov r0, %0\n"
--- " add %2, r0\n"
--- LLSC_END("%1")
--- : "=&r"(old) : "r"(x), "r"(v) : LLSC_CLOBBERS);
--- } else {
--- __asm__ __volatile__(
--- GUSA_START_EVEN("%2", "%0")
--- " mov %0, %1\n"
--- " add %3, %1\n"
--- GUSA_END("%2", "%1")
--- : "=&r"(old), "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
--- }
--+ __asm__ __volatile__(
--+ GUSA_START_EVEN("%2", "%0")
--+ " mov %0, %1\n"
--+ " add %3, %1\n"
--+ GUSA_END("%2", "%1")
--+ : "=&r"(old), "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
-- return old;
-- }
--
-- void __sh_store(volatile int *p, int x)
-- {
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- " synco\n"
--- " mov.l %1, @%0\n"
--- " synco\n"
--- : : "r"(p), "r"(x) : "memory");
--- } else {
--- __asm__ __volatile__(
--- " mov.l %1, @%0\n"
--- : : "r"(p), "r"(x) : "memory");
--- }
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_store_llsc(p, x);
--+ __asm__ __volatile__(
--+ " mov.l %1, @%0\n"
--+ : : "r"(p), "r"(x) : "memory");
-- }
--
-- void __sh_and(volatile int *x, int v)
-- {
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_and_llsc(x, v);
--+
-- int dummy;
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- LLSC_START("%0")
--- " and %1, r0\n"
--- LLSC_END("%0")
--- : : "r"(x), "r"(v) : LLSC_CLOBBERS);
--- } else {
--- __asm__ __volatile__(
--- GUSA_START_ODD("%1", "%0")
--- " and %2, %0\n"
--- GUSA_END("%1", "%0")
--- : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
--- }
--+ __asm__ __volatile__(
--+ GUSA_START_ODD("%1", "%0")
--+ " and %2, %0\n"
--+ GUSA_END("%1", "%0")
--+ : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
-- }
--
-- void __sh_or(volatile int *x, int v)
-- {
--+ if (__hwcap & CPU_HAS_LLSC) return __sh_or_llsc(x, v);
--+
-- int dummy;
--- if (__hwcap & CPU_HAS_LLSC) {
--- __asm__ __volatile__(
--- LLSC_START("%0")
--- " or %1, r0\n"
--- LLSC_END("%0")
--- : : "r"(x), "r"(v) : LLSC_CLOBBERS);
--- } else {
--- __asm__ __volatile__(
--- GUSA_START_ODD("%1", "%0")
--- " or %2, %0\n"
--- GUSA_END("%1", "%0")
--- : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
--- }
--+ __asm__ __volatile__(
--+ GUSA_START_ODD("%1", "%0")
--+ " or %2, %0\n"
--+ GUSA_END("%1", "%0")
--+ : "=&r"(dummy) : "r"(x), "r"(v) : GUSA_CLOBBERS);
-- }
--+
--+#endif
----- a/arch/x32/atomic.h
--+++ b/arch/x32/atomic.h
--@@ -47,16 +47,16 @@ static inline int a_cas(volatile int *p,
-- return t;
-- }
--
---static inline void a_or(volatile void *p, int v)
--+static inline void a_or(volatile int *p, int v)
-- {
-- __asm__( "lock ; or %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
---static inline void a_and(volatile void *p, int v)
--+static inline void a_and(volatile int *p, int v)
-- {
-- __asm__( "lock ; and %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
-- static inline int a_swap(volatile int *x, int v)
----- a/arch/x86_64/atomic.h
--+++ b/arch/x86_64/atomic.h
--@@ -47,16 +47,16 @@ static inline int a_cas(volatile int *p,
-- return t;
-- }
--
---static inline void a_or(volatile void *p, int v)
--+static inline void a_or(volatile int *p, int v)
-- {
-- __asm__( "lock ; or %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
---static inline void a_and(volatile void *p, int v)
--+static inline void a_and(volatile int *p, int v)
-- {
-- __asm__( "lock ; and %1, %0"
--- : "=m"(*(int *)p) : "r"(v) : "memory" );
--+ : "=m"(*p) : "r"(v) : "memory" );
-- }
--
-- static inline int a_swap(volatile int *x, int v)
----- a/configure
--+++ b/configure
--@@ -80,7 +80,7 @@ fi
-- tryflag () {
-- printf "checking whether compiler accepts %s... " "$2"
-- echo "typedef int x;" > "$tmpc"
---if $CC $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
--+if $CC $CFLAGS_TRY $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
-- printf "yes\n"
-- eval "$1=\"\${$1} \$2\""
-- eval "$1=\${$1# }"
--@@ -94,7 +94,7 @@ fi
-- tryldflag () {
-- printf "checking whether linker accepts %s... " "$2"
-- echo "typedef int x;" > "$tmpc"
---if $CC -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
--+if $CC $LDFLAGS_TRY -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
-- printf "yes\n"
-- eval "$1=\"\${$1} \$2\""
-- eval "$1=\${$1# }"
--@@ -113,7 +113,9 @@ CFLAGS_C99FSE=
-- CFLAGS_AUTO=
-- CFLAGS_MEMOPS=
-- CFLAGS_NOSSP=
--+CFLAGS_TRY=
-- LDFLAGS_AUTO=
--+LDFLAGS_TRY=
-- OPTIMIZE_GLOBS=
-- prefix=/usr/local/musl
-- exec_prefix='$(prefix)'
--@@ -205,6 +207,14 @@ exit 1
-- fi
--
-- #
--+# Figure out options to force errors on unknown flags.
--+#
--+tryflag CFLAGS_TRY -Werror=unknown-warning-option
--+tryflag CFLAGS_TRY -Werror=unused-command-line-argument
--+tryldflag LDFLAGS_TRY -Werror=unknown-warning-option
--+tryldflag LDFLAGS_TRY -Werror=unused-command-line-argument
--+
--+#
-- # Need to know if the compiler is gcc to decide whether to build the
-- # musl-gcc wrapper, and for critical bug detection in some gcc versions.
-- #
----- a/crt/mips/crt1.s
--+++ b/crt/mips/crt1.s
--@@ -4,6 +4,8 @@
-- .weak _fini
-- .global __start
-- .global _start
--+.type __start,@function
--+.type _start,@function
-- __start:
-- _start:
-- subu $fp, $fp, $fp # Zero the frame pointer.
----- a/crt/mips/crti.s
--+++ b/crt/mips/crti.s
--@@ -2,6 +2,7 @@
--
-- .section .init
-- .global _init
--+.type _init,@function
-- .align 2
-- _init:
-- subu $sp,$sp,32
--@@ -10,6 +11,7 @@ _init:
--
-- .section .fini
-- .global _fini
--+.type _fini,@function
-- .align 2
-- _fini:
-- subu $sp,$sp,32
----- /dev/null
--+++ b/crt/rcrt1.c
--@@ -0,0 +1,15 @@
--+#define SHARED
--+#define START "_start"
--+#define _dlstart_c _start_c
--+#include "../src/ldso/dlstart.c"
--+
--+int main();
--+void _init() __attribute__((weak));
--+void _fini() __attribute__((weak));
--+_Noreturn int __libc_start_main(int (*)(), int, char **,
--+ void (*)(), void(*)(), void(*)());
--+
--+_Noreturn void __dls2(unsigned char *base, size_t *sp)
--+{
--+ __libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
--+}
----- a/include/sys/resource.h
--+++ b/include/sys/resource.h
--@@ -96,6 +96,9 @@ int prlimit(pid_t, int, const struct rli
-- #define RLIM_NLIMITS RLIMIT_NLIMITS
--
-- #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
--+#define RLIM64_INFINITY RLIM_INFINITY
--+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
--+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
-- #define getrlimit64 getrlimit
-- #define setrlimit64 setrlimit
-- #define rlimit64 rlimit
----- a/src/internal/dynlink.h
--+++ b/src/internal/dynlink.h
--@@ -51,7 +51,7 @@ enum {
-- #define AUX_CNT 32
-- #define DYN_CNT 32
--
---typedef void (*stage2_func)(unsigned char *);
--+typedef void (*stage2_func)(unsigned char *, size_t *);
-- typedef _Noreturn void (*stage3_func)(size_t *);
--
-- #endif
----- a/src/internal/libc.h
--+++ b/src/internal/libc.h
--@@ -8,9 +8,7 @@
-- struct __locale_map;
--
-- struct __locale_struct {
--- volatile int ctype_utf8;
--- char *messages_name;
--- struct __locale_map *volatile cat[4];
--+ const struct __locale_map *volatile cat[6];
-- };
--
-- struct __libc {
--@@ -23,8 +21,6 @@ struct __libc {
-- volatile int ofl_lock[2];
-- size_t tls_size;
-- size_t page_size;
--- volatile int uselocale_cnt;
--- volatile int bytelocale_cnt_minus_1;
-- struct __locale_struct global_locale;
-- };
--
----- a/src/internal/locale_impl.h
--+++ b/src/internal/locale_impl.h
--@@ -9,22 +9,20 @@ struct __locale_map {
-- const void *map;
-- size_t map_size;
-- char name[LOCALE_NAME_MAX+1];
--- struct __locale_map *next;
--+ const struct __locale_map *next;
-- };
--
---int __setlocalecat(locale_t, int, const char *);
--+const struct __locale_map *__get_locale(int, const char *);
-- const char *__mo_lookup(const void *, size_t, const char *);
-- const char *__lctrans(const char *, const struct __locale_map *);
-- const char *__lctrans_cur(const char *);
--
---#define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)-2])
--+#define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)])
-- #define LCTRANS_CUR(msg) __lctrans_cur(msg)
--
---#define CURRENT_LOCALE \
--- (libc.uselocale_cnt ? __pthread_self()->locale : &libc.global_locale)
--+#define CURRENT_LOCALE (__pthread_self()->locale)
--
---#define CURRENT_UTF8 \
--- (libc.bytelocale_cnt_minus_1<0 || __pthread_self()->locale->ctype_utf8)
--+#define CURRENT_UTF8 (!!__pthread_self()->locale->cat[LC_CTYPE])
--
-- #undef MB_CUR_MAX
-- #define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1)
----- a/src/ldso/dlstart.c
--+++ b/src/ldso/dlstart.c
--@@ -56,31 +56,22 @@ void _dlstart_c(size_t *sp, size_t *dynv
-- for (i=0; i<local_cnt; i++) got[i] += (size_t)base;
-- }
--
--- /* The use of the reloc_info structure and nested loops is a trick
--- * to work around the fact that we can't necessarily make function
--- * calls yet. Each struct in the array serves like the arguments
--- * to a function call. */
--- struct {
--- void *rel;
--- size_t size;
--- size_t stride;
--- } reloc_info[] = {
--- { base+dyn[DT_JMPREL], dyn[DT_PLTRELSZ], 2+(dyn[DT_PLTREL]==DT_RELA) },
--- { base+dyn[DT_REL], dyn[DT_RELSZ], 2 },
--- { base+dyn[DT_RELA], dyn[DT_RELASZ], 3 },
--- { 0, 0, 0 }
--- };
---
--- for (i=0; reloc_info[i].stride; i++) {
--- size_t *rel = reloc_info[i].rel;
--- size_t rel_size = reloc_info[i].size;
--- size_t stride = reloc_info[i].stride;
--- for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) {
--- if (!IS_RELATIVE(rel[1])) continue;
--- size_t *rel_addr = (void *)(base + rel[0]);
--- size_t addend = stride==3 ? rel[2] : *rel_addr;
--- *rel_addr = (size_t)base + addend;
--- }
--+ size_t *rel, rel_size;
--+
--+ rel = (void *)(base+dyn[DT_REL]);
--+ rel_size = dyn[DT_RELSZ];
--+ for (; rel_size; rel+=2, rel_size-=2*sizeof(size_t)) {
--+ if (!IS_RELATIVE(rel[1])) continue;
--+ size_t *rel_addr = (void *)(base + rel[0]);
--+ *rel_addr += (size_t)base;
--+ }
--+
--+ rel = (void *)(base+dyn[DT_RELA]);
--+ rel_size = dyn[DT_RELASZ];
--+ for (; rel_size; rel+=3, rel_size-=3*sizeof(size_t)) {
--+ if (!IS_RELATIVE(rel[1])) continue;
--+ size_t *rel_addr = (void *)(base + rel[0]);
--+ *rel_addr = (size_t)base + rel[2];
-- }
--
-- const char *strings = (void *)(base + dyn[DT_STRTAB]);
--@@ -93,16 +84,7 @@ void _dlstart_c(size_t *sp, size_t *dynv
-- && s[3]=='l' && s[4]=='s' && s[5]=='2' && !s[6])
-- break;
-- }
--- ((stage2_func)(base + syms[i].st_value))(base);
---
--- /* Call dynamic linker stage-3, __dls3 */
--- for (i=0; ;i++) {
--- const char *s = strings + syms[i].st_name;
--- if (s[0]=='_' && s[1]=='_' && s[2]=='d'
--- && s[3]=='l' && s[4]=='s' && s[5]=='3' && !s[6])
--- break;
--- }
--- ((stage3_func)(base + syms[i].st_value))(sp);
--+ ((stage2_func)(base + syms[i].st_value))(base, sp);
-- }
--
-- #endif
----- a/src/ldso/dynlink.c
--+++ b/src/ldso/dynlink.c
--@@ -74,7 +74,6 @@ struct dso {
-- volatile int new_dtv_idx, new_tls_idx;
-- struct td_index *td_index;
-- struct dso *fini_next;
--- int rel_early_relative, rel_update_got;
-- char *shortname;
-- char buf[];
-- };
--@@ -96,6 +95,9 @@ static struct builtin_tls {
-- } builtin_tls[1];
-- #define MIN_TLS_ALIGN offsetof(struct builtin_tls, pt)
--
--+#define ADDEND_LIMIT 4096
--+static size_t *saved_addends, *apply_addends_to;
--+
-- static struct dso ldso;
-- static struct dso *head, *tail, *fini_head;
-- static char *env_path, *sys_path;
--@@ -256,10 +258,19 @@ static void do_relocs(struct dso *dso, s
-- size_t sym_val;
-- size_t tls_val;
-- size_t addend;
--+ int skip_relative = 0, reuse_addends = 0, save_slot = 0;
--+
--+ if (dso == &ldso) {
--+ /* Only ldso's REL table needs addend saving/reuse. */
--+ if (rel == apply_addends_to)
--+ reuse_addends = 1;
--+ skip_relative = 1;
--+ }
--
-- for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) {
--- if (dso->rel_early_relative && IS_RELATIVE(rel[1])) continue;
--+ if (skip_relative && IS_RELATIVE(rel[1])) continue;
-- type = R_TYPE(rel[1]);
--+ if (type == REL_NONE) continue;
-- sym_index = R_SYM(rel[1]);
-- reloc_addr = (void *)(base + rel[0]);
-- if (sym_index) {
--@@ -280,12 +291,20 @@ static void do_relocs(struct dso *dso, s
-- def.dso = dso;
-- }
--
--- int gotplt = (type == REL_GOT || type == REL_PLT);
--- if (dso->rel_update_got && !gotplt) continue;
---
--- addend = stride>2 ? rel[2]
--- : gotplt || type==REL_COPY ? 0
--- : *reloc_addr;
--+ if (stride > 2) {
--+ addend = rel[2];
--+ } else if (type==REL_GOT || type==REL_PLT|| type==REL_COPY) {
--+ addend = 0;
--+ } else if (reuse_addends) {
--+ /* Save original addend in stage 2 where the dso
--+ * chain consists of just ldso; otherwise read back
--+ * saved addend since the inline one was clobbered. */
--+ if (head==&ldso)
--+ saved_addends[save_slot] = *reloc_addr;
--+ addend = saved_addends[save_slot++];
--+ } else {
--+ addend = *reloc_addr;
--+ }
--
-- sym_val = def.sym ? (size_t)def.dso->base+def.sym->st_value : 0;
-- tls_val = def.sym ? def.sym->st_value : 0;
--@@ -879,7 +898,7 @@ static void do_mips_relocs(struct dso *p
-- size_t i, j, rel[2];
-- unsigned char *base = p->base;
-- i=0; search_vec(p->dynv, &i, DT_MIPS_LOCAL_GOTNO);
--- if (p->rel_early_relative) {
--+ if (p==&ldso) {
-- got += i;
-- } else {
-- while (i--) *got++ += (size_t)base;
--@@ -1116,7 +1135,7 @@ static void update_tls_size()
-- * linker itself, but some of the relocations performed may need to be
-- * replaced later due to copy relocations in the main program. */
--
---void __dls2(unsigned char *base)
--+void __dls2(unsigned char *base, size_t *sp)
-- {
-- Ehdr *ehdr = (void *)base;
-- ldso.base = base;
--@@ -1125,15 +1144,35 @@ void __dls2(unsigned char *base)
-- ldso.phnum = ehdr->e_phnum;
-- ldso.phdr = (void *)(base + ehdr->e_phoff);
-- ldso.phentsize = ehdr->e_phentsize;
--- ldso.rel_early_relative = 1;
-- kernel_mapped_dso(&ldso);
-- decode_dyn(&ldso);
--
--+ /* Prepare storage for to save clobbered REL addends so they
--+ * can be reused in stage 3. There should be very few. If
--+ * something goes wrong and there are a huge number, abort
--+ * instead of risking stack overflow. */
--+ size_t dyn[DYN_CNT];
--+ decode_vec(ldso.dynv, dyn, DYN_CNT);
--+ size_t *rel = (void *)(base+dyn[DT_REL]);
--+ size_t rel_size = dyn[DT_RELSZ];
--+ size_t symbolic_rel_cnt = 0;
--+ apply_addends_to = rel;
--+ for (; rel_size; rel+=2, rel_size-=2*sizeof(size_t))
--+ if (!IS_RELATIVE(rel[1])) symbolic_rel_cnt++;
--+ if (symbolic_rel_cnt >= ADDEND_LIMIT) a_crash();
--+ size_t addends[symbolic_rel_cnt+1];
--+ saved_addends = addends;
--+
-- head = &ldso;
-- reloc_all(&ldso);
--
-- ldso.relocated = 0;
--- ldso.rel_update_got = 1;
--+
--+ /* Call dynamic linker stage-3, __dls3, looking it up
--+ * symbolically as a barrier against moving the address
--+ * load across the above relocation processing. */
--+ struct symdef dls3_def = find_sym(&ldso, "__dls3", 0);
--+ ((stage3_func)(ldso.base+dls3_def.sym->st_value))(sp);
-- }
--
-- /* Stage 3 of the dynamic linker is called with the dynamic linker/libc
----- a/src/locale/__lctrans.c
--+++ b/src/locale/__lctrans.c
--@@ -16,5 +16,5 @@ const char *__lctrans(const char *msg, c
--
-- const char *__lctrans_cur(const char *msg)
-- {
--- return __lctrans_impl(msg, CURRENT_LOCALE->cat[LC_MESSAGES-2]);
--+ return __lctrans_impl(msg, CURRENT_LOCALE->cat[LC_MESSAGES]);
-- }
----- a/src/locale/__setlocalecat.c
--+++ /dev/null
--@@ -1,111 +0,0 @@
---#include <locale.h>
---#include <string.h>
---#include "locale_impl.h"
---#include "libc.h"
---#include "atomic.h"
---
---const char *__lctrans_impl(const char *msg, const struct __locale_map *lm)
---{
--- const char *trans = 0;
--- if (lm) trans = __mo_lookup(lm->map, lm->map_size, msg);
--- return trans ? trans : msg;
---}
---
---const unsigned char *__map_file(const char *, size_t *);
---int __munmap(void *, size_t);
---char *__strchrnul(const char *, int);
---
---static struct __locale_map *findlocale(const char *name, size_t n)
---{
--- static void *volatile loc_head;
--- struct __locale_map *p, *new, *old_head;
--- const char *path = 0, *z;
--- char buf[256];
--- size_t l;
--- const void *map;
--- size_t map_size;
---
--- for (p=loc_head; p; p=p->next)
--- if (!strcmp(name, p->name)) return p;
---
--- if (!libc.secure) path = getenv("MUSL_LOCPATH");
--- /* FIXME: add a default path? */
--- if (!path) return 0;
---
--- for (; *path; path=z+!!*z) {
--- z = __strchrnul(path, ':');
--- l = z - path - !!*z;
--- if (l >= sizeof buf - n - 2) continue;
--- memcpy(buf, path, l);
--- buf[l] = '/';
--- memcpy(buf+l+1, name, n);
--- buf[l+1+n] = 0;
--- map = __map_file(buf, &map_size);
--- if (map) {
--- new = malloc(sizeof *new);
--- if (!new) {
--- __munmap((void *)map, map_size);
--- return 0;
--- }
--- new->map = map;
--- new->map_size = map_size;
--- memcpy(new->name, name, n);
--- new->name[n] = 0;
--- do {
--- old_head = loc_head;
--- new->next = old_head;
--- } while (a_cas_p(&loc_head, old_head, new) != old_head);
--- return new;
--- }
--- }
--- return 0;
---}
---
---static const char envvars[][12] = {
--- "LC_CTYPE",
--- "LC_NUMERIC",
--- "LC_TIME",
--- "LC_COLLATE",
--- "LC_MONETARY",
--- "LC_MESSAGES",
---};
---
---int __setlocalecat(locale_t loc, int cat, const char *val)
---{
--- if (!*val) {
--- (val = getenv("LC_ALL")) && *val ||
--- (val = getenv(envvars[cat])) && *val ||
--- (val = getenv("LANG")) && *val ||
--- (val = "C.UTF-8");
--- }
---
--- size_t n;
--- for (n=0; n<LOCALE_NAME_MAX && val[n] && val[n]!='/'; n++);
--- if (val[0]=='.' || val[n]) val = "C.UTF-8";
--- int builtin = (val[0]=='C' && !val[1])
--- || !strcmp(val, "C.UTF-8")
--- || !strcmp(val, "POSIX");
--- struct __locale_map *data, *old;
---
--- switch (cat) {
--- case LC_CTYPE:
--- a_store(&loc->ctype_utf8, !builtin || val[1]=='.');
--- break;
--- case LC_MESSAGES:
--- if (builtin) {
--- loc->messages_name[0] = 0;
--- } else {
--- memcpy(loc->messages_name, val, n);
--- loc->messages_name[n] = 0;
--- }
--- /* fall through */
--- default:
--- data = builtin ? 0 : findlocale(val, n);
--- if (data == loc->cat[cat-2]) break;
--- do old = loc->cat[cat-2];
--- while (a_cas_p(&loc->cat[cat-2], old, data) != old);
--- case LC_NUMERIC:
--- break;
--- }
--- return 0;
---}
----- a/src/locale/dcngettext.c
--+++ b/src/locale/dcngettext.c
--@@ -84,13 +84,15 @@ char *bindtextdomain(const char *domainn
-- }
--
-- static const char catnames[][12] = {
--+ "LC_CTYPE",
--+ "LC_NUMERIC",
-- "LC_TIME",
-- "LC_COLLATE",
-- "LC_MONETARY",
-- "LC_MESSAGES",
-- };
--
---static const char catlens[] = { 7, 10, 11, 11 };
--+static const char catlens[] = { 8, 10, 7, 10, 11, 11 };
--
-- struct msgcat {
-- struct msgcat *next;
--@@ -117,10 +119,12 @@ char *dcngettext(const char *domainname,
-- static struct msgcat *volatile cats;
-- struct msgcat *p;
-- struct __locale_struct *loc = CURRENT_LOCALE;
--- struct __locale_map *lm;
--+ const struct __locale_map *lm;
-- const char *dirname, *locname, *catname;
-- size_t dirlen, loclen, catlen, domlen;
--
--+ if ((unsigned)category >= LC_ALL) goto notrans;
--+
-- if (!domainname) domainname = __gettextdomain();
--
-- domlen = strlen(domainname);
--@@ -129,25 +133,15 @@ char *dcngettext(const char *domainname,
-- dirname = gettextdir(domainname, &dirlen);
-- if (!dirname) goto notrans;
--
--- switch (category) {
--- case LC_MESSAGES:
--- locname = loc->messages_name;
--- if (!*locname) goto notrans;
--- break;
--- case LC_TIME:
--- case LC_MONETARY:
--- case LC_COLLATE:
--- lm = loc->cat[category-2];
--- if (!lm) goto notrans;
--- locname = lm->name;
--- break;
--- default:
--+ lm = loc->cat[category];
--+ if (!lm) {
-- notrans:
-- return (char *) ((n == 1) ? msgid1 : msgid2);
-- }
--+ locname = lm->name;
--
--- catname = catnames[category-2];
--- catlen = catlens[category-2];
--+ catname = catnames[category];
--+ catlen = catlens[category];
-- loclen = strlen(locname);
--
-- size_t namelen = dirlen+1 + loclen+1 + catlen+1 + domlen+3;
----- a/src/locale/duplocale.c
--+++ b/src/locale/duplocale.c
--@@ -5,17 +5,10 @@
--
-- locale_t __duplocale(locale_t old)
-- {
--- locale_t new = calloc(1, sizeof *new + LOCALE_NAME_MAX + 1);
--+ locale_t new = malloc(sizeof *new);
-- if (!new) return 0;
--- new->messages_name = (void *)(new+1);
---
-- if (old == LC_GLOBAL_LOCALE) old = &libc.global_locale;
--- new->ctype_utf8 = old->ctype_utf8;
--- if (old->messages_name)
--- strcpy(new->messages_name, old->messages_name);
---
--- for (size_t i=0; i<sizeof new->cat/sizeof new->cat[0]; i++)
--- new->cat[i] = old->cat[i];
--+ *new = *old;
-- return new;
-- }
--
----- a/src/locale/freelocale.c
--+++ b/src/locale/freelocale.c
--@@ -2,9 +2,11 @@
-- #include "locale_impl.h"
-- #include "libc.h"
--
--+int __loc_is_allocated(locale_t);
--+
-- void freelocale(locale_t l)
-- {
--- free(l);
--+ if (__loc_is_allocated(l)) free(l);
-- }
--
-- weak_alias(freelocale, __freelocale);
----- a/src/locale/iconv.c
--+++ b/src/locale/iconv.c
--@@ -23,19 +23,13 @@
-- #define BIG5 0340
-- #define EUC_KR 0350
--
---/* FIXME: these are not implemented yet
--- * EUC: A1-FE A1-FE
--- * GBK: 81-FE 40-7E,80-FE
--- * Big5: A1-FE 40-7E,A1-FE
--- */
---
-- /* Definitions of charmaps. Each charmap consists of:
-- * 1. Empty-string-terminated list of null-terminated aliases.
-- * 2. Special type code or number of elided entries.
-- * 3. Character table (size determined by field 2). */
--
-- static const unsigned char charmaps[] =
---"utf8\0\0\310"
--+"utf8\0char\0\0\310"
-- "wchart\0\0\306"
-- "ucs2\0ucs2be\0\0\304"
-- "ucs2le\0\0\305"
--@@ -90,6 +84,7 @@ static int fuzzycmp(const unsigned char
-- static size_t find_charmap(const void *name)
-- {
-- const unsigned char *s;
--+ if (!*(char *)name) name=charmaps; /* "utf8" */
-- for (s=charmaps; *s; ) {
-- if (!fuzzycmp(name, s)) {
-- for (; *s; s+=strlen((void *)s)+1);
----- /dev/null
--+++ b/src/locale/locale_map.c
--@@ -0,0 +1,124 @@
--+#include <locale.h>
--+#include <string.h>
--+#include "locale_impl.h"
--+#include "libc.h"
--+#include "atomic.h"
--+
--+const char *__lctrans_impl(const char *msg, const struct __locale_map *lm)
--+{
--+ const char *trans = 0;
--+ if (lm) trans = __mo_lookup(lm->map, lm->map_size, msg);
--+ return trans ? trans : msg;
--+}
--+
--+const unsigned char *__map_file(const char *, size_t *);
--+int __munmap(void *, size_t);
--+char *__strchrnul(const char *, int);
--+
--+static const char envvars[][12] = {
--+ "LC_CTYPE",
--+ "LC_NUMERIC",
--+ "LC_TIME",
--+ "LC_COLLATE",
--+ "LC_MONETARY",
--+ "LC_MESSAGES",
--+};
--+
--+static const uint32_t empty_mo[] = { 0x950412de, 0, -1, -1, -1 };
--+
--+const struct __locale_map __c_dot_utf8 = {
--+ .map = empty_mo,
--+ .map_size = sizeof empty_mo,
--+ .name = "C.UTF-8"
--+};
--+
--+const struct __locale_map *__get_locale(int cat, const char *val)
--+{
--+ static int lock[2];
--+ static void *volatile loc_head;
--+ const struct __locale_map *p;
--+ struct __locale_map *new = 0;
--+ const char *path = 0, *z;
--+ char buf[256];
--+ size_t l, n;
--+
--+ if (!*val) {
--+ (val = getenv("LC_ALL")) && *val ||
--+ (val = getenv(envvars[cat])) && *val ||
--+ (val = getenv("LANG")) && *val ||
--+ (val = "C.UTF-8");
--+ }
--+
--+ /* Limit name length and forbid leading dot or any slashes. */
--+ for (n=0; n<LOCALE_NAME_MAX && val[n] && val[n]!='/'; n++);
--+ if (val[0]=='.' || val[n]) val = "C.UTF-8";
--+ int builtin = (val[0]=='C' && !val[1])
--+ || !strcmp(val, "C.UTF-8")
--+ || !strcmp(val, "POSIX");
--+
--+ if (builtin) {
--+ if (cat == LC_CTYPE && val[1]=='.')
--+ return (void *)&__c_dot_utf8;
--+ return 0;
--+ }
--+
--+ for (p=loc_head; p; p=p->next)
--+ if (!strcmp(val, p->name)) return p;
--+
--+ LOCK(lock);
--+
--+ for (p=loc_head; p; p=p->next)
--+ if (!strcmp(val, p->name)) {
--+ UNLOCK(lock);
--+ return p;
--+ }
--+
--+ if (!libc.secure) path = getenv("MUSL_LOCPATH");
--+ /* FIXME: add a default path? */
--+
--+ if (path) for (; *path; path=z+!!*z) {
--+ z = __strchrnul(path, ':');
--+ l = z - path - !!*z;
--+ if (l >= sizeof buf - n - 2) continue;
--+ memcpy(buf, path, l);
--+ buf[l] = '/';
--+ memcpy(buf+l+1, val, n);
--+ buf[l+1+n] = 0;
--+ size_t map_size;
--+ const void *map = __map_file(buf, &map_size);
--+ if (map) {
--+ new = malloc(sizeof *new);
--+ if (!new) {
--+ __munmap((void *)map, map_size);
--+ break;
--+ }
--+ new->map = map;
--+ new->map_size = map_size;
--+ memcpy(new->name, val, n);
--+ new->name[n] = 0;
--+ new->next = loc_head;
--+ loc_head = new;
--+ break;
--+ }
--+ }
--+
--+ /* If no locale definition was found, make a locale map
--+ * object anyway to store the name, which is kept for the
--+ * sake of being able to do message translations at the
--+ * application level. */
--+ if (!new && (new = malloc(sizeof *new))) {
--+ new->map = empty_mo;
--+ new->map_size = sizeof empty_mo;
--+ memcpy(new->name, val, n);
--+ new->name[n] = 0;
--+ new->next = loc_head;
--+ loc_head = new;
--+ }
--+
--+ /* For LC_CTYPE, never return a null pointer unless the
--+ * requested name was "C" or "POSIX". */
--+ if (!new && cat == LC_CTYPE) new = (void *)&__c_dot_utf8;
--+
--+ UNLOCK(lock);
--+ return new;
--+}
----- a/src/locale/newlocale.c
--+++ b/src/locale/newlocale.c
--@@ -3,22 +3,52 @@
-- #include "locale_impl.h"
-- #include "libc.h"
--
--+extern const struct __locale_map __c_dot_utf8;
--+
--+static const struct __locale_struct c_locale = { 0 };
--+static const struct __locale_struct c_dot_utf8_locale = {
--+ .cat[LC_CTYPE] = &__c_dot_utf8
--+};
--+
--+int __loc_is_allocated(locale_t loc)
--+{
--+ return loc && loc != &c_locale && loc != &c_dot_utf8_locale;
--+}
--+
-- locale_t __newlocale(int mask, const char *name, locale_t loc)
-- {
--- int i;
--+ int i, j;
--+ struct __locale_struct tmp;
--+ const struct __locale_map *lm;
--
--- if (!loc) {
--- loc = calloc(1, sizeof *loc + LOCALE_NAME_MAX + 1);
--- if (!loc) return 0;
--- loc->messages_name = (void *)(loc+1);
--+ /* For locales with allocated storage, modify in-place. */
--+ if (__loc_is_allocated(loc)) {
-- for (i=0; i<LC_ALL; i++)
--- if (!(mask & (1<<i)))
--- __setlocalecat(loc, i, "");
--+ if (mask & (1<<i))
--+ loc->cat[i] = __get_locale(i, name);
--+ return loc;
--+ }
--+
--+ /* Otherwise, build a temporary locale object, which will only
--+ * be instantiated in allocated storage if it does not match
--+ * one of the built-in static locales. This makes the common
--+ * usage case for newlocale, getting a C locale with predictable
--+ * behavior, very fast, and more importantly, fail-safe. */
--+ for (j=i=0; i<LC_ALL; i++) {
--+ if (loc && !(mask & (1<<i)))
--+ lm = loc->cat[i];
--+ else
--+ lm = __get_locale(i, mask & (1<<i) ? name : "");
--+ if (lm) j++;
--+ tmp.cat[i] = lm;
-- }
--
--- for (i=0; i<LC_ALL; i++)
--- if (mask & (1<<i))
--- __setlocalecat(loc, i, name);
--+ if (!j)
--+ return (locale_t)&c_locale;
--+ if (j==1 && tmp.cat[LC_CTYPE]==c_dot_utf8_locale.cat[LC_CTYPE])
--+ return (locale_t)&c_dot_utf8_locale;
--+
--+ if ((loc = malloc(sizeof *loc))) *loc = tmp;
--
-- return loc;
-- }
----- a/src/locale/setlocale.c
--+++ b/src/locale/setlocale.c
--@@ -5,73 +5,66 @@
-- #include "libc.h"
-- #include "atomic.h"
--
---static char buf[2+4*(LOCALE_NAME_MAX+1)];
--+static char buf[LC_ALL*(LOCALE_NAME_MAX+1)];
--
---char *setlocale(int cat, const char *name)
--+static char *setlocale_one_unlocked(int cat, const char *name)
-- {
--- struct __locale_map *lm;
--- int i, j;
--+ const struct __locale_map *lm;
--
--- if (!libc.global_locale.messages_name) {
--- libc.global_locale.messages_name =
--- buf + 2 + 3*(LOCALE_NAME_MAX+1);
--- }
--+ if (name) libc.global_locale.cat[cat] = lm = __get_locale(cat, name);
--+ else lm = libc.global_locale.cat[cat];
--+
--+ return lm ? (char *)lm->name : "C";
--+}
--+
--+char *__strchrnul(const char *, int);
--+
--+char *setlocale(int cat, const char *name)
--+{
--+ static volatile int lock[2];
--
-- if ((unsigned)cat > LC_ALL) return 0;
--
--+ LOCK(lock);
--+
-- /* For LC_ALL, setlocale is required to return a string which
-- * encodes the current setting for all categories. The format of
-- * this string is unspecified, and only the following code, which
-- * performs both the serialization and deserialization, depends
-- * on the format, so it can easily be changed if needed. */
-- if (cat == LC_ALL) {
--+ int i;
-- if (name) {
--- char part[LOCALE_NAME_MAX+1];
--- if (name[0] && name[1]==';'
--- && strlen(name) > 2 + 3*(LOCALE_NAME_MAX+1)) {
--- part[0] = name[0];
--- part[1] = 0;
--- setlocale(LC_CTYPE, part);
--- part[LOCALE_NAME_MAX] = 0;
--- for (i=LC_TIME; i<LC_MESSAGES; i++) {
--- memcpy(part, name + 2 + (i-2)*(LOCALE_NAME_MAX+1), LOCALE_NAME_MAX);
--- for (j=LOCALE_NAME_MAX-1; j && part[j]==';'; j--)
--- part[j] = 0;
--- setlocale(i, part);
--+ char part[LOCALE_NAME_MAX+1] = "C.UTF-8";
--+ const char *p = name;
--+ for (i=0; i<LC_ALL; i++) {
--+ const char *z = __strchrnul(p, ';');
--+ if (z-p <= LOCALE_NAME_MAX) {
--+ memcpy(part, p, z-p);
--+ part[z-p] = 0;
--+ if (*z) p = z+1;
-- }
--- setlocale(LC_MESSAGES, name + 2 + 3*(LOCALE_NAME_MAX+1));
--- } else {
--- for (i=0; i<LC_ALL; i++)
--- setlocale(i, name);
--+ setlocale_one_unlocked(i, part);
-- }
-- }
--- memset(buf, ';', 2 + 3*(LOCALE_NAME_MAX+1));
--- buf[0] = libc.global_locale.ctype_utf8 ? 'U' : 'C';
--- for (i=LC_TIME; i<LC_MESSAGES; i++) {
--- lm = libc.global_locale.cat[i-2];
--- if (lm) memcpy(buf + 2 + (i-2)*(LOCALE_NAME_MAX+1),
--- lm->name, strlen(lm->name));
--+ char *s = buf;
--+ for (i=0; i<LC_ALL; i++) {
--+ const struct __locale_map *lm =
--+ libc.global_locale.cat[i];
--+ const char *part = lm ? lm->name : "C";
--+ size_t l = strlen(part);
--+ memcpy(s, part, l);
--+ s[l] = ';';
--+ s += l+1;
-- }
--+ *--s = 0;
--+ UNLOCK(lock);
-- return buf;
-- }
--
--- if (name) {
--- int adj = libc.global_locale.ctype_utf8;
--- __setlocalecat(&libc.global_locale, cat, name);
--- adj -= libc.global_locale.ctype_utf8;
--- if (adj) a_fetch_add(&libc.bytelocale_cnt_minus_1, adj);
--- }
--+ char *ret = setlocale_one_unlocked(cat, name);
--
--- switch (cat) {
--- case LC_CTYPE:
--- return libc.global_locale.ctype_utf8 ? "C.UTF-8" : "C";
--- case LC_NUMERIC:
--- return "C";
--- case LC_MESSAGES:
--- return libc.global_locale.messages_name[0]
--- ? libc.global_locale.messages_name : "C";
--- default:
--- lm = libc.global_locale.cat[cat-2];
--- return lm ? lm->name : "C";
--- }
--+ UNLOCK(lock);
--+
--+ return ret;
-- }
----- a/src/locale/uselocale.c
--+++ b/src/locale/uselocale.c
--@@ -10,15 +10,7 @@ locale_t __uselocale(locale_t new)
--
-- if (new == LC_GLOBAL_LOCALE) new = global;
--
--- if (new && new != old) {
--- int adj = 0;
--- if (new == global) a_dec(&libc.uselocale_cnt);
--- else if (!new->ctype_utf8) adj++;
--- if (old == global) a_inc(&libc.uselocale_cnt);
--- else if (!old->ctype_utf8) adj--;
--- a_fetch_add(&libc.bytelocale_cnt_minus_1, adj);
--- self->locale = new;
--- }
--+ self->locale = new;
--
-- return old == global ? LC_GLOBAL_LOCALE : old;
-- }
----- a/src/stdio/__stdio_read.c
--+++ b/src/stdio/__stdio_read.c
--@@ -21,7 +21,6 @@ size_t __stdio_read(FILE *f, unsigned ch
-- pthread_cleanup_pop(0);
-- if (cnt <= 0) {
-- f->flags |= F_EOF ^ ((F_ERR^F_EOF) & cnt);
--- f->rpos = f->rend = 0;
-- return cnt;
-- }
-- if (cnt <= iov[0].iov_len) return cnt;
----- a/src/stdio/__toread.c
--+++ b/src/stdio/__toread.c
--@@ -5,12 +5,12 @@ int __toread(FILE *f)
-- f->mode |= f->mode-1;
-- if (f->wpos > f->buf) f->write(f, 0, 0);
-- f->wpos = f->wbase = f->wend = 0;
--- if (f->flags & (F_EOF|F_NORD)) {
--- if (f->flags & F_NORD) f->flags |= F_ERR;
--+ if (f->flags & F_NORD) {
--+ f->flags |= F_ERR;
-- return EOF;
-- }
--- f->rpos = f->rend = f->buf;
--- return 0;
--+ f->rpos = f->rend = f->buf + f->buf_size;
--+ return (f->flags & F_EOF) ? EOF : 0;
-- }
--
-- void __stdio_exit_needed(void);
----- a/src/stdio/__uflow.c
--+++ b/src/stdio/__uflow.c
--@@ -1,11 +1,11 @@
-- #include "stdio_impl.h"
--
---/* This function will never be called if there is already data
--- * buffered for reading. Thus we can get by with very few branches. */
--+/* This function assumes it will never be called if there is already
--+ * data buffered for reading. */
--
-- int __uflow(FILE *f)
-- {
-- unsigned char c;
--- if ((f->rend || !__toread(f)) && f->read(f, &c, 1)==1) return c;
--+ if (!__toread(f) && f->read(f, &c, 1)==1) return c;
-- return EOF;
-- }
----- a/src/stdio/ungetc.c
--+++ b/src/stdio/ungetc.c
--@@ -6,7 +6,8 @@ int ungetc(int c, FILE *f)
--
-- FLOCK(f);
--
--- if ((!f->rend && __toread(f)) || f->rpos <= f->buf - UNGET) {
--+ if (!f->rpos) __toread(f);
--+ if (!f->rpos || f->rpos <= f->buf - UNGET) {
-- FUNLOCK(f);
-- return EOF;
-- }
----- a/src/stdio/ungetwc.c
--+++ b/src/stdio/ungetwc.c
--@@ -19,7 +19,8 @@ wint_t ungetwc(wint_t c, FILE *f)
--
-- f->mode |= f->mode+1;
--
--- if ((!f->rend && __toread(f)) || f->rpos < f->buf - UNGET + l) {
--+ if (!f->rpos) __toread(f);
--+ if (!f->rpos || f->rpos < f->buf - UNGET + l) {
-- FUNLOCK(f);
-- return EOF;
-- }
----- a/src/thread/i386/__set_thread_area.s
--+++ b/src/thread/i386/__set_thread_area.s
--@@ -6,10 +6,10 @@ __set_thread_area:
-- push $0x51
-- push $0xfffff
-- push 16(%esp)
--- xor %edx,%edx
--- mov %gs,%dx
--- sub $3,%edx
--- sar $3,%edx
--+ call 1f
--+1: addl $4f-1b,(%esp)
--+ pop %ecx
--+ mov (%ecx),%edx
-- push %edx
-- mov %esp,%ebx
-- xor %eax,%eax
--@@ -18,6 +18,7 @@ __set_thread_area:
-- testl %eax,%eax
-- jnz 2f
-- movl (%esp),%edx
--+ movl %edx,(%ecx)
-- leal 3(,%edx,8),%edx
-- 3: movw %dx,%gs
-- 1:
--@@ -38,3 +39,7 @@ __set_thread_area:
-- mov $7,%dl
-- inc %al
-- jmp 3b
--+
--+.data
--+ .align 4
--+4: .long -1
----- a/src/thread/mips/syscall_cp.s
--+++ b/src/thread/mips/syscall_cp.s
--@@ -2,10 +2,13 @@
--
-- .global __cp_begin
-- .hidden __cp_begin
--+.type __cp_begin,@function
-- .global __cp_end
-- .hidden __cp_end
--+.type __cp_end,@function
-- .global __cp_cancel
-- .hidden __cp_cancel
--+.type __cp_cancel,@function
-- .hidden __cancel
-- .global __syscall_cp_asm
-- .hidden __syscall_cp_asm
----- a/src/thread/pthread_create.c
--+++ b/src/thread/pthread_create.c
--@@ -67,12 +67,6 @@ _Noreturn void __pthread_exit(void *resu
-- exit(0);
-- }
--
--- if (self->locale != &libc.global_locale) {
--- a_dec(&libc.uselocale_cnt);
--- if (self->locale->ctype_utf8)
--- a_dec(&libc.bytelocale_cnt_minus_1);
--- }
---
-- /* Process robust list in userspace to handle non-pshared mutexes
-- * and the detached thread case where the robust list head will
-- * be invalid when the kernel would process it. */
--- /dev/null
--- /dev/null
++commit 636a4799dd5bf11a1fcd209906c088ed948b821c
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Sun Mar 6 17:11:29 2016 -0500
++
++ make configure check for unsupported (SPE) powerpc hard-float models
++
++ the SPE ABI may be compatible with soft-float, but actually making it
++ work requires some additional work, so for now it's best to make sure
++ broken builds don't happen.
++
++commit 5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb
++Author: Felix Fietkau <nbd@openwrt.org>
++Date: Mon Jan 25 13:20:52 2016 +0100
++
++ add powerpc soft-float support
++
++ Some PowerPC CPUs (e.g. Freescale MPC85xx) have a completely different
++ instruction set for floating point operations (SPE).
++ Executing regular PowerPC floating point instructions results in
++ "Illegal instruction" errors.
++
++ Make it possible to run these devices in soft-float mode.
++
++commit 9543656cc32fda48fc463f332ee20e91eed2b768
++Author: Alexander Monakov <amonakov@ispras.ru>
++Date: Sun Mar 6 20:22:38 2016 +0300
++
++ env: avoid leaving dangling pointers in __env_map
++
++ This is the minimal fix for __putenv leaving a pointer to freed heap
++ storage in __env_map array, which could later on lead to errors such
++ as double-free.
++
++commit 589aefa5b061647e8b9ad9bca3aaa8dc6222460a
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Sun Mar 6 17:48:58 2016 +0000
++
++ update documentation files for mips64 port
++
++commit 83933573aff71a5d178ab71912f177d2d844e63e
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Sun Mar 6 17:41:56 2016 +0000
++
++ add mips64 port
++
++ patch by Mahesh Bodapati and Jaydeep Patil of Imagination
++ Technologies.
++
++commit 71392a91c333d47b6b3c8f99c897e3b5a7eb6d58
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Sun Mar 6 17:25:52 2016 +0000
++
++ generalize mips-specific reloc code not to hard-code sym/type encoding
++
++ this change is made in preparation for adding the mips64 port, which
++ needs a 64-bit (and mips64-specific) form of the R_INFO macro, but
++ it's a better abstraction anyway.
++
++ based on part of the mips64 port patch by Mahesh Bodapati and Jaydeep
++ Patil of Imagination Technologies.
++
++commit b023c03b574acdfd73418314a5dcaa83e5cea5a0
++Author: Szabolcs Nagy <nsz@port70.net>
++Date: Fri Mar 4 21:23:33 2016 +0000
++
++ math: fix expf(-NAN) and exp2f(-NAN) to return -NAN instead of 0
++
++ expf(-NAN) was treated as expf(-large) which unconditionally
++ returns +0, so special case +-NAN.
++ reported by Petr Hosek.
++
++commit db66ef1f7db7c5b672591a97a97bc789c9efe2f3
++Author: Nathan Zadoks <nathan@nathan7.eu>
++Date: Wed Mar 2 17:26:27 2016 +0100
++
++ add sched_getcpu vDSO support
++
++ This brings the call to an actually usable speed.
++ Quick unscientific benchmark: 14ns : 102ns :: vDSO : syscall
++
++commit 98d335735d64ee34a34cb9c08ea2cb51a076d2a1
++Author: Nathan Zadoks <nathan@nathan7.eu>
++Date: Wed Mar 2 17:26:26 2016 +0100
++
++ add sched_getcpu
++
++ This is a GNU extension, but a fairly minor one, for a system call that
++ otherwise has no libc wrapper.
++
++commit 29b13575376509bb21539711f30c1deaf0823033
++Author: Szabolcs Nagy <nsz@port70.net>
++Date: Mon Feb 29 16:36:25 2016 +0000
++
++ fix ^* at the start of a complete BRE
++
++ This is a workaround to treat * as literal * at the start of a BRE.
++
++ Ideally ^ would be treated as an anchor at the start of any BRE
++ subexpression and similarly $ would be an anchor at the end of any
++ subexpression. This is not required by the standard and hard to do
++ with the current code, but it's the existing practice. If it is
++ changed, * should be treated as literal after such anchor as well.
++
++commit 39ea71fb8afddda879a1999f2a203dfdaf57a639
++Author: Szabolcs Nagy <nsz@port70.net>
++Date: Mon Feb 29 15:04:46 2016 +0000
++
++ fix * at the start of a BRE subexpression
++
++ commit 7eaa76fc2e7993582989d3838b1ac32dd8abac09 made * invalid at
++ the start of a BRE subexpression, but it should be accepted as
++ literal * there according to the standard.
++
++ This patch does not fix subexpressions starting with ^*.
++
++commit 6e694d6960d9d50a119e8660c95bf9308e609053
++Author: Michael Meeuwisse <mickeymeeuw@gmail.com>
++Date: Tue Feb 23 23:49:57 2016 +0100
++
++ explicitly include stdio.h to get EOF definition needed by wctob
++
++commit 6d70c08a2c37745df637b231711f6dec79dbc6e1
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Wed Mar 2 00:34:51 2016 -0500
++
++ handle non-matching address family entries in hosts file
++
++ name_from_hosts failed to account for the possibility of an address
++ family error from name_from_numeric, wrongly counting such a return as
++ success and using the uninitialized address data as part of the
++ results passed up to the caller.
++
++ non-matching address family entries cannot simply be ignored or
++ results would be inconsistent with respect to whether AF_UNSPEC or a
++ specific address family is queried. instead, record that a
++ non-matching entry was seen, and fail the lookup with EAI_NONAME of no
++ matching-family entries are found.
++
++commit fd224a800b68843c4d8d1002b07dd91041a7fa32
++Author: Rich Felker <dalias@aerifal.cx>
++Date: Tue Feb 23 13:04:56 2016 -0500
++
++ make aarch64 atomic_arch.h report that it defines pointer-sized ll/sc
++
++ at present this is done only for consistency, since this file defines
++ its own a_cas_p rather than using the new generic one from atomic.h
++ added in commit 225f6a6b5b7173b6655e4f5d49b5b9fea70bf3bb. these
++ definitions may however be useful if we ever need to add other
++ pointer-sized atomic operations.
++
++commit 225f6a6b5b7173b6655e4f5d49b5b9fea70bf3bb
++Author: Bobby Bingham <koorogi@koorogi.info>
++Date: Mon Feb 22 21:14:23 2016 -0600
++
++ allow implementing a_cas_p with pointer-sized ll/sc
++
++ No current ports do this, but it will be useful for porting to 64-bit ll/sc
++ architectures, such as mips64 and powerpc64.
++
++--- a/COPYRIGHT
+++++ b/COPYRIGHT
++@@ -43,6 +43,7 @@ Gianluca Anzolin
++ Hauke Mehrtens
++ Hiltjo Posthuma
++ Isaac Dunham
+++Jaydeep Patil
++ Jens Gustedt
++ Jeremy Huntwork
++ Jo-Philipp Wich
++@@ -55,6 +56,7 @@ Kylie McClain
++ Luca Barbato
++ Luka Perkov
++ M Farkas-Dyck (Strake)
+++Mahesh Bodapati
++ Michael Forney
++ Natanael Copa
++ Nicholas J. Kain
++@@ -123,6 +125,9 @@ Pennington for use in the ellcc project.
++ by Rich Felker for build system and code conventions during upstream
++ integration. It is licensed under the standard MIT terms.
++
+++The mips64 port was contributed by Imagination Technologies and is
+++licensed under the standard MIT terms.
+++
++ The powerpc port was also originally written by Richard Pennington,
++ and later supplemented and integrated by John Spencer. It is licensed
++ under the standard MIT terms.
++--- a/INSTALL
+++++ b/INSTALL
++@@ -62,6 +62,12 @@ and ABI combinations:
++ * MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
++ is required
++
+++* MIPS64
+++ * ABI is n64 (LP64)
+++ * Big-endian default; little-endian variants also supported
+++ * Default ABI variant uses FPU registers; alternate soft-float ABI
+++ that does not use FPU registers or instructions is available
+++
++ * PowerPC
++ * Only 32-bit is supported
++ * Compiler toolchain must provide 64-bit long double, not IBM
++--- a/arch/aarch64/atomic_arch.h
+++++ b/arch/aarch64/atomic_arch.h
++@@ -34,6 +34,7 @@ static inline int a_cas(volatile int *p,
++ return old;
++ }
++
+++#define a_ll_p a_ll_p
++ static inline void *a_ll_p(volatile void *p)
++ {
++ void *v;
++@@ -41,6 +42,7 @@ static inline void *a_ll_p(volatile void
++ return v;
++ }
++
+++#define a_sc_p a_sc_p
++ static inline int a_sc_p(volatile int *p, void *v)
++ {
++ int r;
++--- /dev/null
+++++ b/arch/mips64/atomic_arch.h
++@@ -0,0 +1,50 @@
+++#define a_ll a_ll
+++static inline int a_ll(volatile int *p)
+++{
+++ int v;
+++ __asm__ __volatile__ (
+++ "ll %0, %1"
+++ : "=r"(v) : "m"(*p));
+++ return v;
+++}
+++
+++#define a_sc a_sc
+++static inline int a_sc(volatile int *p, int v)
+++{
+++ int r;
+++ __asm__ __volatile__ (
+++ "sc %0, %1"
+++ : "=r"(r), "=m"(*p) : "0"(v) : "memory");
+++ return r;
+++}
+++
+++#define a_ll_p a_ll_p
+++static inline void *a_ll_p(volatile long *p)
+++{
+++ void *v;
+++ __asm__ __volatile__ (
+++ "lld %0, %1"
+++ : "=r"(v) : "m"(*p));
+++ return v;
+++}
+++
+++#define a_sc_p a_sc_p
+++static inline int a_sc_p(volatile long *p, void *v)
+++{
+++ int r;
+++ __asm__ __volatile__ (
+++ "scd %0, %1"
+++ : "=r"(r), "=m"(*p) : "0"(v) : "memory");
+++ return r;
+++}
+++
+++#define a_barrier a_barrier
+++static inline void a_barrier()
+++{
+++ /* mips2 sync, but using too many directives causes
+++ * gcc not to inline it, so encode with .long instead. */
+++ __asm__ __volatile__ (".long 0xf" : : : "memory");
+++}
+++
+++#define a_pre_llsc a_barrier
+++#define a_post_llsc a_barrier
++--- /dev/null
+++++ b/arch/mips64/bits/alltypes.h.in
++@@ -0,0 +1,28 @@
+++#define _Addr long
+++#define _Int64 long
+++#define _Reg long
+++
+++TYPEDEF __builtin_va_list va_list;
+++TYPEDEF __builtin_va_list __isoc_va_list;
+++
+++#ifndef __cplusplus
+++TYPEDEF int wchar_t;
+++#endif
+++
+++TYPEDEF float float_t;
+++TYPEDEF double double_t;
+++
+++TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
+++
+++TYPEDEF long time_t;
+++TYPEDEF long suseconds_t;
+++
+++TYPEDEF unsigned nlink_t;
+++
+++TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
+++TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
+++TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
+++TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
+++TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
+++TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
+++TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
++--- /dev/null
+++++ b/arch/mips64/bits/endian.h
++@@ -0,0 +1,5 @@
+++#if _MIPSEL || __MIPSEL || __MIPSEL__
+++#define __BYTE_ORDER __LITTLE_ENDIAN
+++#else
+++#define __BYTE_ORDER __BIG_ENDIAN
+++#endif
++--- /dev/null
+++++ b/arch/mips64/bits/errno.h
++@@ -0,0 +1,134 @@
+++#define EPERM 1
+++#define ENOENT 2
+++#define ESRCH 3
+++#define EINTR 4
+++#define EIO 5
+++#define ENXIO 6
+++#define E2BIG 7
+++#define ENOEXEC 8
+++#define EBADF 9
+++#define ECHILD 10
+++#define EAGAIN 11
+++#define ENOMEM 12
+++#define EACCES 13
+++#define EFAULT 14
+++#define ENOTBLK 15
+++#define EBUSY 16
+++#define EEXIST 17
+++#define EXDEV 18
+++#define ENODEV 19
+++#define ENOTDIR 20
+++#define EISDIR 21
+++#define EINVAL 22
+++#define ENFILE 23
+++#define EMFILE 24
+++#define ENOTTY 25
+++#define ETXTBSY 26
+++#define EFBIG 27
+++#define ENOSPC 28
+++#define ESPIPE 29
+++#define EROFS 30
+++#define EMLINK 31
+++#define EPIPE 32
+++#define EDOM 33
+++#define ERANGE 34
+++#define ENOMSG 35
+++#define EIDRM 36
+++#define ECHRNG 37
+++#define EL2NSYNC 38
+++#define EL3HLT 39
+++#define EL3RST 40
+++#define ELNRNG 41
+++#define EUNATCH 42
+++#define ENOCSI 43
+++#define EL2HLT 44
+++#define EDEADLK 45
+++#define ENOLCK 46
+++#define EBADE 50
+++#define EBADR 51
+++#define EXFULL 52
+++#define ENOANO 53
+++#define EBADRQC 54
+++#define EBADSLT 55
+++#define EDEADLOCK 56
+++#define EBFONT 59
+++#define ENOSTR 60
+++#define ENODATA 61
+++#define ETIME 62
+++#define ENOSR 63
+++#define ENONET 64
+++#define ENOPKG 65
+++#define EREMOTE 66
+++#define ENOLINK 67
+++#define EADV 68
+++#define ESRMNT 69
+++#define ECOMM 70
+++#define EPROTO 71
+++#define EDOTDOT 73
+++#define EMULTIHOP 74
+++#define EBADMSG 77
+++#define ENAMETOOLONG 78
+++#define EOVERFLOW 79
+++#define ENOTUNIQ 80
+++#define EBADFD 81
+++#define EREMCHG 82
+++#define ELIBACC 83
+++#define ELIBBAD 84
+++#define ELIBSCN 85
+++#define ELIBMAX 86
+++#define ELIBEXEC 87
+++#define EILSEQ 88
+++#define ENOSYS 89
+++#define ELOOP 90
+++#define ERESTART 91
+++#define ESTRPIPE 92
+++#define ENOTEMPTY 93
+++#define EUSERS 94
+++#define ENOTSOCK 95
+++#define EDESTADDRREQ 96
+++#define EMSGSIZE 97
+++#define EPROTOTYPE 98
+++#define ENOPROTOOPT 99
+++#define EPROTONOSUPPORT 120
+++#define ESOCKTNOSUPPORT 121
+++#define EOPNOTSUPP 122
+++#define ENOTSUP EOPNOTSUPP
+++#define EPFNOSUPPORT 123
+++#define EAFNOSUPPORT 124
+++#define EADDRINUSE 125
+++#define EADDRNOTAVAIL 126
+++#define ENETDOWN 127
+++#define ENETUNREACH 128
+++#define ENETRESET 129
+++#define ECONNABORTED 130
+++#define ECONNRESET 131
+++#define ENOBUFS 132
+++#define EISCONN 133
+++#define ENOTCONN 134
+++#define EUCLEAN 135
+++#define ENOTNAM 137
+++#define ENAVAIL 138
+++#define EISNAM 139
+++#define EREMOTEIO 140
+++#define ESHUTDOWN 143
+++#define ETOOMANYREFS 144
+++#define ETIMEDOUT 145
+++#define ECONNREFUSED 146
+++#define EHOSTDOWN 147
+++#define EHOSTUNREACH 148
+++#define EWOULDBLOCK EAGAIN
+++#define EALREADY 149
+++#define EINPROGRESS 150
+++#define ESTALE 151
+++#define ECANCELED 158
+++#define ENOMEDIUM 159
+++#define EMEDIUMTYPE 160
+++#define ENOKEY 161
+++#define EKEYEXPIRED 162
+++#define EKEYREVOKED 163
+++#define EKEYREJECTED 164
+++#define EOWNERDEAD 165
+++#define ENOTRECOVERABLE 166
+++#define ERFKILL 167
+++#define EHWPOISON 168
+++#define EDQUOT 1133
++--- /dev/null
+++++ b/arch/mips64/bits/fcntl.h
++@@ -0,0 +1,40 @@
+++#define O_CREAT 0400
+++#define O_EXCL 02000
+++#define O_NOCTTY 04000
+++#define O_TRUNC 01000
+++#define O_APPEND 0010
+++#define O_NONBLOCK 0200
+++#define O_DSYNC 0020
+++#define O_SYNC 040020
+++#define O_RSYNC 040020
+++#define O_DIRECTORY 0200000
+++#define O_NOFOLLOW 0400000
+++#define O_CLOEXEC 02000000
+++
+++#define O_ASYNC 010000
+++#define O_DIRECT 0100000
+++#define O_LARGEFILE 0
+++#define O_NOATIME 01000000
+++#define O_PATH 010000000
+++#define O_TMPFILE 020200000
+++#define O_NDELAY O_NONBLOCK
+++
+++#define F_DUPFD 0
+++#define F_GETFD 1
+++#define F_SETFD 2
+++#define F_GETFL 3
+++#define F_SETFL 4
+++
+++#define F_SETOWN 24
+++#define F_GETOWN 23
+++#define F_SETSIG 10
+++#define F_GETSIG 11
+++
+++#define F_GETLK 14
+++#define F_SETLK 6
+++#define F_SETLKW 7
+++
+++#define F_SETOWN_EX 15
+++#define F_GETOWN_EX 16
+++
+++#define F_GETOWNER_UIDS 17
++--- /dev/null
+++++ b/arch/mips64/bits/fenv.h
++@@ -0,0 +1,25 @@
+++#ifdef __mips_soft_float
+++#define FE_ALL_EXCEPT 0
+++#define FE_TONEAREST 0
+++#else
+++#define FE_INEXACT 4
+++#define FE_UNDERFLOW 8
+++#define FE_OVERFLOW 16
+++#define FE_DIVBYZERO 32
+++#define FE_INVALID 64
+++
+++#define FE_ALL_EXCEPT 124
+++
+++#define FE_TONEAREST 0
+++#define FE_TOWARDZERO 1
+++#define FE_UPWARD 2
+++#define FE_DOWNWARD 3
+++#endif
+++
+++typedef unsigned short fexcept_t;
+++
+++typedef struct {
+++ unsigned __cw;
+++} fenv_t;
+++
+++#define FE_DFL_ENV ((const fenv_t *) -1)
++--- /dev/null
+++++ b/arch/mips64/bits/float.h
++@@ -0,0 +1,16 @@
+++#define FLT_EVAL_METHOD 0
+++
+++#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+++#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+++#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+++#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+++
+++#define LDBL_MANT_DIG 113
+++#define LDBL_MIN_EXP (-16381)
+++#define LDBL_MAX_EXP 16384
+++
+++#define LDBL_DIG 33
+++#define LDBL_MIN_10_EXP (-4931)
+++#define LDBL_MAX_10_EXP 4932
+++
+++#define DECIMAL_DIG 36
++--- /dev/null
+++++ b/arch/mips64/bits/ioctl.h
++@@ -0,0 +1,210 @@
+++#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+++#define _IOC_NONE 1U
+++#define _IOC_READ 2U
+++#define _IOC_WRITE 4U
+++
+++#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+++#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+++#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+++#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+++
+++#define TCGETA 0x5401
+++#define TCSETA 0x5402
+++#define TCSETAW 0x5403
+++#define TCSETAF 0x5404
+++#define TCSBRK 0x5405
+++#define TCXONC 0x5406
+++#define TCFLSH 0x5407
+++#define TCGETS 0x540D
+++#define TCSETS 0x540E
+++#define TCSETSW 0x540F
+++#define TCSETSF 0x5410
+++
+++#define TIOCEXCL 0x740D
+++#define TIOCNXCL 0x740E
+++#define TIOCOUTQ 0x7472
+++#define TIOCSTI 0x5472
+++#define TIOCMGET 0x741D
+++#define TIOCMBIS 0x741B
+++#define TIOCMBIC 0x741C
+++#define TIOCMSET 0x741D
+++
+++#define TIOCPKT 0x5470
+++#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+++#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+++#define TIOCNOTTY 0x5471
+++#define TIOCSETD 0x7401
+++#define TIOCGETD 0x7400
+++
+++#define FIOCLEX 0x6601
+++#define FIONCLEX 0x6602
+++#define FIOASYNC 0x667D
+++#define FIONBIO 0x667E
+++#define FIOQSIZE 0x667F
+++
+++#define TIOCGLTC 0x7474
+++#define TIOCSLTC 0x7475
+++#define TIOCSPGRP _IOW('t', 118, int)
+++#define TIOCGPGRP _IOR('t', 119, int)
+++#define TIOCCONS _IOW('t', 120, int)
+++
+++#define FIONREAD 0x467F
+++#define TIOCINQ FIONREAD
+++
+++#define TIOCGETP 0x7408
+++#define TIOCSETP 0x7409
+++#define TIOCSETN 0x740A
+++
+++#define TIOCSBRK 0x5427
+++#define TIOCCBRK 0x5428
+++#define TIOCGSID 0x7416
+++#define TIOCGPTN _IOR('T', 0x30, unsigned int)
+++#define TIOCSPTLCK _IOW('T', 0x31, int)
+++
+++#define TIOCSCTTY 0x5480
+++#define TIOCGSOFTCAR 0x5481
+++#define TIOCSSOFTCAR 0x5482
+++#define TIOCLINUX 0x5483
+++#define TIOCGSERIAL 0x5484
+++#define TIOCSSERIAL 0x5485
+++#define TCSBRKP 0x5486
+++
+++#define TIOCSERCONFIG 0x5488
+++#define TIOCSERGWILD 0x5489
+++#define TIOCSERSWILD 0x548A
+++#define TIOCGLCKTRMIOS 0x548B
+++#define TIOCSLCKTRMIOS 0x548C
+++#define TIOCSERGSTRUCT 0x548D
+++#define TIOCSERGETLSR 0x548E
+++#define TIOCSERGETMULTI 0x548F
+++#define TIOCSERSETMULTI 0x5490
+++#define TIOCMIWAIT 0x5491
+++#define TIOCGICOUNT 0x5492
+++#define TIOCGHAYESESP 0x5493
+++#define TIOCSHAYESESP 0x5494
+++
+++#define TIOCTTYGSTRUCT 0x5426
+++#define TCGETX 0x5432
+++#define TCSETX 0x5433
+++#define TCSETXF 0x5434
+++#define TCSETXW 0x5435
+++
+++#define TIOCPKT_DATA 0
+++#define TIOCPKT_FLUSHREAD 1
+++#define TIOCPKT_FLUSHWRITE 2
+++#define TIOCPKT_STOP 4
+++#define TIOCPKT_START 8
+++#define TIOCPKT_NOSTOP 16
+++#define TIOCPKT_DOSTOP 32
+++#define TIOCPKT_IOCTL 64
+++
+++#define TIOCSER_TEMT 0x01
+++
+++struct winsize {
+++ unsigned short ws_row;
+++ unsigned short ws_col;
+++ unsigned short ws_xpixel;
+++ unsigned short ws_ypixel;
+++};
+++
+++#define TIOCM_LE 0x001
+++#define TIOCM_DTR 0x002
+++#define TIOCM_RTS 0x004
+++#define TIOCM_ST 0x008
+++#define TIOCM_SR 0x010
+++#define TIOCM_CTS 0x020
+++#define TIOCM_CAR 0x040
+++#define TIOCM_RNG 0x080
+++#define TIOCM_DSR 0x100
+++#define TIOCM_CD TIOCM_CAR
+++#define TIOCM_RI TIOCM_RNG
+++#define TIOCM_OUT1 0x2000
+++#define TIOCM_OUT2 0x4000
+++#define TIOCM_LOOP 0x8000
+++#define TIOCM_MODEM_BITS TIOCM_OUT2
+++
+++#define N_TTY 0
+++#define N_SLIP 1
+++#define N_MOUSE 2
+++#define N_PPP 3
+++#define N_STRIP 4
+++#define N_AX25 5
+++#define N_X25 6
+++#define N_6PACK 7
+++#define N_MASC 8
+++#define N_R3964 9
+++#define N_PROFIBUS_FDL 10
+++#define N_IRDA 11
+++#define N_SMSBLOCK 12
+++#define N_HDLC 13
+++#define N_SYNC_PPP 14
+++#define N_HCI 15
+++
+++#define FIOSETOWN 0x8901
+++#define SIOCSPGRP 0x8902
+++#define FIOGETOWN 0x8903
+++#define SIOCGPGRP 0x8904
+++#define SIOCATMARK 0x8905
+++#define SIOCGSTAMP 0x8906
+++
+++#define SIOCADDRT 0x890B
+++#define SIOCDELRT 0x890C
+++#define SIOCRTMSG 0x890D
+++
+++#define SIOCGIFNAME 0x8910
+++#define SIOCSIFLINK 0x8911
+++#define SIOCGIFCONF 0x8912
+++#define SIOCGIFFLAGS 0x8913
+++#define SIOCSIFFLAGS 0x8914
+++#define SIOCGIFADDR 0x8915
+++#define SIOCSIFADDR 0x8916
+++#define SIOCGIFDSTADDR 0x8917
+++#define SIOCSIFDSTADDR 0x8918
+++#define SIOCGIFBRDADDR 0x8919
+++#define SIOCSIFBRDADDR 0x891a
+++#define SIOCGIFNETMASK 0x891b
+++#define SIOCSIFNETMASK 0x891c
+++#define SIOCGIFMETRIC 0x891d
+++#define SIOCSIFMETRIC 0x891e
+++#define SIOCGIFMEM 0x891f
+++#define SIOCSIFMEM 0x8920
+++#define SIOCGIFMTU 0x8921
+++#define SIOCSIFMTU 0x8922
+++#define SIOCSIFHWADDR 0x8924
+++#define SIOCGIFENCAP 0x8925
+++#define SIOCSIFENCAP 0x8926
+++#define SIOCGIFHWADDR 0x8927
+++#define SIOCGIFSLAVE 0x8929
+++#define SIOCSIFSLAVE 0x8930
+++#define SIOCADDMULTI 0x8931
+++#define SIOCDELMULTI 0x8932
+++#define SIOCGIFINDEX 0x8933
+++#define SIOGIFINDEX SIOCGIFINDEX
+++#define SIOCSIFPFLAGS 0x8934
+++#define SIOCGIFPFLAGS 0x8935
+++#define SIOCDIFADDR 0x8936
+++#define SIOCSIFHWBROADCAST 0x8937
+++#define SIOCGIFCOUNT 0x8938
+++
+++#define SIOCGIFBR 0x8940
+++#define SIOCSIFBR 0x8941
+++
+++#define SIOCGIFTXQLEN 0x8942
+++#define SIOCSIFTXQLEN 0x8943
+++
+++#define SIOCDARP 0x8953
+++#define SIOCGARP 0x8954
+++#define SIOCSARP 0x8955
+++
+++#define SIOCDRARP 0x8960
+++#define SIOCGRARP 0x8961
+++#define SIOCSRARP 0x8962
+++
+++#define SIOCGIFMAP 0x8970
+++#define SIOCSIFMAP 0x8971
+++
+++#define SIOCADDDLCI 0x8980
+++#define SIOCDELDLCI 0x8981
+++
+++#define SIOCDEVPRIVATE 0x89F0
+++#define SIOCPROTOPRIVATE 0x89E0
++--- /dev/null
+++++ b/arch/mips64/bits/ipc.h
++@@ -0,0 +1,14 @@
+++struct ipc_perm {
+++ key_t __ipc_perm_key;
+++ uid_t uid;
+++ gid_t gid;
+++ uid_t cuid;
+++ gid_t cgid;
+++ mode_t mode;
+++ int __ipc_perm_seq;
+++ int __pad1;
+++ unsigned long __unused1;
+++ unsigned long __unused2;
+++};
+++
+++#define IPC_64 0x100
++--- /dev/null
+++++ b/arch/mips64/bits/limits.h
++@@ -0,0 +1,7 @@
+++#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+++ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++#define LONG_BIT 64
+++#endif
+++
+++#define LONG_MAX 0x7fffffffffffffffL
+++#define LLONG_MAX 0x7fffffffffffffffLL
++--- /dev/null
+++++ b/arch/mips64/bits/mman.h
++@@ -0,0 +1,58 @@
+++#define MAP_FAILED ((void *) -1)
+++
+++#define PROT_NONE 0
+++#define PROT_READ 1
+++#define PROT_WRITE 2
+++#define PROT_EXEC 4
+++#define PROT_GROWSDOWN 0x01000000
+++#define PROT_GROWSUP 0x02000000
+++
+++#define MAP_SHARED 0x01
+++#define MAP_PRIVATE 0x02
+++#define MAP_FIXED 0x10
+++
+++#define MAP_TYPE 0x0f
+++#define MAP_FILE 0x00
+++#define MAP_ANON 0x800
+++#define MAP_ANONYMOUS MAP_ANON
+++#define MAP_NORESERVE 0x0400
+++#define MAP_GROWSDOWN 0x1000
+++#define MAP_DENYWRITE 0x2000
+++#define MAP_EXECUTABLE 0x4000
+++#define MAP_LOCKED 0x8000
+++#define MAP_POPULATE 0x10000
+++#define MAP_NONBLOCK 0x20000
+++#define MAP_STACK 0x40000
+++#define MAP_HUGETLB 0x80000
+++
+++#define POSIX_MADV_NORMAL 0
+++#define POSIX_MADV_RANDOM 1
+++#define POSIX_MADV_SEQUENTIAL 2
+++#define POSIX_MADV_WILLNEED 3
+++#define POSIX_MADV_DONTNEED 0
+++
+++#define MS_ASYNC 1
+++#define MS_INVALIDATE 2
+++#define MS_SYNC 4
+++
+++#define MCL_CURRENT 1
+++#define MCL_FUTURE 2
+++#define MCL_ONFAULT 4
+++
+++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++#define MADV_NORMAL 0
+++#define MADV_RANDOM 1
+++#define MADV_SEQUENTIAL 2
+++#define MADV_WILLNEED 3
+++#define MADV_DONTNEED 4
+++#define MADV_REMOVE 9
+++#define MADV_DONTFORK 10
+++#define MADV_DOFORK 11
+++#define MADV_MERGEABLE 12
+++#define MADV_UNMERGEABLE 13
+++#define MADV_HUGEPAGE 14
+++#define MADV_NOHUGEPAGE 15
+++#define MADV_DONTDUMP 16
+++#define MADV_DODUMP 17
+++#define MADV_HWPOISON 100
+++#endif
++--- /dev/null
+++++ b/arch/mips64/bits/msg.h
++@@ -0,0 +1,13 @@
+++struct msqid_ds {
+++ struct ipc_perm msg_perm;
+++ time_t msg_stime;
+++ time_t msg_rtime;
+++ time_t msg_ctime;
+++ unsigned long msg_cbytes;
+++ msgqnum_t msg_qnum;
+++ msglen_t msg_qbytes;
+++ pid_t msg_lspid;
+++ pid_t msg_lrpid;
+++ unsigned long __pad1;
+++ unsigned long __pad2;
+++};
++--- /dev/null
+++++ b/arch/mips64/bits/poll.h
++@@ -0,0 +1,2 @@
+++#define POLLWRNORM POLLOUT
+++#define POLLWRBAND 0x100
++--- /dev/null
+++++ b/arch/mips64/bits/posix.h
++@@ -0,0 +1,2 @@
+++#define _POSIX_V6_LP64_OFFBIG 1
+++#define _POSIX_V7_LP64_OFFBIG 1
++--- /dev/null
+++++ b/arch/mips64/bits/reg.h
++@@ -0,0 +1,47 @@
+++#undef __WORDSIZE
+++#define __WORDSIZE 64
+++
+++#define EF_R0 0
+++#define EF_R1 1
+++#define EF_R2 2
+++#define EF_R3 3
+++#define EF_R4 4
+++#define EF_R5 5
+++#define EF_R6 6
+++#define EF_R7 7
+++#define EF_R8 8
+++#define EF_R9 9
+++#define EF_R10 10
+++#define EF_R11 11
+++#define EF_R12 12
+++#define EF_R13 13
+++#define EF_R14 14
+++#define EF_R15 15
+++#define EF_R16 16
+++#define EF_R17 17
+++#define EF_R18 18
+++#define EF_R19 19
+++#define EF_R20 20
+++#define EF_R21 21
+++#define EF_R22 22
+++#define EF_R23 23
+++#define EF_R24 24
+++#define EF_R25 25
+++
+++#define EF_R26 26
+++#define EF_R27 27
+++#define EF_R28 28
+++#define EF_R29 29
+++#define EF_R30 30
+++#define EF_R31 31
+++
+++#define EF_LO 32
+++#define EF_HI 33
+++
+++#define EF_CP0_EPC 34
+++#define EF_CP0_BADVADDR 35
+++#define EF_CP0_STATUS 36
+++#define EF_CP0_CAUSE 37
+++#define EF_UNUSED0 38
+++
+++#define EF_SIZE 304
++--- /dev/null
+++++ b/arch/mips64/bits/resource.h
++@@ -0,0 +1,5 @@
+++#define RLIMIT_NOFILE 5
+++#define RLIMIT_AS 6
+++#define RLIMIT_RSS 7
+++#define RLIMIT_NPROC 8
+++#define RLIMIT_MEMLOCK 9
++--- /dev/null
+++++ b/arch/mips64/bits/sem.h
++@@ -0,0 +1,14 @@
+++struct semid_ds {
+++ struct ipc_perm sem_perm;
+++ time_t sem_otime;
+++ time_t sem_ctime;
+++#if __BYTE_ORDER == __LITTLE_ENDIAN
+++ unsigned short sem_nsems;
+++ char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+++#else
+++ char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+++ unsigned short sem_nsems;
+++#endif
+++ time_t __unused3;
+++ time_t __unused4;
+++};
++--- /dev/null
+++++ b/arch/mips64/bits/setjmp.h
++@@ -0,0 +1 @@
+++typedef unsigned long long __jmp_buf[23];
++--- /dev/null
+++++ b/arch/mips64/bits/shm.h
++@@ -0,0 +1,24 @@
+++#define SHMLBA 4096
+++
+++struct shmid_ds {
+++ struct ipc_perm shm_perm;
+++ size_t shm_segsz;
+++ time_t shm_atime;
+++ time_t shm_dtime;
+++ time_t shm_ctime;
+++ pid_t shm_cpid;
+++ pid_t shm_lpid;
+++ unsigned long shm_nattch;
+++ unsigned long __pad1;
+++ unsigned long __pad2;
+++};
+++
+++struct shminfo {
+++ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+++};
+++
+++struct shm_info {
+++ int __used_ids;
+++ unsigned long shm_tot, shm_rss, shm_swp;
+++ unsigned long __swap_attempts, __swap_successes;
+++};
++--- /dev/null
+++++ b/arch/mips64/bits/signal.h
++@@ -0,0 +1,143 @@
+++#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+++ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++
+++#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++#define MINSIGSTKSZ 2048
+++#define SIGSTKSZ 8192
+++#endif
+++
+++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++typedef unsigned long long greg_t, gregset_t[32];
+++
+++typedef struct {
+++ union {
+++ double fp_dregs[32];
+++ struct {
+++ float _fp_fregs;
+++ unsigned _fp_pad;
+++ } fp_fregs[32];
+++ } fp_r;
+++} fpregset_t;
+++
+++struct sigcontext {
+++ unsigned long long sc_regs[32];
+++ unsigned long long sc_fpregs[32];
+++ unsigned long long sc_mdhi;
+++ unsigned long long sc_hi1;
+++ unsigned long long sc_hi2;
+++ unsigned long long sc_hi3;
+++ unsigned long long sc_mdlo;
+++ unsigned long long sc_lo1;
+++ unsigned long long sc_lo2;
+++ unsigned long long sc_lo3;
+++ unsigned long long sc_pc;
+++ unsigned int sc_fpc_csr;
+++ unsigned int sc_used_math;
+++ unsigned int sc_dsp;
+++ unsigned int sc_reserved;
+++};
+++
+++typedef struct {
+++ gregset_t gregs;
+++ fpregset_t fpregs;
+++ greg_t mdhi;
+++ greg_t hi1;
+++ greg_t hi2;
+++ greg_t hi3;
+++ greg_t mdlo;
+++ greg_t lo1;
+++ greg_t lo2;
+++ greg_t lo3;
+++ greg_t pc;
+++ unsigned int fpc_csr;
+++ unsigned int used_math;
+++ unsigned int dsp;
+++ unsigned int reserved;
+++} mcontext_t;
+++
+++#else
+++typedef struct {
+++ unsigned long long __mc1[32];
+++ double __mc2[32];
+++ unsigned long long __mc3[9];
+++ unsigned __mc4[4];
+++} mcontext_t;
+++#endif
+++
+++struct sigaltstack {
+++ void *ss_sp;
+++ size_t ss_size;
+++ int ss_flags;
+++};
+++
+++typedef struct __ucontext {
+++ unsigned long uc_flags;
+++ struct __ucontext *uc_link;
+++ stack_t uc_stack;
+++ mcontext_t uc_mcontext;
+++ sigset_t uc_sigmask;
+++} ucontext_t;
+++
+++#define SA_NOCLDSTOP 1
+++#define SA_NOCLDWAIT 0x10000
+++#define SA_SIGINFO 8
+++#define SA_ONSTACK 0x08000000
+++#define SA_RESTART 0x10000000
+++#define SA_NODEFER 0x40000000
+++#define SA_RESETHAND 0x80000000
+++#define SA_RESTORER 0x04000000
+++
+++#undef SIG_BLOCK
+++#undef SIG_UNBLOCK
+++#undef SIG_SETMASK
+++#define SIG_BLOCK 1
+++#define SIG_UNBLOCK 2
+++#define SIG_SETMASK 3
+++
+++#undef SI_ASYNCIO
+++#undef SI_MESGQ
+++#undef SI_TIMER
+++#define SI_ASYNCIO (-2)
+++#define SI_MESGQ (-4)
+++#define SI_TIMER (-3)
+++
+++#define __SI_SWAP_ERRNO_CODE
+++
+++#endif
+++
+++#define SIGHUP 1
+++#define SIGINT 2
+++#define SIGQUIT 3
+++#define SIGILL 4
+++#define SIGTRAP 5
+++#define SIGABRT 6
+++#define SIGIOT SIGABRT
+++#define SIGSTKFLT 7
+++#define SIGFPE 8
+++#define SIGKILL 9
+++#define SIGBUS 10
+++#define SIGSEGV 11
+++#define SIGSYS 12
+++#define SIGPIPE 13
+++#define SIGALRM 14
+++#define SIGTERM 15
+++#define SIGUSR1 16
+++#define SIGUSR2 17
+++#define SIGCHLD 18
+++#define SIGPWR 19
+++#define SIGWINCH 20
+++#define SIGURG 21
+++#define SIGIO 22
+++#define SIGPOLL SIGIO
+++#define SIGSTOP 23
+++#define SIGTSTP 24
+++#define SIGCONT 25
+++#define SIGTTIN 26
+++#define SIGTTOU 27
+++#define SIGVTALRM 28
+++#define SIGPROF 29
+++#define SIGXCPU 30
+++#define SIGXFSZ 31
+++#define SIGUNUSED SIGSYS
+++
+++#define _NSIG 128
++--- /dev/null
+++++ b/arch/mips64/bits/socket.h
++@@ -0,0 +1,68 @@
+++#include <endian.h>
+++
+++struct msghdr {
+++ void *msg_name;
+++ socklen_t msg_namelen;
+++ struct iovec *msg_iov;
+++#if __BYTE_ORDER == __BIG_ENDIAN
+++ int __pad1, msg_iovlen;
+++#else
+++ int msg_iovlen, __pad1;
+++#endif
+++ void *msg_control;
+++#if __BYTE_ORDER == __BIG_ENDIAN
+++ int __pad2;
+++ socklen_t msg_controllen;
+++#else
+++ socklen_t msg_controllen;
+++ int __pad2;
+++#endif
+++ int msg_flags;
+++};
+++
+++struct cmsghdr {
+++#if __BYTE_ORDER == __BIG_ENDIAN
+++ int __pad1;
+++ socklen_t cmsg_len;
+++#else
+++ socklen_t cmsg_len;
+++ int __pad1;
+++#endif
+++ int cmsg_level;
+++ int cmsg_type;
+++};
+++
+++#define SOCK_STREAM 2
+++#define SOCK_DGRAM 1
+++#define SOL_SOCKET 65535
+++#define SO_DEBUG 1
+++
+++#define SO_REUSEADDR 0x0004
+++#define SO_KEEPALIVE 0x0008
+++#define SO_DONTROUTE 0x0010
+++#define SO_BROADCAST 0x0020
+++#define SO_LINGER 0x0080
+++#define SO_OOBINLINE 0x0100
+++#define SO_REUSEPORT 0x0200
+++#define SO_SNDBUF 0x1001
+++#define SO_RCVBUF 0x1002
+++#define SO_SNDLOWAT 0x1003
+++#define SO_RCVLOWAT 0x1004
+++#define SO_RCVTIMEO 0x1006
+++#define SO_SNDTIMEO 0x1005
+++#define SO_ERROR 0x1007
+++#define SO_TYPE 0x1008
+++#define SO_ACCEPTCONN 0x1009
+++#define SO_PROTOCOL 0x1028
+++#define SO_DOMAIN 0x1029
+++
+++#define SO_NO_CHECK 11
+++#define SO_PRIORITY 12
+++#define SO_BSDCOMPAT 14
+++#define SO_PASSCRED 17
+++#define SO_PEERCRED 18
+++#define SO_SNDBUFFORCE 31
+++#define SO_RCVBUFFORCE 33
+++
+++#define SOCK_NONBLOCK 0200
+++#define SOCK_CLOEXEC 02000000
++--- /dev/null
+++++ b/arch/mips64/bits/stat.h
++@@ -0,0 +1,23 @@
+++#include <string.h>
+++#include <bits/alltypes.h>
+++
+++struct stat {
+++ dev_t st_dev;
+++ int __pad1[3];
+++ ino_t st_ino;
+++ mode_t st_mode;
+++ nlink_t st_nlink;
+++ uid_t st_uid;
+++ gid_t st_gid;
+++ dev_t st_rdev;
+++ unsigned int __pad2[2];
+++ off_t st_size;
+++ int __pad3;
+++ struct timespec st_atim;
+++ struct timespec st_mtim;
+++ struct timespec st_ctim;
+++ blksize_t st_blksize;
+++ unsigned int __pad4;
+++ blkcnt_t st_blocks;
+++ int __pad5[14];
+++};
++--- /dev/null
+++++ b/arch/mips64/bits/statfs.h
++@@ -0,0 +1,8 @@
+++struct statfs {
+++ unsigned long f_type, f_bsize, f_frsize;
+++ fsblkcnt_t f_blocks, f_bfree;
+++ fsfilcnt_t f_files, f_ffree;
+++ fsblkcnt_t f_bavail;
+++ fsid_t f_fsid;
+++ unsigned long f_namelen, f_flags, f_spare[5];
+++};
++--- /dev/null
+++++ b/arch/mips64/bits/stdint.h
++@@ -0,0 +1,20 @@
+++typedef int32_t int_fast16_t;
+++typedef int32_t int_fast32_t;
+++typedef uint32_t uint_fast16_t;
+++typedef uint32_t uint_fast32_t;
+++
+++#define INT_FAST16_MIN INT32_MIN
+++#define INT_FAST32_MIN INT32_MIN
+++
+++#define INT_FAST16_MAX INT32_MAX
+++#define INT_FAST32_MAX INT32_MAX
+++
+++#define UINT_FAST16_MAX UINT32_MAX
+++#define UINT_FAST32_MAX UINT32_MAX
+++
+++#define INTPTR_MIN INT64_MIN
+++#define INTPTR_MAX INT64_MAX
+++#define UINTPTR_MAX UINT64_MAX
+++#define PTRDIFF_MIN INT64_MIN
+++#define PTRDIFF_MAX INT64_MAX
+++#define SIZE_MAX UINT64_MAX
++--- /dev/null
+++++ b/arch/mips64/bits/syscall.h
++@@ -0,0 +1,633 @@
+++#define __NR_read 5000
+++#define __NR_write 5001
+++#define __NR_open 5002
+++#define __NR_close 5003
+++#define __NR_stat 5004
+++#define __NR_fstat 5005
+++#define __NR_lstat 5006
+++#define __NR_poll 5007
+++#define __NR_lseek 5008
+++#define __NR_mmap 5009
+++#define __NR_mprotect 5010
+++#define __NR_munmap 5011
+++#define __NR_brk 5012
+++#define __NR_rt_sigaction 5013
+++#define __NR_rt_sigprocmask 5014
+++#define __NR_ioctl 5015
+++#define __NR_pread64 5016
+++#define __NR_pwrite64 5017
+++#define __NR_readv 5018
+++#define __NR_writev 5019
+++#define __NR_access 5020
+++#define __NR_pipe 5021
+++#define __NR__newselect 5022
+++#define __NR_sched_yield 5023
+++#define __NR_mremap 5024
+++#define __NR_msync 5025
+++#define __NR_mincore 5026
+++#define __NR_madvise 5027
+++#define __NR_shmget 5028
+++#define __NR_shmat 5029
+++#define __NR_shmctl 5030
+++#define __NR_dup 5031
+++#define __NR_dup2 5032
+++#define __NR_pause 5033
+++#define __NR_nanosleep 5034
+++#define __NR_getitimer 5035
+++#define __NR_setitimer 5036
+++#define __NR_alarm 5037
+++#define __NR_getpid 5038
+++#define __NR_sendfile 5039
+++#define __NR_socket 5040
+++#define __NR_connect 5041
+++#define __NR_accept 5042
+++#define __NR_sendto 5043
+++#define __NR_recvfrom 5044
+++#define __NR_sendmsg 5045
+++#define __NR_recvmsg 5046
+++#define __NR_shutdown 5047
+++#define __NR_bind 5048
+++#define __NR_listen 5049
+++#define __NR_getsockname 5050
+++#define __NR_getpeername 5051
+++#define __NR_socketpair 5052
+++#define __NR_setsockopt 5053
+++#define __NR_getsockopt 5054
+++#define __NR_clone 5055
+++#define __NR_fork 5056
+++#define __NR_execve 5057
+++#define __NR_exit 5058
+++#define __NR_wait4 5059
+++#define __NR_kill 5060
+++#define __NR_uname 5061
+++#define __NR_semget 5062
+++#define __NR_semop 5063
+++#define __NR_semctl 5064
+++#define __NR_shmdt 5065
+++#define __NR_msgget 5066
+++#define __NR_msgsnd 5067
+++#define __NR_msgrcv 5068
+++#define __NR_msgctl 5069
+++#define __NR_fcntl 5070
+++#define __NR_flock 5071
+++#define __NR_fsync 5072
+++#define __NR_fdatasync 5073
+++#define __NR_truncate 5074
+++#define __NR_ftruncate 5075
+++#define __NR_getdents 5076
+++#define __NR_getcwd 5077
+++#define __NR_chdir 5078
+++#define __NR_fchdir 5079
+++#define __NR_rename 5080
+++#define __NR_mkdir 5081
+++#define __NR_rmdir 5082
+++#define __NR_creat 5083
+++#define __NR_link 5084
+++#define __NR_unlink 5085
+++#define __NR_symlink 5086
+++#define __NR_readlink 5087
+++#define __NR_chmod 5088
+++#define __NR_fchmod 5089
+++#define __NR_chown 5090
+++#define __NR_fchown 5091
+++#define __NR_lchown 5092
+++#define __NR_umask 5093
+++#define __NR_gettimeofday 5094
+++#define __NR_getrlimit 5095
+++#define __NR_getrusage 5096
+++#define __NR_sysinfo 5097
+++#define __NR_times 5098
+++#define __NR_ptrace 5099
+++#define __NR_getuid 5100
+++#define __NR_syslog 5101
+++#define __NR_getgid 5102
+++#define __NR_setuid 5103
+++#define __NR_setgid 5104
+++#define __NR_geteuid 5105
+++#define __NR_getegid 5106
+++#define __NR_setpgid 5107
+++#define __NR_getppid 5108
+++#define __NR_getpgrp 5109
+++#define __NR_setsid 5110
+++#define __NR_setreuid 5111
+++#define __NR_setregid 5112
+++#define __NR_getgroups 5113
+++#define __NR_setgroups 5114
+++#define __NR_setresuid 5115
+++#define __NR_getresuid 5116
+++#define __NR_setresgid 5117
+++#define __NR_getresgid 5118
+++#define __NR_getpgid 5119
+++#define __NR_setfsuid 5120
+++#define __NR_setfsgid 5121
+++#define __NR_getsid 5122
+++#define __NR_capget 5123
+++#define __NR_capset 5124
+++#define __NR_rt_sigpending 5125
+++#define __NR_rt_sigtimedwait 5126
+++#define __NR_rt_sigqueueinfo 5127
+++#define __NR_rt_sigsuspend 5128
+++#define __NR_sigaltstack 5129
+++#define __NR_utime 5130
+++#define __NR_mknod 5131
+++#define __NR_personality 5132
+++#define __NR_ustat 5133
+++#define __NR_statfs 5134
+++#define __NR_fstatfs 5135
+++#define __NR_sysfs 5136
+++#define __NR_getpriority 5137
+++#define __NR_setpriority 5138
+++#define __NR_sched_setparam 5139
+++#define __NR_sched_getparam 5140
+++#define __NR_sched_setscheduler 5141
+++#define __NR_sched_getscheduler 5142
+++#define __NR_sched_get_priority_max 5143
+++#define __NR_sched_get_priority_min 5144
+++#define __NR_sched_rr_get_interval 5145
+++#define __NR_mlock 5146
+++#define __NR_munlock 5147
+++#define __NR_mlockall 5148
+++#define __NR_munlockall 5149
+++#define __NR_vhangup 5150
+++#define __NR_pivot_root 5151
+++#define __NR__sysctl 5152
+++#define __NR_prctl 5153
+++#define __NR_adjtimex 5154
+++#define __NR_setrlimit 5155
+++#define __NR_chroot 5156
+++#define __NR_sync 5157
+++#define __NR_acct 5158
+++#define __NR_settimeofday 5159
+++#define __NR_mount 5160
+++#define __NR_umount2 5161
+++#define __NR_swapon 5162
+++#define __NR_swapoff 5163
+++#define __NR_reboot 5164
+++#define __NR_sethostname 5165
+++#define __NR_setdomainname 5166
+++#define __NR_create_module 5167
+++#define __NR_init_module 5168
+++#define __NR_delete_module 5169
+++#define __NR_get_kernel_syms 5170
+++#define __NR_query_module 5171
+++#define __NR_quotactl 5172
+++#define __NR_nfsservctl 5173
+++#define __NR_getpmsg 5174
+++#define __NR_putpmsg 5175
+++#define __NR_afs_syscall 5176
+++#define __NR_reserved177 5177
+++#define __NR_gettid 5178
+++#define __NR_readahead 5179
+++#define __NR_setxattr 5180
+++#define __NR_lsetxattr 5181
+++#define __NR_fsetxattr 5182
+++#define __NR_getxattr 5183
+++#define __NR_lgetxattr 5184
+++#define __NR_fgetxattr 5185
+++#define __NR_listxattr 5186
+++#define __NR_llistxattr 5187
+++#define __NR_flistxattr 5188
+++#define __NR_removexattr 5189
+++#define __NR_lremovexattr 5190
+++#define __NR_fremovexattr 5191
+++#define __NR_tkill 5192
+++#define __NR_reserved193 5193
+++#define __NR_futex 5194
+++#define __NR_sched_setaffinity 5195
+++#define __NR_sched_getaffinity 5196
+++#define __NR_cacheflush 5197
+++#define __NR_cachectl 5198
+++#define __NR_sysmips 5199
+++#define __NR_io_setup 5200
+++#define __NR_io_destroy 5201
+++#define __NR_io_getevents 5202
+++#define __NR_io_submit 5203
+++#define __NR_io_cancel 5204
+++#define __NR_exit_group 5205
+++#define __NR_lookup_dcookie 5206
+++#define __NR_epoll_create 5207
+++#define __NR_epoll_ctl 5208
+++#define __NR_epoll_wait 5209
+++#define __NR_remap_file_pages 5210
+++#define __NR_rt_sigreturn 5211
+++#define __NR_set_tid_address 5212
+++#define __NR_restart_syscall 5213
+++#define __NR_semtimedop 5214
+++#define __NR_fadvise64 5215
+++#define __NR_timer_create 5216
+++#define __NR_timer_settime 5217
+++#define __NR_timer_gettime 5218
+++#define __NR_timer_getoverrun 5219
+++#define __NR_timer_delete 5220
+++#define __NR_clock_settime 5221
+++#define __NR_clock_gettime 5222
+++#define __NR_clock_getres 5223
+++#define __NR_clock_nanosleep 5224
+++#define __NR_tgkill 5225
+++#define __NR_utimes 5226
+++#define __NR_mbind 5227
+++#define __NR_get_mempolicy 5228
+++#define __NR_set_mempolicy 5229
+++#define __NR_mq_open 5230
+++#define __NR_mq_unlink 5231
+++#define __NR_mq_timedsend 5232
+++#define __NR_mq_timedreceive 5233
+++#define __NR_mq_notify 5234
+++#define __NR_mq_getsetattr 5235
+++#define __NR_vserver 5236
+++#define __NR_waitid 5237
+++#define __NR_add_key 5239
+++#define __NR_request_key 5240
+++#define __NR_keyctl 5241
+++#define __NR_set_thread_area 5242
+++#define __NR_inotify_init 5243
+++#define __NR_inotify_add_watch 5244
+++#define __NR_inotify_rm_watch 5245
+++#define __NR_migrate_pages 5246
+++#define __NR_openat 5247
+++#define __NR_mkdirat 5248
+++#define __NR_mknodat 5249
+++#define __NR_fchownat 5250
+++#define __NR_futimesat 5251
+++#define __NR_newfstatat 5252
+++#define __NR_unlinkat 5253
+++#define __NR_renameat 5254
+++#define __NR_linkat 5255
+++#define __NR_symlinkat 5256
+++#define __NR_readlinkat 5257
+++#define __NR_fchmodat 5258
+++#define __NR_faccessat 5259
+++#define __NR_pselect6 5260
+++#define __NR_ppoll 5261
+++#define __NR_unshare 5262
+++#define __NR_splice 5263
+++#define __NR_sync_file_range 5264
+++#define __NR_tee 5265
+++#define __NR_vmsplice 5266
+++#define __NR_move_pages 5267
+++#define __NR_set_robust_list 5268
+++#define __NR_get_robust_list 5269
+++#define __NR_kexec_load 5270
+++#define __NR_getcpu 5271
+++#define __NR_epoll_pwait 5272
+++#define __NR_ioprio_set 5273
+++#define __NR_ioprio_get 5274
+++#define __NR_utimensat 5275
+++#define __NR_signalfd 5276
+++#define __NR_timerfd 5277
+++#define __NR_eventfd 5278
+++#define __NR_fallocate 5279
+++#define __NR_timerfd_create 5280
+++#define __NR_timerfd_gettime 5281
+++#define __NR_timerfd_settime 5282
+++#define __NR_signalfd4 5283
+++#define __NR_eventfd2 5284
+++#define __NR_epoll_create1 5285
+++#define __NR_dup3 5286
+++#define __NR_pipe2 5287
+++#define __NR_inotify_init1 5288
+++#define __NR_preadv 5289
+++#define __NR_pwritev 5290
+++#define __NR_rt_tgsigqueueinfo 5291
+++#define __NR_perf_event_open 5292
+++#define __NR_accept4 5293
+++#define __NR_recvmmsg 5294
+++#define __NR_fanotify_init 5295
+++#define __NR_fanotify_mark 5296
+++#define __NR_prlimit64 5297
+++#define __NR_name_to_handle_at 5298
+++#define __NR_open_by_handle_at 5299
+++#define __NR_clock_adjtime 5300
+++#define __NR_syncfs 5301
+++#define __NR_sendmmsg 5302
+++#define __NR_setns 5303
+++#define __NR_process_vm_readv 5304
+++#define __NR_process_vm_writev 5305
+++#define __NR_kcmp 5306
+++#define __NR_finit_module 5307
+++#define __NR_getdents64 5308
+++#define __NR_sched_setattr 5309
+++#define __NR_sched_getattr 5310
+++#define __NR_renameat2 5311
+++#define __NR_seccomp 5312
+++#define __NR_getrandom 5313
+++#define __NR_memfd_create 5314
+++#define __NR_bpf 5315
+++#define __NR_execveat 5316
+++
+++#define SYS_read 5000
+++#define SYS_write 5001
+++#define SYS_open 5002
+++#define SYS_close 5003
+++#define SYS_stat 5004
+++#define SYS_fstat 5005
+++#define SYS_lstat 5006
+++#define SYS_poll 5007
+++#define SYS_lseek 5008
+++#define SYS_mmap 5009
+++#define SYS_mprotect 5010
+++#define SYS_munmap 5011
+++#define SYS_brk 5012
+++#define SYS_rt_sigaction 5013
+++#define SYS_rt_sigprocmask 5014
+++#define SYS_ioctl 5015
+++#define SYS_pread64 5016
+++#define SYS_pwrite64 5017
+++#define SYS_readv 5018
+++#define SYS_writev 5019
+++#define SYS_access 5020
+++#define SYS_pipe 5021
+++#define SYS__newselect 5022
+++#define SYS_sched_yield 5023
+++#define SYS_mremap 5024
+++#define SYS_msync 5025
+++#define SYS_mincore 5026
+++#define SYS_madvise 5027
+++#define SYS_shmget 5028
+++#define SYS_shmat 5029
+++#define SYS_shmctl 5030
+++#define SYS_dup 5031
+++#define SYS_dup2 5032
+++#define SYS_pause 5033
+++#define SYS_nanosleep 5034
+++#define SYS_getitimer 5035
+++#define SYS_setitimer 5036
+++#define SYS_alarm 5037
+++#define SYS_getpid 5038
+++#define SYS_sendfile 5039
+++#define SYS_socket 5040
+++#define SYS_connect 5041
+++#define SYS_accept 5042
+++#define SYS_sendto 5043
+++#define SYS_recvfrom 5044
+++#define SYS_sendmsg 5045
+++#define SYS_recvmsg 5046
+++#define SYS_shutdown 5047
+++#define SYS_bind 5048
+++#define SYS_listen 5049
+++#define SYS_getsockname 5050
+++#define SYS_getpeername 5051
+++#define SYS_socketpair 5052
+++#define SYS_setsockopt 5053
+++#define SYS_getsockopt 5054
+++#define SYS_clone 5055
+++#define SYS_fork 5056
+++#define SYS_execve 5057
+++#define SYS_exit 5058
+++#define SYS_wait4 5059
+++#define SYS_kill 5060
+++#define SYS_uname 5061
+++#define SYS_semget 5062
+++#define SYS_semop 5063
+++#define SYS_semctl 5064
+++#define SYS_shmdt 5065
+++#define SYS_msgget 5066
+++#define SYS_msgsnd 5067
+++#define SYS_msgrcv 5068
+++#define SYS_msgctl 5069
+++#define SYS_fcntl 5070
+++#define SYS_flock 5071
+++#define SYS_fsync 5072
+++#define SYS_fdatasync 5073
+++#define SYS_truncate 5074
+++#define SYS_ftruncate 5075
+++#define SYS_getdents 5076
+++#define SYS_getcwd 5077
+++#define SYS_chdir 5078
+++#define SYS_fchdir 5079
+++#define SYS_rename 5080
+++#define SYS_mkdir 5081
+++#define SYS_rmdir 5082
+++#define SYS_creat 5083
+++#define SYS_link 5084
+++#define SYS_unlink 5085
+++#define SYS_symlink 5086
+++#define SYS_readlink 5087
+++#define SYS_chmod 5088
+++#define SYS_fchmod 5089
+++#define SYS_chown 5090
+++#define SYS_fchown 5091
+++#define SYS_lchown 5092
+++#define SYS_umask 5093
+++#define SYS_gettimeofday 5094
+++#define SYS_getrlimit 5095
+++#define SYS_getrusage 5096
+++#define SYS_sysinfo 5097
+++#define SYS_times 5098
+++#define SYS_ptrace 5099
+++#define SYS_getuid 5100
+++#define SYS_syslog 5101
+++#define SYS_getgid 5102
+++#define SYS_setuid 5103
+++#define SYS_setgid 5104
+++#define SYS_geteuid 5105
+++#define SYS_getegid 5106
+++#define SYS_setpgid 5107
+++#define SYS_getppid 5108
+++#define SYS_getpgrp 5109
+++#define SYS_setsid 5110
+++#define SYS_setreuid 5111
+++#define SYS_setregid 5112
+++#define SYS_getgroups 5113
+++#define SYS_setgroups 5114
+++#define SYS_setresuid 5115
+++#define SYS_getresuid 5116
+++#define SYS_setresgid 5117
+++#define SYS_getresgid 5118
+++#define SYS_getpgid 5119
+++#define SYS_setfsuid 5120
+++#define SYS_setfsgid 5121
+++#define SYS_getsid 5122
+++#define SYS_capget 5123
+++#define SYS_capset 5124
+++#define SYS_rt_sigpending 5125
+++#define SYS_rt_sigtimedwait 5126
+++#define SYS_rt_sigqueueinfo 5127
+++#define SYS_rt_sigsuspend 5128
+++#define SYS_sigaltstack 5129
+++#define SYS_utime 5130
+++#define SYS_mknod 5131
+++#define SYS_personality 5132
+++#define SYS_ustat 5133
+++#define SYS_statfs 5134
+++#define SYS_fstatfs 5135
+++#define SYS_sysfs 5136
+++#define SYS_getpriority 5137
+++#define SYS_setpriority 5138
+++#define SYS_sched_setparam 5139
+++#define SYS_sched_getparam 5140
+++#define SYS_sched_setscheduler 5141
+++#define SYS_sched_getscheduler 5142
+++#define SYS_sched_get_priority_max 5143
+++#define SYS_sched_get_priority_min 5144
+++#define SYS_sched_rr_get_interval 5145
+++#define SYS_mlock 5146
+++#define SYS_munlock 5147
+++#define SYS_mlockall 5148
+++#define SYS_munlockall 5149
+++#define SYS_vhangup 5150
+++#define SYS_pivot_root 5151
+++#define SYS__sysctl 5152
+++#define SYS_prctl 5153
+++#define SYS_adjtimex 5154
+++#define SYS_setrlimit 5155
+++#define SYS_chroot 5156
+++#define SYS_sync 5157
+++#define SYS_acct 5158
+++#define SYS_settimeofday 5159
+++#define SYS_mount 5160
+++#define SYS_umount2 5161
+++#define SYS_swapon 5162
+++#define SYS_swapoff 5163
+++#define SYS_reboot 5164
+++#define SYS_sethostname 5165
+++#define SYS_setdomainname 5166
+++#define SYS_create_module 5167
+++#define SYS_init_module 5168
+++#define SYS_delete_module 5169
+++#define SYS_get_kernel_syms 5170
+++#define SYS_query_module 5171
+++#define SYS_quotactl 5172
+++#define SYS_nfsservctl 5173
+++#define SYS_getpmsg 5174
+++#define SYS_putpmsg 5175
+++#define SYS_afs_syscall 5176
+++#define SYS_reserved177 5177
+++#define SYS_gettid 5178
+++#define SYS_readahead 5179
+++#define SYS_setxattr 5180
+++#define SYS_lsetxattr 5181
+++#define SYS_fsetxattr 5182
+++#define SYS_getxattr 5183
+++#define SYS_lgetxattr 5184
+++#define SYS_fgetxattr 5185
+++#define SYS_listxattr 5186
+++#define SYS_llistxattr 5187
+++#define SYS_flistxattr 5188
+++#define SYS_removexattr 5189
+++#define SYS_lremovexattr 5190
+++#define SYS_fremovexattr 5191
+++#define SYS_tkill 5192
+++#define SYS_reserved193 5193
+++#define SYS_futex 5194
+++#define SYS_sched_setaffinity 5195
+++#define SYS_sched_getaffinity 5196
+++#define SYS_cacheflush 5197
+++#define SYS_cachectl 5198
+++#define SYS_sysmips 5199
+++#define SYS_io_setup 5200
+++#define SYS_io_destroy 5201
+++#define SYS_io_getevents 5202
+++#define SYS_io_submit 5203
+++#define SYS_io_cancel 5204
+++#define SYS_exit_group 5205
+++#define SYS_lookup_dcookie 5206
+++#define SYS_epoll_create 5207
+++#define SYS_epoll_ctl 5208
+++#define SYS_epoll_wait 5209
+++#define SYS_remap_file_pages 5210
+++#define SYS_rt_sigreturn 5211
+++#define SYS_set_tid_address 5212
+++#define SYS_restart_syscall 5213
+++#define SYS_semtimedop 5214
+++#define SYS_fadvise64 5215
+++#define SYS_timer_create 5216
+++#define SYS_timer_settime 5217
+++#define SYS_timer_gettime 5218
+++#define SYS_timer_getoverrun 5219
+++#define SYS_timer_delete 5220
+++#define SYS_clock_settime 5221
+++#define SYS_clock_gettime 5222
+++#define SYS_clock_getres 5223
+++#define SYS_clock_nanosleep 5224
+++#define SYS_tgkill 5225
+++#define SYS_utimes 5226
+++#define SYS_mbind 5227
+++#define SYS_get_mempolicy 5228
+++#define SYS_set_mempolicy 5229
+++#define SYS_mq_open 5230
+++#define SYS_mq_unlink 5231
+++#define SYS_mq_timedsend 5232
+++#define SYS_mq_timedreceive 5233
+++#define SYS_mq_notify 5234
+++#define SYS_mq_getsetattr 5235
+++#define SYS_vserver 5236
+++#define SYS_waitid 5237
+++#define SYS_add_key 5239
+++#define SYS_request_key 5240
+++#define SYS_keyctl 5241
+++#define SYS_set_thread_area 5242
+++#define SYS_inotify_init 5243
+++#define SYS_inotify_add_watch 5244
+++#define SYS_inotify_rm_watch 5245
+++#define SYS_migrate_pages 5246
+++#define SYS_openat 5247
+++#define SYS_mkdirat 5248
+++#define SYS_mknodat 5249
+++#define SYS_fchownat 5250
+++#define SYS_futimesat 5251
+++#define SYS_newfstatat 5252
+++#define SYS_unlinkat 5253
+++#define SYS_renameat 5254
+++#define SYS_linkat 5255
+++#define SYS_symlinkat 5256
+++#define SYS_readlinkat 5257
+++#define SYS_fchmodat 5258
+++#define SYS_faccessat 5259
+++#define SYS_pselect6 5260
+++#define SYS_ppoll 5261
+++#define SYS_unshare 5262
+++#define SYS_splice 5263
+++#define SYS_sync_file_range 5264
+++#define SYS_tee 5265
+++#define SYS_vmsplice 5266
+++#define SYS_move_pages 5267
+++#define SYS_set_robust_list 5268
+++#define SYS_get_robust_list 5269
+++#define SYS_kexec_load 5270
+++#define SYS_getcpu 5271
+++#define SYS_epoll_pwait 5272
+++#define SYS_ioprio_set 5273
+++#define SYS_ioprio_get 5274
+++#define SYS_utimensat 5275
+++#define SYS_signalfd 5276
+++#define SYS_timerfd 5277
+++#define SYS_eventfd 5278
+++#define SYS_fallocate 5279
+++#define SYS_timerfd_create 5280
+++#define SYS_timerfd_gettime 5281
+++#define SYS_timerfd_settime 5282
+++#define SYS_signalfd4 5283
+++#define SYS_eventfd2 5284
+++#define SYS_epoll_create1 5285
+++#define SYS_dup3 5286
+++#define SYS_pipe2 5287
+++#define SYS_inotify_init1 5288
+++#define SYS_preadv 5289
+++#define SYS_pwritev 5290
+++#define SYS_rt_tgsigqueueinfo 5291
+++#define SYS_perf_event_open 5292
+++#define SYS_accept4 5293
+++#define SYS_recvmmsg 5294
+++#define SYS_fanotify_init 5295
+++#define SYS_fanotify_mark 5296
+++#define SYS_prlimit64 5297
+++#define SYS_name_to_handle_at 5298
+++#define SYS_open_by_handle_at 5299
+++#define SYS_clock_adjtime 5300
+++#define SYS_syncfs 5301
+++#define SYS_sendmmsg 5302
+++#define SYS_setns 5303
+++#define SYS_process_vm_readv 5304
+++#define SYS_process_vm_writev 5305
+++#define SYS_kcmp 5306
+++#define SYS_finit_module 5307
+++#define SYS_getdents64 5308
+++#define SYS_sched_setattr 5309
+++#define SYS_sched_getattr 5310
+++#define SYS_renameat2 5311
+++#define SYS_seccomp 5312
+++#define SYS_getrandom 5313
+++#define SYS_memfd_create 5314
+++#define SYS_bpf 5315
+++#define SYS_execveat 5316
++--- /dev/null
+++++ b/arch/mips64/bits/termios.h
++@@ -0,0 +1,166 @@
+++struct termios {
+++ tcflag_t c_iflag;
+++ tcflag_t c_oflag;
+++ tcflag_t c_cflag;
+++ tcflag_t c_lflag;
+++ cc_t c_line;
+++ cc_t c_cc[NCCS];
+++};
+++
+++#define VINTR 0
+++#define VQUIT 1
+++#define VERASE 2
+++#define VKILL 3
+++#define VMIN 4
+++#define VTIME 5
+++#define VEOL2 6
+++#define VSWTC 7
+++#define VSWTCH 7
+++#define VSTART 8
+++#define VSTOP 9
+++#define VSUSP 10
+++#define VREPRINT 12
+++#define VDISCARD 13
+++#define VWERASE 14
+++#define VLNEXT 15
+++#define VEOF 16
+++#define VEOL 17
+++
+++#define IGNBRK 0000001
+++#define BRKINT 0000002
+++#define IGNPAR 0000004
+++#define PARMRK 0000010
+++#define INPCK 0000020
+++#define ISTRIP 0000040
+++#define INLCR 0000100
+++#define IGNCR 0000200
+++#define ICRNL 0000400
+++#define IUCLC 0001000
+++#define IXON 0002000
+++#define IXANY 0004000
+++#define IXOFF 0010000
+++#define IMAXBEL 0020000
+++#define IUTF8 0040000
+++
+++#define OPOST 0000001
+++#define OLCUC 0000002
+++#define ONLCR 0000004
+++#define OCRNL 0000010
+++#define ONOCR 0000020
+++#define ONLRET 0000040
+++#define OFILL 0000100
+++#define OFDEL 0000200
+++#define NLDLY 0000400
+++#define NL0 0000000
+++#define NL1 0000400
+++#define CRDLY 0003000
+++#define CR0 0000000
+++#define CR1 0001000
+++#define CR2 0002000
+++#define CR3 0003000
+++#define TABDLY 0014000
+++#define TAB0 0000000
+++#define TAB1 0004000
+++#define TAB2 0010000
+++#define TAB3 0014000
+++#define BSDLY 0020000
+++#define BS0 0000000
+++#define BS1 0020000
+++#define FFDLY 0100000
+++#define FF0 0000000
+++#define FF1 0100000
+++
+++#define VTDLY 0040000
+++#define VT0 0000000
+++#define VT1 0040000
+++
+++#define B0 0000000
+++#define B50 0000001
+++#define B75 0000002
+++#define B110 0000003
+++#define B134 0000004
+++#define B150 0000005
+++#define B200 0000006
+++#define B300 0000007
+++#define B600 0000010
+++#define B1200 0000011
+++#define B1800 0000012
+++#define B2400 0000013
+++#define B4800 0000014
+++#define B9600 0000015
+++#define B19200 0000016
+++#define B38400 0000017
+++#define EXTA 0000016
+++#define EXTB 0000017
+++
+++#define BOTHER 0010000
+++#define B57600 0010001
+++#define B115200 0010002
+++#define B230400 0010003
+++#define B460800 0010004
+++#define B500000 0010005
+++#define B576000 0010006
+++#define B921600 0010007
+++#define B1000000 0010010
+++#define B1152000 0010011
+++#define B1500000 0010012
+++#define B2000000 0010013
+++#define B2500000 0010014
+++#define B3000000 0010015
+++#define B3500000 0010016
+++#define B4000000 0010017
+++
+++#define CBAUD 0010017
+++
+++#define CSIZE 0000060
+++#define CS5 0000000
+++#define CS6 0000020
+++#define CS7 0000040
+++#define CS8 0000060
+++#define CSTOPB 0000100
+++#define CREAD 0000200
+++#define PARENB 0000400
+++#define PARODD 0001000
+++#define HUPCL 0002000
+++#define CLOCAL 0004000
+++
+++#define ISIG 0000001
+++#define ICANON 0000002
+++#define XCASE 0000004
+++#define ECHO 0000010
+++#define ECHOE 0000020
+++#define ECHOK 0000040
+++#define ECHONL 0000100
+++#define NOFLSH 0000200
+++#define IEXTEN 0000400
+++#define ECHOCTL 0001000
+++#define ECHOPRT 0002000
+++#define ECHOKE 0004000
+++#define FLUSHO 0020000
+++#define PENDIN 0040000
+++#define TOSTOP 0100000
+++#define ITOSTOP 0100000
+++
+++#define TCOOFF 0
+++#define TCOON 1
+++#define TCIOFF 2
+++#define TCION 3
+++
+++#define TCIFLUSH 0
+++#define TCOFLUSH 1
+++#define TCIOFLUSH 2
+++
+++#define TCSANOW 0
+++#define TCSADRAIN 1
+++#define TCSAFLUSH 2
+++
+++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+++#define CBAUDEX 0010000
+++#define CIBAUD 002003600000
+++#define IBSHIFT 16
+++#define CMSPAR 010000000000
+++#define CRTSCTS 020000000000
+++#define EXTPROC 0200000
+++#define XTABS 0014000
+++#define TIOCSER_TEMT 1
+++#endif
++--- /dev/null
+++++ b/arch/mips64/bits/user.h
++@@ -0,0 +1,15 @@
+++struct user {
+++ unsigned long regs[102];
+++ unsigned long u_tsize, u_dsize, u_ssize;
+++ unsigned long long start_code, start_data, start_stack;
+++ long long signal;
+++ unsigned long long *u_ar0;
+++ unsigned long long magic;
+++ char u_comm[32];
+++};
+++
+++#define ELF_NGREG 45
+++#define ELF_NFPREG 33
+++
+++typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+++typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
++--- /dev/null
+++++ b/arch/mips64/crt_arch.h
++@@ -0,0 +1,33 @@
+++__asm__(
+++".set push\n"
+++".set noreorder\n"
+++".text \n"
+++".global _" START "\n"
+++".global " START "\n"
+++".global " START "_data\n"
+++".type _" START ", @function\n"
+++".type " START ", @function\n"
+++".type " START "_data, @function\n"
+++"_" START ":\n"
+++"" START ":\n"
+++".align 8 \n"
+++" bal 1f \n"
+++" move $fp, $0 \n"
+++"" START "_data: \n"
+++" .gpdword " START "_data \n"
+++" .gpdword " START "_c \n"
+++".weak _DYNAMIC \n"
+++".hidden _DYNAMIC \n"
+++" .gpdword _DYNAMIC \n"
+++"1: ld $gp, 0($ra) \n"
+++" dsubu $gp, $ra, $gp \n"
+++" move $4, $sp \n"
+++" ld $5, 16($ra) \n"
+++" daddu $5, $5, $gp \n"
+++" ld $25, 8($ra) \n"
+++" daddu $25, $25, $gp \n"
+++" and $sp, $sp, -16 \n"
+++" jalr $25 \n"
+++" nop \n"
+++".set pop \n"
+++);
++--- /dev/null
+++++ b/arch/mips64/ksigaction.h
++@@ -0,0 +1,8 @@
+++struct k_sigaction {
+++ unsigned flags;
+++ void (*handler)(int);
+++ unsigned long mask[2];
+++ void (*restorer)();
+++};
+++
+++void __restore(), __restore_rt();
++--- /dev/null
+++++ b/arch/mips64/pthread_arch.h
++@@ -0,0 +1,18 @@
+++static inline struct pthread *__pthread_self()
+++{
+++#ifdef __clang__
+++ char *tp;
+++ __asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=r" (tp) : : "$3" );
+++#else
+++ register char *tp __asm__("$3");
+++ __asm__ __volatile__ (".word 0x7c03e83b" : "=r" (tp) );
+++#endif
+++ return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
+++}
+++
+++#define TLS_ABOVE_TP
+++#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
+++
+++#define DTP_OFFSET 0x8000
+++
+++#define MC_PC pc
++--- /dev/null
+++++ b/arch/mips64/reloc.h
++@@ -0,0 +1,60 @@
+++#ifndef __RELOC_H__
+++#define __RELOC_H__
+++
+++#define _GNU_SOURCE
+++#include <endian.h>
+++
+++#if __BYTE_ORDER == __LITTLE_ENDIAN
+++#define ENDIAN_SUFFIX "el"
+++#else
+++#define ENDIAN_SUFFIX ""
+++#endif
+++
+++#ifdef __mips_soft_float
+++#define FP_SUFFIX "-sf"
+++#else
+++#define FP_SUFFIX ""
+++#endif
+++
+++#define LDSO_ARCH "mips64" ENDIAN_SUFFIX FP_SUFFIX
+++
+++#define TPOFF_K (-0x7000)
+++
+++#define REL_SYM_OR_REL 4611
+++#define REL_PLT R_MIPS_JUMP_SLOT
+++#define REL_COPY R_MIPS_COPY
+++#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
+++#define REL_DTPOFF R_MIPS_TLS_DTPREL64
+++#define REL_TPOFF R_MIPS_TLS_TPREL64
+++
+++#undef R_TYPE
+++#undef R_SYM
+++#undef R_INFO
+++#define R_TYPE(x) (be64toh(x)&0x7fffffff)
+++#define R_SYM(x) (be32toh(be64toh(x)>>32))
+++#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
+++
+++#define NEED_MIPS_GOT_RELOCS 1
+++#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
+++#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
+++
+++#define CRTJMP(pc,sp) __asm__ __volatile__( \
+++ "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
+++
+++#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+++ ".hidden " #sym "\n" \
+++ ".set push \n" \
+++ ".set noreorder \n" \
+++ ".align 8 \n" \
+++ " bal 1f \n" \
+++ " nop \n" \
+++ " .gpdword . \n" \
+++ " .gpdword " #sym " \n" \
+++ "1: ld %0, ($ra) \n" \
+++ " dsubu %0, $ra, %0 \n" \
+++ " ld $ra, 8($ra) \n" \
+++ " daddu %0, %0, $ra \n" \
+++ ".set pop \n" \
+++ : "=r"(*(fp)) : : "memory", "ra" )
+++
+++#endif
++--- /dev/null
+++++ b/arch/mips64/syscall_arch.h
++@@ -0,0 +1,281 @@
+++#define __SYSCALL_LL_E(x) (x)
+++#define __SYSCALL_LL_O(x) (x)
+++
+++__attribute__((visibility("hidden")))
+++long (__syscall)(long, ...);
+++
+++#define SYSCALL_RLIM_INFINITY (-1UL/2)
+++
+++#include <sys/stat.h>
+++struct kernel_stat {
+++ unsigned int st_dev;
+++ unsigned int __pad1[3];
+++ unsigned long long st_ino;
+++ unsigned int st_mode;
+++ unsigned int st_nlink;
+++ int st_uid;
+++ int st_gid;
+++ unsigned int st_rdev;
+++ unsigned int __pad2[3];
+++ long long st_size;
+++ unsigned int st_atime_sec;
+++ unsigned int st_atime_nsec;
+++ unsigned int st_mtime_sec;
+++ unsigned int st_mtime_nsec;
+++ unsigned int st_ctime_sec;
+++ unsigned int st_ctime_nsec;
+++ unsigned int st_blksize;
+++ unsigned int __pad3;
+++ unsigned long long st_blocks;
+++};
+++
+++static void __stat_fix(struct kernel_stat *kst, struct stat *st)
+++{
+++ st->st_dev = kst->st_dev;
+++ st->st_ino = kst->st_ino;
+++ st->st_mode = kst->st_mode;
+++ st->st_nlink = kst->st_nlink;
+++ st->st_uid = kst->st_uid;
+++ st->st_gid = kst->st_gid;
+++ st->st_rdev = kst->st_rdev;
+++ st->st_size = kst->st_size;
+++ st->st_atim.tv_sec = kst->st_atime_sec;
+++ st->st_atim.tv_nsec = kst->st_atime_nsec;
+++ st->st_mtim.tv_sec = kst->st_mtime_sec;
+++ st->st_mtim.tv_nsec = kst->st_mtime_nsec;
+++ st->st_ctim.tv_sec = kst->st_ctime_sec;
+++ st->st_ctim.tv_nsec = kst->st_ctime_nsec;
+++ st->st_blksize = kst->st_blksize;
+++ st->st_blocks = kst->st_blocks;
+++}
+++
+++#ifndef __clang__
+++
+++static inline long __syscall0(long n)
+++{
+++ register long r7 __asm__("$7");
+++ register long r2 __asm__("$2");
+++ __asm__ __volatile__ (
+++ "daddu $2,$0,%2 ; syscall"
+++ : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
+++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+++ "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+++ return r7 ? -r2 : r2;
+++}
+++
+++static inline long __syscall1(long n, long a)
+++{
+++ register long r4 __asm__("$4") = a;
+++ register long r7 __asm__("$7");
+++ register long r2 __asm__("$2");
+++ __asm__ __volatile__ (
+++ "daddu $2,$0,%2 ; syscall"
+++ : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
+++ "r"(r4)
+++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+++ "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+++ return r7 ? -r2 : r2;
+++}
+++
+++static inline long __syscall2(long n, long a, long b)
+++{
+++ struct kernel_stat kst;
+++ long ret;
+++ register long r4 __asm__("$4");
+++ register long r5 __asm__("$5");
+++ register long r7 __asm__("$7");
+++ register long r2 __asm__("$2");
+++
+++ r5 = b;
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ r5 = (long) &kst;
+++
+++ r4 = a;
+++ __asm__ __volatile__ (
+++ "daddu $2,$0,%2 ; syscall"
+++ : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
+++ "r"(r4), "r"(r5)
+++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+++ "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+++
+++ if (r7) return -r2;
+++ ret = r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)b);
+++
+++ return ret;
+++}
+++
+++static inline long __syscall3(long n, long a, long b, long c)
+++{
+++ struct kernel_stat kst;
+++ long ret;
+++ register long r4 __asm__("$4");
+++ register long r5 __asm__("$5");
+++ register long r6 __asm__("$6");
+++ register long r7 __asm__("$7");
+++ register long r2 __asm__("$2");
+++
+++ r5 = b;
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ r5 = (long) &kst;
+++
+++ r4 = a;
+++ r6 = c;
+++ __asm__ __volatile__ (
+++ "daddu $2,$0,%2 ; syscall"
+++ : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
+++ "r"(r4), "r"(r5), "r"(r6)
+++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+++ "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+++
+++ if (r7) return -r2;
+++ ret = r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)b);
+++
+++ return ret;
+++}
+++
+++static inline long __syscall4(long n, long a, long b, long c, long d)
+++{
+++ struct kernel_stat kst;
+++ long ret;
+++ register long r4 __asm__("$4");
+++ register long r5 __asm__("$5");
+++ register long r6 __asm__("$6");
+++ register long r7 __asm__("$7");
+++ register long r2 __asm__("$2");
+++
+++ r5 = b;
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ r5 = (long) &kst;
+++
+++ r4 = a;
+++ r6 = c;
+++ r7 = d;
+++ __asm__ __volatile__ (
+++ "daddu $2,$0,%2 ; syscall"
+++ : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
+++ "r"(r4), "r"(r5), "r"(r6)
+++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+++ "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+++
+++ if (r7) return -r2;
+++ ret = r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)b);
+++
+++ return ret;
+++}
+++
+++#else
+++
+++static inline long __syscall0(long n)
+++{
+++ return (__syscall)(n);
+++}
+++
+++static inline long __syscall1(long n, long a)
+++{
+++ return (__syscall)(n, a);
+++}
+++
+++static inline long __syscall2(long n, long a, long b)
+++{
+++ long r2;
+++ long old_b = b;
+++ struct kernel_stat kst;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ b = (long) &kst;
+++
+++ r2 = (__syscall)(n, a, b);
+++ if (r2 > -4096UL) return r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)old_b);
+++
+++ return r2;
+++}
+++
+++static inline long __syscall3(long n, long a, long b, long c)
+++{
+++ long r2;
+++ long old_b = b;
+++ struct kernel_stat kst;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ b = (long) &kst;
+++
+++ r2 = (__syscall)(n, a, b, c);
+++ if (r2 > -4096UL) return r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)old_b);
+++
+++ return r2;
+++}
+++
+++static inline long __syscall4(long n, long a, long b, long c, long d)
+++{
+++ long r2;
+++ long old_b = b;
+++ struct kernel_stat kst;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ b = (long) &kst;
+++
+++ r2 = (__syscall)(n, a, b, c, d);
+++ if (r2 > -4096UL) return r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)old_b);
+++
+++ return r2;
+++}
+++
+++#endif
+++
+++static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+++{
+++ long r2;
+++ long old_b = b;
+++ struct kernel_stat kst;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ b = (long) &kst;
+++
+++ r2 = (__syscall)(n, a, b, c, d, e);
+++ if (r2 > -4096UL) return r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)old_b);
+++
+++ return r2;
+++}
+++
+++static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+++{
+++ long r2;
+++ long old_b = b;
+++ struct kernel_stat kst;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ b = (long) &kst;
+++
+++ r2 = (__syscall)(n, a, b, c, d, e, f);
+++ if (r2 > -4096UL) return r2;
+++
+++ if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
+++ __stat_fix(&kst, (struct stat *)old_b);
+++
+++ return r2;
+++}
+++
+++#define VDSO_USEFUL
+++#define VDSO_CGT_SYM "__vdso_clock_gettime"
+++#define VDSO_CGT_VER "LINUX_2.6"
++--- a/arch/powerpc/bits/fenv.h
+++++ b/arch/powerpc/bits/fenv.h
++@@ -1,3 +1,7 @@
+++#ifdef _SOFT_FLOAT
+++#define FE_ALL_EXCEPT 0
+++#define FE_TONEAREST 0
+++#else
++ #define FE_TONEAREST 0
++ #define FE_TOWARDZERO 1
++ #define FE_UPWARD 2
++@@ -24,6 +28,7 @@
++
++ #define FE_ALL_INVALID 0x01f80700
++ #endif
+++#endif
++
++ typedef unsigned fexcept_t;
++ typedef double fenv_t;
++--- a/arch/powerpc/reloc.h
+++++ b/arch/powerpc/reloc.h
++@@ -1,4 +1,10 @@
++-#define LDSO_ARCH "powerpc"
+++#ifdef _SOFT_FLOAT
+++#define FP_SUFFIX "-sf"
+++#else
+++#define FP_SUFFIX ""
+++#endif
+++
+++#define LDSO_ARCH "powerpc" FP_SUFFIX
++
++ #define TPOFF_K (-0x7000)
++
++--- a/arch/x86_64/syscall_arch.h
+++++ b/arch/x86_64/syscall_arch.h
++@@ -64,3 +64,5 @@ static __inline long __syscall6(long n,
++ #define VDSO_USEFUL
++ #define VDSO_CGT_SYM "__vdso_clock_gettime"
++ #define VDSO_CGT_VER "LINUX_2.6"
+++#define VDSO_GETCPU_SYM "__vdso_getcpu"
+++#define VDSO_GETCPU_VER "LINUX_2.6"
++--- a/configure
+++++ b/configure
++@@ -299,7 +299,7 @@ printf "%s\n" "$target"
++ #
++ case "$target" in
++ # Catch these early to simplify matching for 32-bit archs
++-mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
+++powerpc64*) fail "$0: unsupported target \"$target\"" ;;
++ arm*) ARCH=arm ;;
++ aarch64*) ARCH=aarch64 ;;
++ i?86-nt32*) ARCH=nt32 ;;
++@@ -307,6 +307,7 @@ i?86*) ARCH=i386 ;;
++ x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
++ x86_64-nt64*) ARCH=nt64 ;;
++ x86_64*) ARCH=x86_64 ;;
+++mips64*) ARCH=mips64 ;;
++ mips*) ARCH=mips ;;
++ microblaze*) ARCH=microblaze ;;
++ or1k*) ARCH=or1k ;;
++@@ -615,6 +616,17 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE
++ trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
++ fi
++
+++if test "$ARCH" = "mips64" ; then
+++trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
+++trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
+++fi
+++
+++if test "$ARCH" = "powerpc" ; then
+++trycppif "__NO_FPRS__ && !_SOFT_FLOAT" "$t" && fail \
+++ "$0: error: compiler's floating point configuration is unsupported"
+++trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf
+++fi
+++
++ test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
++ && SUBARCH=${SUBARCH}el
++
++--- /dev/null
+++++ b/crt/mips64/crti.s
++@@ -0,0 +1,17 @@
+++.set noreorder
+++
+++.section .init
+++.global _init
+++.align 3
+++_init:
+++ dsubu $sp, $sp, 32
+++ sd $gp, 16($sp)
+++ sd $ra, 24($sp)
+++
+++.section .fini
+++.global _fini
+++.align 3
+++_fini:
+++ dsubu $sp, $sp, 32
+++ sd $gp, 16($sp)
+++ sd $ra, 24($sp)
++--- /dev/null
+++++ b/crt/mips64/crtn.s
++@@ -0,0 +1,13 @@
+++.set noreorder
+++
+++.section .init
+++ ld $gp,16($sp)
+++ ld $ra,24($sp)
+++ j $ra
+++ daddu $sp,$sp,32
+++
+++.section .fini
+++ ld $gp,16($sp)
+++ ld $ra,24($sp)
+++ j $ra
+++ daddu $sp,$sp,32
++--- a/include/sched.h
+++++ b/include/sched.h
++@@ -76,6 +76,7 @@ void free(void *);
++
++ typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
++ int __sched_cpucount(size_t, const cpu_set_t *);
+++int sched_getcpu(void);
++ int sched_getaffinity(pid_t, size_t, cpu_set_t *);
++ int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
++
++--- a/ldso/dynlink.c
+++++ b/ldso/dynlink.c
++@@ -1134,7 +1134,7 @@ static void do_mips_relocs(struct dso *p
++ Sym *sym = p->syms + j;
++ rel[0] = (unsigned char *)got - base;
++ for (i-=j; i; i--, sym++, rel[0]+=sizeof(size_t)) {
++- rel[1] = sym-p->syms << 8 | R_MIPS_JUMP_SLOT;
+++ rel[1] = R_INFO(sym-p->syms, R_MIPS_JUMP_SLOT);
++ do_relocs(p, rel, sizeof rel, 2);
++ }
++ }
++--- a/src/env/putenv.c
+++++ b/src/env/putenv.c
++@@ -30,6 +30,7 @@ int __putenv(char *s, int a)
++ }
++ } else {
++ free(__env_map[j]);
+++ __env_map[j] = s;
++ }
++ }
++ }
++--- /dev/null
+++++ b/src/fenv/mips64/fenv-sf.c
++@@ -0,0 +1,3 @@
+++#ifdef __mips_soft_float
+++#include "../fenv.c"
+++#endif
++--- /dev/null
+++++ b/src/fenv/mips64/fenv.S
++@@ -0,0 +1,71 @@
+++#ifndef __mips_soft_float
+++
+++.set noreorder
+++
+++.global feclearexcept
+++.type feclearexcept,@function
+++feclearexcept:
+++ and $4, $4, 0x7c
+++ cfc1 $5, $31
+++ or $5, $5, $4
+++ xor $5, $5, $4
+++ ctc1 $5, $31
+++ jr $ra
+++ li $2, 0
+++
+++.global feraiseexcept
+++.type feraiseexcept,@function
+++feraiseexcept:
+++ and $4, $4, 0x7c
+++ cfc1 $5, $31
+++ or $5, $5, $4
+++ ctc1 $5, $31
+++ jr $ra
+++ li $2, 0
+++
+++.global fetestexcept
+++.type fetestexcept,@function
+++fetestexcept:
+++ and $4, $4, 0x7c
+++ cfc1 $2, $31
+++ jr $ra
+++ and $2, $2, $4
+++
+++.global fegetround
+++.type fegetround,@function
+++fegetround:
+++ cfc1 $2, $31
+++ jr $ra
+++ andi $2, $2, 3
+++
+++.global __fesetround
+++.type __fesetround,@function
+++__fesetround:
+++ cfc1 $5, $31
+++ li $6, -4
+++ and $5, $5, $6
+++ or $5, $5, $4
+++ ctc1 $5, $31
+++ jr $ra
+++ li $2, 0
+++
+++.global fegetenv
+++.type fegetenv,@function
+++fegetenv:
+++ cfc1 $5, $31
+++ sw $5, 0($4)
+++ jr $ra
+++ li $2, 0
+++
+++.global fesetenv
+++.type fesetenv,@function
+++fesetenv:
+++ daddiu $5, $4, 1
+++ beq $5, $0, 1f
+++ nop
+++ lw $5, 0($4)
+++1: ctc1 $5, $31
+++ jr $ra
+++ li $2, 0
+++
+++#endif
++--- /dev/null
+++++ b/src/fenv/powerpc/fenv-sf.c
++@@ -0,0 +1,3 @@
+++#ifdef _SOFT_FLOAT
+++#include "../fenv.c"
+++#endif
++--- /dev/null
+++++ b/src/fenv/powerpc/fenv.S
++@@ -0,0 +1,129 @@
+++#ifndef _SOFT_FLOAT
+++.global feclearexcept
+++.type feclearexcept,@function
+++feclearexcept:
+++ andis. 3,3,0x3e00
+++ /* if (r3 & FE_INVALID) r3 |= all_invalid_flags */
+++ andis. 0,3,0x2000
+++ stwu 1,-16(1)
+++ beq- 0,1f
+++ oris 3,3,0x01f8
+++ ori 3,3,0x0700
+++1:
+++ /*
+++ * note: fpscr contains various fpu status and control
+++ * flags and we dont check if r3 may alter other flags
+++ * than the exception related ones
+++ * ufpscr &= ~r3
+++ */
+++ mffs 0
+++ stfd 0,8(1)
+++ lwz 9,12(1)
+++ andc 9,9,3
+++ stw 9,12(1)
+++ lfd 0,8(1)
+++ mtfsf 255,0
+++
+++ /* return 0 */
+++ li 3,0
+++ addi 1,1,16
+++ blr
+++
+++.global feraiseexcept
+++.type feraiseexcept,@function
+++feraiseexcept:
+++ andis. 3,3,0x3e00
+++ /* if (r3 & FE_INVALID) r3 |= software_invalid_flag */
+++ andis. 0,3,0x2000
+++ stwu 1,-16(1)
+++ beq- 0,1f
+++ ori 3,3,0x0400
+++1:
+++ /* fpscr |= r3 */
+++ mffs 0
+++ stfd 0,8(1)
+++ lwz 9,12(1)
+++ or 9,9,3
+++ stw 9,12(1)
+++ lfd 0,8(1)
+++ mtfsf 255,0
+++
+++ /* return 0 */
+++ li 3,0
+++ addi 1,1,16
+++ blr
+++
+++.global fetestexcept
+++.type fetestexcept,@function
+++fetestexcept:
+++ andis. 3,3,0x3e00
+++ /* return r3 & fpscr */
+++ stwu 1,-16(1)
+++ mffs 0
+++ stfd 0,8(1)
+++ lwz 9,12(1)
+++ addi 1,1,16
+++ and 3,3,9
+++ blr
+++
+++.global fegetround
+++.type fegetround,@function
+++fegetround:
+++ /* return fpscr & 3 */
+++ stwu 1,-16(1)
+++ mffs 0
+++ stfd 0,8(1)
+++ lwz 3,12(1)
+++ addi 1,1,16
+++ clrlwi 3,3,30
+++ blr
+++
+++.global __fesetround
+++.type __fesetround,@function
+++__fesetround:
+++ /*
+++ * note: invalid input is not checked, r3 < 4 must hold
+++ * fpscr = (fpscr & -4U) | r3
+++ */
+++ stwu 1,-16(1)
+++ mffs 0
+++ stfd 0,8(1)
+++ lwz 9,12(1)
+++ clrrwi 9,9,2
+++ or 9,9,3
+++ stw 9,12(1)
+++ lfd 0,8(1)
+++ mtfsf 255,0
+++
+++ /* return 0 */
+++ li 3,0
+++ addi 1,1,16
+++ blr
+++
+++.global fegetenv
+++.type fegetenv,@function
+++fegetenv:
+++ /* *r3 = fpscr */
+++ mffs 0
+++ stfd 0,0(3)
+++ /* return 0 */
+++ li 3,0
+++ blr
+++
+++.global fesetenv
+++.type fesetenv,@function
+++fesetenv:
+++ cmpwi 3, -1
+++ bne 1f
+++ mflr 4
+++ bl 2f
+++ .zero 8
+++2: mflr 3
+++ mtlr 4
+++1: /* fpscr = *r3 */
+++ lfd 0,0(3)
+++ mtfsf 255,0
+++ /* return 0 */
+++ li 3,0
+++ blr
+++#endif
++--- a/src/fenv/powerpc/fenv.s
+++++ /dev/null
++@@ -1,123 +0,0 @@
++-.global feclearexcept
++-.type feclearexcept,@function
++-feclearexcept:
++- andis. 3,3,0x3e00
++- # if (r3 & FE_INVALID) r3 |= all_invalid_flags
++- andis. 0,3,0x2000
++- stwu 1,-16(1)
++- beq- 0,1f
++- oris 3,3,0x01f8
++- ori 3,3,0x0700
++-1:
++- # note: fpscr contains various fpu status and control
++- # flags and we dont check if r3 may alter other flags
++- # than the exception related ones
++- # fpscr &= ~r3
++- mffs 0
++- stfd 0,8(1)
++- lwz 9,12(1)
++- andc 9,9,3
++- stw 9,12(1)
++- lfd 0,8(1)
++- mtfsf 255,0
++-
++- # return 0
++- li 3,0
++- addi 1,1,16
++- blr
++-
++-.global feraiseexcept
++-.type feraiseexcept,@function
++-feraiseexcept:
++- andis. 3,3,0x3e00
++- # if (r3 & FE_INVALID) r3 |= software_invalid_flag
++- andis. 0,3,0x2000
++- stwu 1,-16(1)
++- beq- 0,1f
++- ori 3,3,0x0400
++-1:
++- # fpscr |= r3
++- mffs 0
++- stfd 0,8(1)
++- lwz 9,12(1)
++- or 9,9,3
++- stw 9,12(1)
++- lfd 0,8(1)
++- mtfsf 255,0
++-
++- # return 0
++- li 3,0
++- addi 1,1,16
++- blr
++-
++-.global fetestexcept
++-.type fetestexcept,@function
++-fetestexcept:
++- andis. 3,3,0x3e00
++- # return r3 & fpscr
++- stwu 1,-16(1)
++- mffs 0
++- stfd 0,8(1)
++- lwz 9,12(1)
++- addi 1,1,16
++- and 3,3,9
++- blr
++-
++-.global fegetround
++-.type fegetround,@function
++-fegetround:
++- # return fpscr & 3
++- stwu 1,-16(1)
++- mffs 0
++- stfd 0,8(1)
++- lwz 3,12(1)
++- addi 1,1,16
++- clrlwi 3,3,30
++- blr
++-
++-.global __fesetround
++-.type __fesetround,@function
++-__fesetround:
++- # note: invalid input is not checked, r3 < 4 must hold
++- # fpscr = (fpscr & -4U) | r3
++- stwu 1,-16(1)
++- mffs 0
++- stfd 0,8(1)
++- lwz 9,12(1)
++- clrrwi 9,9,2
++- or 9,9,3
++- stw 9,12(1)
++- lfd 0,8(1)
++- mtfsf 255,0
++-
++- # return 0
++- li 3,0
++- addi 1,1,16
++- blr
++-
++-.global fegetenv
++-.type fegetenv,@function
++-fegetenv:
++- # *r3 = fpscr
++- mffs 0
++- stfd 0,0(3)
++- # return 0
++- li 3,0
++- blr
++-
++-.global fesetenv
++-.type fesetenv,@function
++-fesetenv:
++- cmpwi 3, -1
++- bne 1f
++- mflr 4
++- bl 2f
++- .zero 8
++-2: mflr 3
++- mtlr 4
++-1: # fpscr = *r3
++- lfd 0,0(3)
++- mtfsf 255,0
++- # return 0
++- li 3,0
++- blr
++--- a/src/internal/atomic.h
+++++ b/src/internal/atomic.h
++@@ -82,6 +82,23 @@ static inline int a_fetch_or(volatile in
++
++ #endif
++
+++#ifdef a_ll_p
+++
+++#ifndef a_cas_p
+++#define a_cas_p a_cas_p
+++static inline void *a_cas_p(volatile void *p, void *t, void *s)
+++{
+++ void *old;
+++ a_pre_llsc();
+++ do old = a_ll_p(p);
+++ while (old==t && !a_sc_p(p, s));
+++ a_post_llsc();
+++ return old;
+++}
+++#endif
+++
+++#endif
+++
++ #ifndef a_cas
++ #error missing definition of a_cas
++ #endif
++@@ -209,6 +226,7 @@ static inline void a_or_64(volatile uint
++ #endif
++
++ #ifndef a_cas_p
+++typedef char a_cas_p_undefined_but_pointer_not_32bit[-sizeof(char) == 0xffffffff ? 1 : -1];
++ #define a_cas_p a_cas_p
++ static inline void *a_cas_p(volatile void *p, void *t, void *s)
++ {
++--- a/src/internal/dynlink.h
+++++ b/src/internal/dynlink.h
++@@ -11,12 +11,14 @@ typedef Elf32_Phdr Phdr;
++ typedef Elf32_Sym Sym;
++ #define R_TYPE(x) ((x)&255)
++ #define R_SYM(x) ((x)>>8)
+++#define R_INFO ELF32_R_INFO
++ #else
++ typedef Elf64_Ehdr Ehdr;
++ typedef Elf64_Phdr Phdr;
++ typedef Elf64_Sym Sym;
++ #define R_TYPE(x) ((x)&0x7fffffff)
++ #define R_SYM(x) ((x)>>32)
+++#define R_INFO ELF64_R_INFO
++ #endif
++
++ /* These enum constants provide unmatchable default values for
++--- /dev/null
+++++ b/src/internal/mips64/syscall.s
++@@ -0,0 +1,19 @@
+++.set noreorder
+++.global __syscall
+++.hidden __syscall
+++.type __syscall,@function
+++__syscall:
+++ move $2, $4
+++ move $4, $5
+++ move $5, $6
+++ move $6, $7
+++ move $7, $8
+++ move $8, $9
+++ move $9, $10
+++ move $10, $11
+++ syscall
+++ beq $7, $0, 1f
+++ nop
+++ dsubu $2, $0, $2
+++1: jr $ra
+++ nop
++--- /dev/null
+++++ b/src/ldso/mips64/dlsym.s
++@@ -0,0 +1,17 @@
+++.set noreorder
+++.global dlsym
+++.hidden __dlsym
+++.type dlsym,@function
+++dlsym:
+++ lui $3, %hi(%neg(%gp_rel(dlsym)))
+++ daddiu $3, $3, %lo(%neg(%gp_rel(dlsym)))
+++ daddu $3, $3, $25
+++ move $6, $ra
+++ ld $25, %got_disp(__dlsym)($3)
+++ daddiu $sp, $sp, -32
+++ sd $ra, 24($sp)
+++ jalr $25
+++ nop
+++ ld $ra, 24($sp)
+++ jr $ra
+++ daddiu $sp, $sp, 32
++--- a/src/math/exp2f.c
+++++ b/src/math/exp2f.c
++@@ -91,6 +91,8 @@ float exp2f(float x)
++ /* Filter out exceptional cases. */
++ ix = u.i & 0x7fffffff;
++ if (ix > 0x42fc0000) { /* |x| > 126 */
+++ if (ix > 0x7f800000) /* NaN */
+++ return x;
++ if (u.i >= 0x43000000 && u.i < 0x80000000) { /* x >= 128 */
++ x *= 0x1p127f;
++ return x;
++--- a/src/math/expf.c
+++++ b/src/math/expf.c
++@@ -39,6 +39,8 @@ float expf(float x)
++
++ /* special cases */
++ if (hx >= 0x42aeac50) { /* if |x| >= -87.33655f or NaN */
+++ if (hx > 0x7f800000) /* NaN */
+++ return x;
++ if (hx >= 0x42b17218 && !sign) { /* x >= 88.722839f */
++ /* overflow */
++ x *= 0x1p127f;
++--- a/src/multibyte/wctob.c
+++++ b/src/multibyte/wctob.c
++@@ -1,4 +1,5 @@
++ #include <wchar.h>
+++#include <stdio.h>
++ #include <stdlib.h>
++ #include "internal.h"
++
++--- a/src/network/lookup_name.c
+++++ b/src/network/lookup_name.c
++@@ -49,7 +49,7 @@ static int name_from_hosts(struct addres
++ {
++ char line[512];
++ size_t l = strlen(name);
++- int cnt = 0;
+++ int cnt = 0, badfam = 0;
++ unsigned char _buf[1032];
++ FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
++ if (!f) switch (errno) {
++@@ -71,8 +71,16 @@ static int name_from_hosts(struct addres
++ /* Isolate IP address to parse */
++ for (p=line; *p && !isspace(*p); p++);
++ *p++ = 0;
++- if (name_from_numeric(buf+cnt, line, family))
+++ switch (name_from_numeric(buf+cnt, line, family)) {
+++ case 1:
++ cnt++;
+++ break;
+++ case 0:
+++ continue;
+++ default:
+++ badfam = EAI_NONAME;
+++ continue;
+++ }
++
++ /* Extract first name as canonical name */
++ for (; *p && isspace(*p); p++);
++@@ -81,7 +89,7 @@ static int name_from_hosts(struct addres
++ if (is_valid_hostname(p)) memcpy(canon, p, z-p+1);
++ }
++ __fclose_ca(f);
++- return cnt;
+++ return cnt ? cnt : badfam;
++ }
++
++ struct dpc_ctx {
++--- a/src/regex/regcomp.c
+++++ b/src/regex/regcomp.c
++@@ -889,7 +889,6 @@ static reg_errcode_t parse_atom(tre_pars
++ s++;
++ break;
++ case '*':
++- return REG_BADPAT;
++ case '{':
++ case '+':
++ case '?':
++@@ -978,9 +977,6 @@ static reg_errcode_t tre_parse(tre_parse
++ }
++
++ parse_iter:
++- /* extension: repetitions are rejected after an empty node
++- eg. (+), |*, {2}, but assertions are not treated as empty
++- so ^* or $? are accepted currently. */
++ for (;;) {
++ int min, max;
++
++@@ -998,6 +994,10 @@ static reg_errcode_t tre_parse(tre_parse
++ if (*s=='\\')
++ s++;
++
+++ /* handle ^* at the start of a complete BRE. */
+++ if (!ere && s==ctx->re+1 && s[-1]=='^')
+++ break;
+++
++ /* extension: multiple consecutive *+?{,} is unspecified,
++ but (a+)+ has to be supported so accepting a++ makes
++ sense, note however that the RE_DUP_MAX limit can be
++--- /dev/null
+++++ b/src/sched/sched_getcpu.c
++@@ -0,0 +1,44 @@
+++#define _GNU_SOURCE
+++#include <errno.h>
+++#include <sched.h>
+++#include "syscall.h"
+++#include "atomic.h"
+++
+++#ifdef VDSO_GETCPU_SYM
+++
+++void *__vdsosym(const char *, const char *);
+++
+++static void *volatile vdso_func;
+++
+++typedef long (*getcpu_f)(unsigned *, unsigned *, void *);
+++
+++static long getcpu_init(unsigned *cpu, unsigned *node, void *unused)
+++{
+++ void *p = __vdsosym(VDSO_GETCPU_VER, VDSO_GETCPU_SYM);
+++ getcpu_f f = (getcpu_f)p;
+++ a_cas_p(&vdso_func, (void *)getcpu_init, p);
+++ return f ? f(cpu, node, unused) : -ENOSYS;
+++}
+++
+++static void *volatile vdso_func = (void *)getcpu_init;
+++
+++#endif
+++
+++int sched_getcpu(void)
+++{
+++ int r;
+++ unsigned cpu;
+++
+++#ifdef VDSO_GETCPU_SYM
+++ getcpu_f f = (getcpu_f)vdso_func;
+++ if (f) {
+++ r = f(&cpu, 0, 0);
+++ if (!r) return cpu;
+++ if (r != -ENOSYS) return __syscall_ret(r);
+++ }
+++#endif
+++
+++ r = __syscall(SYS_getcpu, &cpu, 0, 0);
+++ if (!r) return cpu;
+++ return __syscall_ret(r);
+++}
++--- /dev/null
+++++ b/src/setjmp/mips64/longjmp.S
++@@ -0,0 +1,37 @@
+++.set noreorder
+++.global _longjmp
+++.global longjmp
+++.type _longjmp,@function
+++.type longjmp,@function
+++_longjmp:
+++longjmp:
+++ move $2, $5
+++
+++ bne $2, $0, 1f
+++ nop
+++ daddu $2, $2, 1
+++1:
+++#ifndef __mips_soft_float
+++ ldc1 $24, 96($4)
+++ ldc1 $25, 104($4)
+++ ldc1 $26, 112($4)
+++ ldc1 $27, 120($4)
+++ ldc1 $28, 128($4)
+++ ldc1 $29, 136($4)
+++ ldc1 $30, 144($4)
+++ ldc1 $31, 152($4)
+++#endif
+++ ld $ra, 0($4)
+++ ld $sp, 8($4)
+++ ld $gp, 16($4)
+++ ld $16, 24($4)
+++ ld $17, 32($4)
+++ ld $18, 40($4)
+++ ld $19, 48($4)
+++ ld $20, 56($4)
+++ ld $21, 64($4)
+++ ld $22, 72($4)
+++ ld $23, 80($4)
+++ ld $30, 88($4)
+++ jr $ra
+++ nop
++--- /dev/null
+++++ b/src/setjmp/mips64/setjmp.S
++@@ -0,0 +1,34 @@
+++.set noreorder
+++.global __setjmp
+++.global _setjmp
+++.global setjmp
+++.type __setjmp,@function
+++.type _setjmp,@function
+++.type setjmp,@function
+++__setjmp:
+++_setjmp:
+++setjmp:
+++ sd $ra, 0($4)
+++ sd $sp, 8($4)
+++ sd $gp, 16($4)
+++ sd $16, 24($4)
+++ sd $17, 32($4)
+++ sd $18, 40($4)
+++ sd $19, 48($4)
+++ sd $20, 56($4)
+++ sd $21, 64($4)
+++ sd $22, 72($4)
+++ sd $23, 80($4)
+++ sd $30, 88($4)
+++#ifndef __mips_soft_float
+++ sdc1 $24, 96($4)
+++ sdc1 $25, 104($4)
+++ sdc1 $26, 112($4)
+++ sdc1 $27, 120($4)
+++ sdc1 $28, 128($4)
+++ sdc1 $29, 136($4)
+++ sdc1 $30, 144($4)
+++ sdc1 $31, 152($4)
+++#endif
+++ jr $ra
+++ li $2, 0
++--- /dev/null
+++++ b/src/setjmp/powerpc/longjmp.S
++@@ -0,0 +1,69 @@
+++ .global _longjmp
+++ .global longjmp
+++ .type _longjmp,@function
+++ .type longjmp,@function
+++_longjmp:
+++longjmp:
+++ /*
+++ * void longjmp(jmp_buf env, int val);
+++ * put val into return register and restore the env saved in setjmp
+++ * if val(r4) is 0, put 1 there.
+++ */
+++ /* 0) move old return address into r0 */
+++ lwz 0, 0(3)
+++ /* 1) put it into link reg */
+++ mtlr 0
+++ /* 2 ) restore stack ptr */
+++ lwz 1, 4(3)
+++ /* 3) restore control reg */
+++ lwz 0, 8(3)
+++ mtcr 0
+++ /* 4) restore r14-r31 */
+++ lwz 14, 12(3)
+++ lwz 15, 16(3)
+++ lwz 16, 20(3)
+++ lwz 17, 24(3)
+++ lwz 18, 28(3)
+++ lwz 19, 32(3)
+++ lwz 20, 36(3)
+++ lwz 21, 40(3)
+++ lwz 22, 44(3)
+++ lwz 23, 48(3)
+++ lwz 24, 52(3)
+++ lwz 25, 56(3)
+++ lwz 26, 60(3)
+++ lwz 27, 64(3)
+++ lwz 28, 68(3)
+++ lwz 29, 72(3)
+++ lwz 30, 76(3)
+++ lwz 31, 80(3)
+++#ifndef _SOFT_FLOAT
+++ lfd 14,88(3)
+++ lfd 15,96(3)
+++ lfd 16,104(3)
+++ lfd 17,112(3)
+++ lfd 18,120(3)
+++ lfd 19,128(3)
+++ lfd 20,136(3)
+++ lfd 21,144(3)
+++ lfd 22,152(3)
+++ lfd 23,160(3)
+++ lfd 24,168(3)
+++ lfd 25,176(3)
+++ lfd 26,184(3)
+++ lfd 27,192(3)
+++ lfd 28,200(3)
+++ lfd 29,208(3)
+++ lfd 30,216(3)
+++ lfd 31,224(3)
+++#endif
+++ /* 5) put val into return reg r3 */
+++ mr 3, 4
+++
+++ /* 6) check if return value is 0, make it 1 in that case */
+++ cmpwi cr7, 4, 0
+++ bne cr7, 1f
+++ li 3, 1
+++1:
+++ blr
+++
++--- a/src/setjmp/powerpc/longjmp.s
+++++ /dev/null
++@@ -1,65 +0,0 @@
++- .global _longjmp
++- .global longjmp
++- .type _longjmp,@function
++- .type longjmp,@function
++-_longjmp:
++-longjmp:
++-# void longjmp(jmp_buf env, int val);
++-# put val into return register and restore the env saved in setjmp
++-# if val(r4) is 0, put 1 there.
++- # 0) move old return address into r0
++- lwz 0, 0(3)
++- # 1) put it into link reg
++- mtlr 0
++- #2 ) restore stack ptr
++- lwz 1, 4(3)
++- #3) restore control reg
++- lwz 0, 8(3)
++- mtcr 0
++- #4) restore r14-r31
++- lwz 14, 12(3)
++- lwz 15, 16(3)
++- lwz 16, 20(3)
++- lwz 17, 24(3)
++- lwz 18, 28(3)
++- lwz 19, 32(3)
++- lwz 20, 36(3)
++- lwz 21, 40(3)
++- lwz 22, 44(3)
++- lwz 23, 48(3)
++- lwz 24, 52(3)
++- lwz 25, 56(3)
++- lwz 26, 60(3)
++- lwz 27, 64(3)
++- lwz 28, 68(3)
++- lwz 29, 72(3)
++- lwz 30, 76(3)
++- lwz 31, 80(3)
++- lfd 14,88(3)
++- lfd 15,96(3)
++- lfd 16,104(3)
++- lfd 17,112(3)
++- lfd 18,120(3)
++- lfd 19,128(3)
++- lfd 20,136(3)
++- lfd 21,144(3)
++- lfd 22,152(3)
++- lfd 23,160(3)
++- lfd 24,168(3)
++- lfd 25,176(3)
++- lfd 26,184(3)
++- lfd 27,192(3)
++- lfd 28,200(3)
++- lfd 29,208(3)
++- lfd 30,216(3)
++- lfd 31,224(3)
++- #5) put val into return reg r3
++- mr 3, 4
++-
++- #6) check if return value is 0, make it 1 in that case
++- cmpwi cr7, 4, 0
++- bne cr7, 1f
++- li 3, 1
++-1:
++- blr
++-
++--- /dev/null
+++++ b/src/setjmp/powerpc/setjmp.S
++@@ -0,0 +1,63 @@
+++ .global ___setjmp
+++ .hidden ___setjmp
+++ .global __setjmp
+++ .global _setjmp
+++ .global setjmp
+++ .type __setjmp,@function
+++ .type _setjmp,@function
+++ .type setjmp,@function
+++___setjmp:
+++__setjmp:
+++_setjmp:
+++setjmp:
+++ /* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
+++ mflr 0
+++ stw 0, 0(3)
+++ /* 1) store reg1 (SP) */
+++ stw 1, 4(3)
+++ /* 2) store cr */
+++ mfcr 0
+++ stw 0, 8(3)
+++ /* 3) store r14-31 */
+++ stw 14, 12(3)
+++ stw 15, 16(3)
+++ stw 16, 20(3)
+++ stw 17, 24(3)
+++ stw 18, 28(3)
+++ stw 19, 32(3)
+++ stw 20, 36(3)
+++ stw 21, 40(3)
+++ stw 22, 44(3)
+++ stw 23, 48(3)
+++ stw 24, 52(3)
+++ stw 25, 56(3)
+++ stw 26, 60(3)
+++ stw 27, 64(3)
+++ stw 28, 68(3)
+++ stw 29, 72(3)
+++ stw 30, 76(3)
+++ stw 31, 80(3)
+++#ifndef _SOFT_FLOAT
+++ stfd 14,88(3)
+++ stfd 15,96(3)
+++ stfd 16,104(3)
+++ stfd 17,112(3)
+++ stfd 18,120(3)
+++ stfd 19,128(3)
+++ stfd 20,136(3)
+++ stfd 21,144(3)
+++ stfd 22,152(3)
+++ stfd 23,160(3)
+++ stfd 24,168(3)
+++ stfd 25,176(3)
+++ stfd 26,184(3)
+++ stfd 27,192(3)
+++ stfd 28,200(3)
+++ stfd 29,208(3)
+++ stfd 30,216(3)
+++ stfd 31,224(3)
+++#endif
+++ /* 4) set return value to 0 */
+++ li 3, 0
+++ /* 5) return */
+++ blr
++--- a/src/setjmp/powerpc/setjmp.s
+++++ /dev/null
++@@ -1,61 +0,0 @@
++- .global ___setjmp
++- .hidden ___setjmp
++- .global __setjmp
++- .global _setjmp
++- .global setjmp
++- .type __setjmp,@function
++- .type _setjmp,@function
++- .type setjmp,@function
++-___setjmp:
++-__setjmp:
++-_setjmp:
++-setjmp:
++- # 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg)
++- mflr 0
++- stw 0, 0(3)
++- # 1) store reg1 (SP)
++- stw 1, 4(3)
++- # 2) store cr
++- mfcr 0
++- stw 0, 8(3)
++- # 3) store r14-31
++- stw 14, 12(3)
++- stw 15, 16(3)
++- stw 16, 20(3)
++- stw 17, 24(3)
++- stw 18, 28(3)
++- stw 19, 32(3)
++- stw 20, 36(3)
++- stw 21, 40(3)
++- stw 22, 44(3)
++- stw 23, 48(3)
++- stw 24, 52(3)
++- stw 25, 56(3)
++- stw 26, 60(3)
++- stw 27, 64(3)
++- stw 28, 68(3)
++- stw 29, 72(3)
++- stw 30, 76(3)
++- stw 31, 80(3)
++- stfd 14,88(3)
++- stfd 15,96(3)
++- stfd 16,104(3)
++- stfd 17,112(3)
++- stfd 18,120(3)
++- stfd 19,128(3)
++- stfd 20,136(3)
++- stfd 21,144(3)
++- stfd 22,152(3)
++- stfd 23,160(3)
++- stfd 24,168(3)
++- stfd 25,176(3)
++- stfd 26,184(3)
++- stfd 27,192(3)
++- stfd 28,200(3)
++- stfd 29,208(3)
++- stfd 30,216(3)
++- stfd 31,224(3)
++- # 4) set return value to 0
++- li 3, 0
++- # 5) return
++- blr
++--- /dev/null
+++++ b/src/signal/mips64/restore.s
++@@ -0,0 +1,9 @@
+++.set noreorder
+++.global __restore_rt
+++.global __restore
+++.type __restore_rt,@function
+++.type __restore,@function
+++__restore_rt:
+++__restore:
+++ li $2,5211
+++ syscall
++--- /dev/null
+++++ b/src/signal/mips64/sigsetjmp.s
++@@ -0,0 +1,38 @@
+++.set noreorder
+++.global sigsetjmp
+++.global __sigsetjmp
+++.type sigsetjmp,@function
+++.type __sigsetjmp,@function
+++sigsetjmp:
+++__sigsetjmp:
+++ lui $3, %hi(%neg(%gp_rel(sigsetjmp)))
+++ daddiu $3, $3, %lo(%neg(%gp_rel(sigsetjmp)))
+++
+++ # comparing save mask with 0, if equals to 0 then
+++ # sigsetjmp is equal to setjmp.
+++ beq $5, $0, 1f
+++ daddu $3, $3, $25
+++ sd $ra, 160($4)
+++ sd $16, 168($4)
+++
+++ # save base of got so that we can use it later
+++ # once we return from 'longjmp'
+++ sd $3, 176($4)
+++ ld $25, %got_disp(setjmp)($3)
+++ jalr $25
+++ move $16, $4
+++
+++ move $5, $2 # Return from 'setjmp' or 'longjmp'
+++ move $4, $16 # Restore the pointer-to-sigjmp_buf
+++ ld $ra, 160($4) # Restore ra of sigsetjmp
+++ ld $16, 168($4) # Restore $16 of sigsetjmp
+++ ld $3, 176($4) # Restore base of got
+++
+++.hidden __sigsetjmp_tail
+++ ld $25, %got_disp(__sigsetjmp_tail)($3)
+++ jr $25
+++ nop
+++1:
+++ ld $25, %got_disp(setjmp)($3)
+++ jr $25
+++ nop
++--- /dev/null
+++++ b/src/thread/mips64/__unmapself.s
++@@ -0,0 +1,9 @@
+++.set noreorder
+++.global __unmapself
+++.type __unmapself, @function
+++__unmapself:
+++ li $2, 5011
+++ syscall
+++ li $4, 0
+++ li $2, 5058
+++ syscall
++--- /dev/null
+++++ b/src/thread/mips64/clone.s
++@@ -0,0 +1,30 @@
+++.set noreorder
+++.global __clone
+++.type __clone,@function
+++__clone:
+++ # Save function pointer and argument pointer on new thread stack
+++ and $5, $5, -16 # aligning stack to double word
+++ dsubu $5, $5, 16
+++ sd $4, 0($5) # save function pointer
+++ sd $7, 8($5) # save argument pointer
+++
+++ # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
+++ # sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
+++ move $4, $6
+++ move $6, $8
+++ move $7, $9
+++ move $8, $10
+++ li $2, 5055
+++ syscall
+++ beq $7, $0, 1f
+++ nop
+++ jr $ra
+++ dsubu $2, $0, $2
+++1: beq $2, $0, 1f
+++ nop
+++ jr $ra
+++ nop
+++1: ld $25, 0($sp) # function pointer
+++ ld $4, 8($sp) # argument pointer
+++ jr $25 # call the user's function
+++ nop
++--- /dev/null
+++++ b/src/thread/mips64/syscall_cp.s
++@@ -0,0 +1,52 @@
+++.set noreorder
+++.global __cp_begin
+++.hidden __cp_begin
+++.type __cp_begin,@function
+++.global __cp_end
+++.hidden __cp_end
+++.type __cp_end,@function
+++.global __cp_cancel
+++.hidden __cp_cancel
+++.type __cp_cancel,@function
+++.global __cp_cancel_data
+++.hidden __cp_cancel_data
+++.type __cp_cancel_data,@function
+++.hidden __cancel
+++.global __syscall_cp_asm
+++.hidden __syscall_cp_asm
+++.type __syscall_cp_asm,@function
+++__syscall_cp_asm:
+++__cp_begin:
+++ lw $4, 0($4)
+++ bne $4, $0, __cp_cancel
+++ move $2, $5
+++ move $4, $6
+++ move $5, $7
+++ move $6, $8
+++ move $7, $9
+++ move $8, $10
+++ move $9, $11
+++ ld $10, 0($sp)
+++ syscall
+++__cp_end:
+++ beq $7, $0, 1f
+++ nop
+++ dsubu $2, $0, $2
+++1: jr $ra
+++ nop
+++
+++ # if cancellation flag is 1 then call __cancel
+++__cp_cancel:
+++ move $2, $ra
+++.align 8
+++ bal 1f
+++ nop
+++__cp_cancel_data:
+++ .gpdword __cp_cancel_data
+++ .gpdword __cancel
+++1: ld $3, ($ra)
+++ dsubu $3, $ra, $3
+++ ld $25, 8($ra)
+++ daddu $25, $25, $3
+++ jr $25
+++ move $ra, $2
++--- /dev/null
+++++ b/src/unistd/mips64/pipe.s
++@@ -0,0 +1,19 @@
+++.set noreorder
+++.global pipe
+++.type pipe,@function
+++pipe:
+++ lui $3, %hi(%neg(%gp_rel(pipe)))
+++ daddiu $3, $3, %lo(%neg(%gp_rel(pipe)))
+++ daddu $3, $3, $25
+++ li $2, 5021
+++ syscall
+++ beq $7, $0, 1f
+++ nop
+++ ld $25, %got_disp(__syscall_ret)($3)
+++ jr $25
+++ dsubu $4, $0, $2
+++1: sw $2, 0($4)
+++ sw $3, 4($4)
+++ move $2, $0
+++ jr $ra
+++ nop
--- /dev/null
--- /dev/null
++From e6683d001a95d7c3d4d992496f00f77e01fcd268 Mon Sep 17 00:00:00 2001
++From: Hauke Mehrtens <hauke@hauke-m.de>
++Date: Sun, 22 Nov 2015 15:04:23 +0100
++Subject: [PATCH v2] Add format attribute to some function declarations
++
++GCC and Clang are able to check the format arguments given to a
++function and warn the user if there is a error in the format arguments
++or if there is a potential uncontrolled format string security problem
++in the code. GCC does this automatically for some functions like
++printf(), but it is also possible to annotate other functions in a way
++that it will check them too. This feature is used by glibc for many
++functions. This patch adds the attribute to the some functions of musl
++expect for these functions where gcc automatically adds it.
++
++GCC automatically adds checks for these functions: printf, fprintf,
++sprintf, scanf, fscanf, sscanf, strftime, vprintf, vfprintf and
++vsprintf.
++
++The documentation from gcc is here:
++https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
++
++The documentation from Clang is here:
++http://clang.llvm.org/docs/AttributeReference.html#format-gnu-format
++
++Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
++---
++ include/err.h | 26 +++++++++++++++++---------
++ include/monetary.h | 12 ++++++++++--
++ include/stdio.h | 29 ++++++++++++++++++++---------
++ include/syslog.h | 12 ++++++++++--
++ 4 files changed, 57 insertions(+), 22 deletions(-)
++
++--- a/include/err.h
+++++ b/include/err.h
++@@ -8,15 +8,23 @@
++ extern "C" {
++ #endif
++
++-void warn(const char *, ...);
++-void vwarn(const char *, va_list);
++-void warnx(const char *, ...);
++-void vwarnx(const char *, va_list);
+++#if __GNUC__ >= 3
+++#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
+++#else
+++#define __fp(x, y)
+++#endif
++
++-_Noreturn void err(int, const char *, ...);
++-_Noreturn void verr(int, const char *, va_list);
++-_Noreturn void errx(int, const char *, ...);
++-_Noreturn void verrx(int, const char *, va_list);
+++void warn(const char *, ...) __fp(1, 2);
+++void vwarn(const char *, va_list) __fp(1, 0);
+++void warnx(const char *, ...) __fp(1, 2);
+++void vwarnx(const char *, va_list) __fp(1, 0);
+++
+++_Noreturn void err(int, const char *, ...) __fp(2, 3);
+++_Noreturn void verr(int, const char *, va_list) __fp(2, 0);
+++_Noreturn void errx(int, const char *, ...) __fp(2, 3);
+++_Noreturn void verrx(int, const char *, va_list) __fp(2, 0);
+++
+++#undef __fp
++
++ #ifdef __cplusplus
++ }
++--- a/include/monetary.h
+++++ b/include/monetary.h
++@@ -13,8 +13,16 @@ extern "C" {
++
++ #include <bits/alltypes.h>
++
++-ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
++-ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
+++#if __GNUC__ >= 3
+++#define __fsfm(x, y) __attribute__ ((__format__ (__strfmon__, x, y)))
+++#else
+++#define __fsfm(x, y)
+++#endif
+++
+++ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...) __fsfm(3, 4);
+++ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...) __fsfm(4, 5);
+++
+++#undef __fsfm
++
++ #ifdef __cplusplus
++ }
++--- a/include/stdio.h
+++++ b/include/stdio.h
++@@ -21,6 +21,14 @@ extern "C" {
++
++ #include <bits/alltypes.h>
++
+++#if __GNUC__ >= 3
+++#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
+++#define __fs(x, y) __attribute__ ((__format__ (__scanf__, x, y)))
+++#else
+++#define __fp(x, y)
+++#define __fs(x, y)
+++#endif
+++
++ #ifdef __cplusplus
++ #define NULL 0L
++ #else
++@@ -102,19 +110,19 @@ int puts(const char *);
++ int printf(const char *__restrict, ...);
++ int fprintf(FILE *__restrict, const char *__restrict, ...);
++ int sprintf(char *__restrict, const char *__restrict, ...);
++-int snprintf(char *__restrict, size_t, const char *__restrict, ...);
+++int snprintf(char *__restrict, size_t, const char *__restrict, ...) __fp(3, 4);
++
++ int vprintf(const char *__restrict, __isoc_va_list);
++ int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
++ int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
++-int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
+++int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list) __fp(3, 0);
++
++ int scanf(const char *__restrict, ...);
++ int fscanf(FILE *__restrict, const char *__restrict, ...);
++ int sscanf(const char *__restrict, const char *__restrict, ...);
++-int vscanf(const char *__restrict, __isoc_va_list);
++-int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
++-int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
+++int vscanf(const char *__restrict, __isoc_va_list) __fs(1, 0);
+++int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0);
+++int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0);
++
++ void perror(const char *);
++
++@@ -135,8 +143,8 @@ int pclose(FILE *);
++ int fileno(FILE *);
++ int fseeko(FILE *, off_t, int);
++ off_t ftello(FILE *);
++-int dprintf(int, const char *__restrict, ...);
++-int vdprintf(int, const char *__restrict, __isoc_va_list);
+++int dprintf(int, const char *__restrict, ...) __fp(2, 3);
+++int vdprintf(int, const char *__restrict, __isoc_va_list) __fp(2, 0);
++ void flockfile(FILE *);
++ int ftrylockfile(FILE *);
++ void funlockfile(FILE *);
++@@ -175,8 +183,8 @@ int fileno_unlocked(FILE *);
++ int getw(FILE *);
++ int putw(int, FILE *);
++ char *fgetln(FILE *, size_t *);
++-int asprintf(char **, const char *, ...);
++-int vasprintf(char **, const char *, __isoc_va_list);
+++int asprintf(char **, const char *, ...) __fp(2, 3);
+++int vasprintf(char **, const char *, __isoc_va_list) __fp(2, 0);
++ #endif
++
++ #ifdef _GNU_SOURCE
++@@ -184,6 +192,9 @@ char *fgets_unlocked(char *, int, FILE *
++ int fputs_unlocked(const char *, FILE *);
++ #endif
++
+++#undef __fp
+++#undef __fs
+++
++ #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
++ #define tmpfile64 tmpfile
++ #define fopen64 fopen
++--- a/include/syslog.h
+++++ b/include/syslog.h
++@@ -56,16 +56,22 @@ extern "C" {
++ #define LOG_NOWAIT 0x10
++ #define LOG_PERROR 0x20
++
+++#if __GNUC__ >= 3
+++#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
+++#else
+++#define __fp(x, y)
+++#endif
+++
++ void closelog (void);
++ void openlog (const char *, int, int);
++ int setlogmask (int);
++-void syslog (int, const char *, ...);
+++void syslog (int, const char *, ...) __fp(2, 3);
++
++ #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
++ #define _PATH_LOG "/dev/log"
++ #define __NEED_va_list
++ #include <bits/alltypes.h>
++-void vsyslog (int, const char *, va_list);
+++void vsyslog (int, const char *, va_list) __fp(2, 0);
++ #if defined(SYSLOG_NAMES)
++ #define INTERNAL_NOPRI 0x10
++ #define INTERNAL_MARK (LOG_NFACILITIES<<3)
++@@ -93,6 +99,8 @@ typedef struct {
++ #endif
++ #endif
++
+++#undef __fp
+++
++ #ifdef __cplusplus
++ }
++ #endif
--- /dev/null
--- /dev/null
++--- a/src/time/__tz.c
+++++ b/src/time/__tz.c
++@@ -23,6 +23,9 @@ static int r0[5], r1[5];
++ static const unsigned char *zi, *trans, *index, *types, *abbrevs, *abbrevs_end;
++ static size_t map_size;
++
+++static const char *tzfile;
+++static size_t tzfile_size;
+++
++ static char old_tz_buf[32];
++ static char *old_tz = old_tz_buf;
++ static size_t old_tz_size = sizeof old_tz_buf;
++@@ -125,6 +128,15 @@ static void do_tzset()
++ "/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
++
++ s = getenv("TZ");
+++
+++ /* if TZ is empty try to read it from /etc/TZ */
+++ if (!s || !*s) {
+++ if (tzfile)
+++ __munmap((void*)tzfile, tzfile_size);
+++
+++ s = tzfile = (void *)__map_file("/etc/TZ", &tzfile_size);
+++ }
+++
++ if (!s) s = "/etc/localtime";
++ if (!*s) s = __gmt;
++
--- /dev/null
--- /dev/null
++From 7ec87fbbc3cac99b4173d082dd6195f47c9a32e7 Mon Sep 17 00:00:00 2001
++From: Steven Barth <steven@midlink.org>
++Date: Mon, 22 Jun 2015 11:01:56 +0200
++Subject: [PATCH] Add libssp_nonshared.a so GCC's is not needed
++
++Signed-off-by: Steven Barth <steven@midlink.org>
++---
++ Makefile | 10 ++++++++--
++ libssp_nonshared/__stack_chk_fail_local.c | 2 ++
++ 2 files changed, 10 insertions(+), 2 deletions(-)
++ create mode 100644 libssp_nonshared/__stack_chk_fail_local.c
++
++--- a/Makefile
+++++ b/Makefile
++@@ -66,7 +66,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C
++ STATIC_LIBS = lib/libc.a
++ SHARED_LIBS = lib/libc.so
++ TOOL_LIBS = lib/musl-gcc.specs
++-ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
+++ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a
++ ALL_TOOLS = obj/musl-gcc
++
++ WRAPCC_GCC = gcc
++@@ -125,7 +125,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
++ src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
++ src/string/memset.c src/string/$(ARCH)/memset.c \
++ src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
++- ldso/dlstart.c ldso/dynlink.c
+++ ldso/dlstart.c ldso/dynlink.c \
+++ src/libssp_nonshared/__stack_chk_fail_local.c
++ $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
++
++ $(CRT_OBJS): CFLAGS_ALL += -DCRT
++@@ -168,6 +169,11 @@ lib/libc.a: $(AOBJS)
++ $(AR) rc $@ $(AOBJS)
++ $(RANLIB) $@
++
+++lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
+++ rm -f $@
+++ $(AR) rc $@ $<
+++ $(RANLIB) $@
+++
++ $(EMPTY_LIBS):
++ rm -f $@
++ $(AR) rc $@
++--- /dev/null
+++++ b/src/libssp_nonshared/__stack_chk_fail_local.c
++@@ -0,0 +1,2 @@
+++#include "atomic.h"
+++void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }
--- /dev/null
--- /dev/null
++--- a/Makefile
+++++ b/Makefile
++@@ -217,7 +217,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
++ $(INSTALL) -D -m 644 $< $@
++
++ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
++- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
+++ $(INSTALL) -D -l libc.so $@ || true
++
++ install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
++
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
--@@ -38,6 +38,7 @@ static const unsigned char charmaps[] =
++@@ -39,6 +39,7 @@ static const unsigned char charmaps[] =
"ucs4\0ucs4be\0utf32\0utf32be\0\0\300"
"ucs4le\0utf32le\0\0\303"
"ascii\0usascii\0iso646\0iso646us\0\0\307"
"eucjp\0\0\320"
"shiftjis\0sjis\0\0\321"
"gb18030\0\0\330"
--@@ -45,6 +46,7 @@ static const unsigned char charmaps[] =
++@@ -46,6 +47,7 @@ static const unsigned char charmaps[] =
"gb2312\0\0\332"
"big5\0bigfive\0cp950\0big5hkscs\0\0\340"
"euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
#include "codepages.h"
;
--@@ -52,6 +54,7 @@ static const unsigned short legacy_chars
++@@ -53,6 +55,7 @@ static const unsigned short legacy_chars
#include "legacychars.h"
};
static const unsigned short jis0208[84][94] = {
#include "jis0208.h"
};
--@@ -71,6 +74,7 @@ static const unsigned short hkscs[] = {
++@@ -72,6 +75,7 @@ static const unsigned short hkscs[] = {
static const unsigned short ksc[93][94] = {
#include "ksc.h"
};
static int fuzzycmp(const unsigned char *a, const unsigned char *b)
{
--@@ -212,6 +216,7 @@ size_t iconv(iconv_t cd0, char **restric
++@@ -216,6 +220,7 @@ size_t iconv(iconv_t cd0, char **restric
c = ((c-0xd7c0)<<10) + (d-0xdc00);
}
break;
case SHIFT_JIS:
if (c-0xa1 <= 0xdf-0xa1) {
c += 0xff61-0xa1;
--@@ -358,6 +363,7 @@ size_t iconv(iconv_t cd0, char **restric
++@@ -362,6 +367,7 @@ size_t iconv(iconv_t cd0, char **restric
c = ksc[c][d];
if (!c) goto ilseq;
break;
--- /dev/null
--- /dev/null
++--- a/src/crypt/crypt_r.c
+++++ b/src/crypt/crypt_r.c
++@@ -19,12 +19,6 @@ char *__crypt_r(const char *key, const c
++ if (salt[0] == '$' && salt[1] && salt[2]) {
++ if (salt[1] == '1' && salt[2] == '$')
++ return __crypt_md5(key, salt, output);
++- if (salt[1] == '2' && salt[3] == '$')
++- return __crypt_blowfish(key, salt, output);
++- if (salt[1] == '5' && salt[2] == '$')
++- return __crypt_sha256(key, salt, output);
++- if (salt[1] == '6' && salt[2] == '$')
++- return __crypt_sha512(key, salt, output);
++ }
++ return __crypt_des(key, salt, output);
++ }
++--- a/src/crypt/crypt_sha512.c
+++++ b/src/crypt/crypt_sha512.c
++@@ -12,6 +12,7 @@
++ #include <stdio.h>
++ #include <string.h>
++ #include <stdint.h>
+++#if 0
++
++ /* public domain sha512 implementation based on fips180-3 */
++ /* >=2^64 bits messages are not supported (about 2000 peta bytes) */
++@@ -369,3 +370,4 @@ char *__crypt_sha512(const char *key, co
++ return "*";
++ return p;
++ }
+++#endif
++--- a/src/crypt/crypt_blowfish.c
+++++ b/src/crypt/crypt_blowfish.c
++@@ -50,6 +50,7 @@
++ #include <string.h>
++ #include <stdint.h>
++
+++#if 0
++ typedef uint32_t BF_word;
++ typedef int32_t BF_word_signed;
++
++@@ -796,3 +797,4 @@ char *__crypt_blowfish(const char *key,
++
++ return "*";
++ }
+++#endif
++--- a/src/crypt/crypt_sha256.c
+++++ b/src/crypt/crypt_sha256.c
++@@ -13,6 +13,7 @@
++ #include <string.h>
++ #include <stdint.h>
++
+++#if 0
++ /* public domain sha256 implementation based on fips180-3 */
++
++ struct sha256 {
++@@ -320,3 +321,4 @@ char *__crypt_sha256(const char *key, co
++ return "*";
++ return p;
++ }
+++#endif
--# Choose uclibc version.
--
--choice
-- prompt "uClibc Version"
-- depends on TOOLCHAINOPTS && USE_UCLIBC
-- default UCLIBC_USE_VERSION_0_9_33
-- help
-- Select the version of uClibc you wish to use.
--
-- config UCLIBC_USE_VERSION_0_9_33
-- select UCLIBC_VERSION_0_9_33
-- bool "uClibc 0.9.33.2"
--
--endchoice
--
# Debug version.
config UCLIBC_ENABLE_DEBUG
config UCLIBC_VERSION
string
depends on USE_UCLIBC
-- default "0.9.33.2" if UCLIBC_VERSION_0_9_33
-- default "0.9.33.2"
++ default "1.0.9"
--config UCLIBC_VERSION_0_9_33
-- default y if !TOOLCHAINOPTS && USE_UCLIBC
++config UCLIBC_VERSION_NG
bool
++ depends on USE_UCLIBC
++ default y
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/target.mk
--PKG_NAME:=uClibc
PKG_VERSION:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
--PKG_SOURCE_URL:=http://www.uclibc.org/downloads
--PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
++
++PKG_NAME:=uClibc-ng
++PKG_SOURCE_URL = http://downloads.uclibc-ng.org/releases/$(PKG_VERSION)/
++PATCH_DIR:=$(PATH_PREFIX)/patches
++CONFIG_DIR:=$(PATH_PREFIX)/config
++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
LIBC_SO_VERSION:=$(PKG_VERSION)
--PATCH_DIR:=$(PATH_PREFIX)/patches-$(PKG_VERSION)
--CONFIG_DIR:=$(PATH_PREFIX)/config-$(PKG_VERSION)
--PKG_MD5SUM_0.9.33.2 = a338aaffc56f0f5040e6d9fa8a12eda1
--PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
++PKG_MD5SUM=64bbe13301ffa6ba30c5c1ddec335583
HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/toolchain-build.mk
UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
++ -e 's/arc.*/arc/' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
$(if $(CONFIG_UCLIBC_ENABLE_DEBUG),$(if $(wildcard $(CONFIG_DIR)/debug),'+' $(CONFIG_DIR)/debug)) \
$(CONFIG_DIR)/$(ARCH)$(strip \
$(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD), \
++ $(if $(filter archs,$(subst ",,$(CONFIG_CPU_TYPE))),hs, \
$(if $(CONFIG_MIPS64_ABI),.$(subst ",,$(CONFIG_MIPS64_ABI)), \
-- $(if $(CONFIG_HAS_SPE_FPU),$(if $(wildcard $(CONFIG_DIR)/$(ARCH).e500),.e500)))))
++ $(if $(CONFIG_HAS_SPE_FPU),$(if $(wildcard $(CONFIG_DIR)/$(ARCH).e500),.e500))))))
CPU_CFLAGS = \
-funsigned-char -fno-builtin -fno-asm \
-e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
-e 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=$(if $(CONFIG_BUILD_NLS),y,n),g' \
-e 's,^.*UCLIBC_BUILD_ALL_LOCALE.*,UCLIBC_BUILD_ALL_LOCALE=$(if $(CONFIG_BUILD_NLS),y,n),g' \
-- -e 's,^.*UCLIBC_HAS_SSP.*,UCLIBC_HAS_SSP=$(if $(or $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),$(CONFIG_PKG_CC_STACKPROTECTOR_STRONG)),y,n),g' \
++ -e 's,^.*UCLIBC_HAS_SSP[^_].*,UCLIBC_HAS_SSP=$(if $(or $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),$(CONFIG_PKG_CC_STACKPROTECTOR_STRONG)),y,n),g' \
$(HOST_BUILD_DIR)/.config.new
cmp -s $(HOST_BUILD_DIR)/.config.new $(HOST_BUILD_DIR)/.config.last || { \
cp $(HOST_BUILD_DIR)/.config.new $(HOST_BUILD_DIR)/.config && \
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# COMPILE_IN_THUMB_MODE is not set
--TARGET_ARCH="arm"
--TARGET_arm=y
--# USE_BX is not set
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_WANTS_BIG_ENDIAN=y
--# COMPILE_IN_THUMB_MODE is not set
--TARGET_ARCH="arm"
--TARGET_arm=y
--# USE_BX is not set
+++ /dev/null
--# ARCH_ANY_ENDIAN is not set
--ARCH_HAS_MMU=y
--# ARCH_HAS_NO_LDSO is not set
--# ARCH_HAS_NO_SHARED is not set
--# ARCH_LITTLE_ENDIAN is not set
--ARCH_USE_MMU=y
--# ARCH_WANTS_BIG_ENDIAN is not set
--# ARCH_WANTS_LITTLE_ENDIAN is not set
--ASSUME_DEVPTS=y
--# COMPAT_ATEXIT is not set
--CROSS_COMPILER_PREFIX=""
--DEVEL_PREFIX="/usr/"
--# DOASSERTS is not set
--# DODEBUG is not set
--# DODEBUG_PT is not set
--# DOMULTI is not set
--DOPIC=y
--DOSTRIP=y
--DO_C99_MATH=y
--# DO_XSI_MATH is not set
--# EXTRA_WARNINGS is not set
--FORCE_OPTIONS_FOR_ARCH=y
--# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
--# HARDWIRED_ABSPATH is not set
--# HAS_NO_THREADS is not set
--HAVE_DOT_CONFIG=y
--# HAVE_NO_PIC is not set
--# HAVE_NO_SSP is not set
--HAVE_SHARED=y
--KERNEL_HEADERS="."
--LDSO_BASE_FILENAME="ld.so"
--LDSO_CACHE_SUPPORT=y
--# LDSO_GNU_HASH_SUPPORT is not set
--LDSO_LD_LIBRARY_PATH=y
--LDSO_LDD_SUPPORT=y
--# LDSO_NO_CLEANUP is not set
--# LDSO_PRELINK_SUPPORT is not set
--# LDSO_PRELOAD_FILE_SUPPORT is not set
--LDSO_PRELOAD_ENV_SUPPORT=y
--LDSO_RUNPATH=y
--# LDSO_SEARCH_INTERP_PATH is not set
--# LDSO_STANDALONE_SUPPORT is not set
--# LINUXTHREADS_NEW is not set
--# LINUXTHREADS_OLD is not set
--# UCLIBC_HAS_BACKTRACE is not set
--UCLIBC_HAS_THREADS_NATIVE=y
--# MALLOC is not set
--MALLOC_GLIBC_COMPAT=y
--# MALLOC_SIMPLE is not set
--MALLOC_STANDARD=y
--MULTILIB_DIR="lib"
--PTHREADS_DEBUG_SUPPORT=y
--RUNTIME_PREFIX="/"
--# SUPPORT_LD_DEBUG is not set
--# SUPPORT_LD_DEBUG_EARLY is not set
--TARGET_SUBARCH=""
--# TARGET_alpha is not set
--# TARGET_arm is not set
--# TARGET_avr32 is not set
--# TARGET_bfin is not set
--# TARGET_c6x is not set
--# TARGET_cris is not set
--# TARGET_e1 is not set
--# TARGET_frv is not set
--# TARGET_h8300 is not set
--# TARGET_hppa is not set
--# TARGET_i386 is not set
--# TARGET_i960 is not set
--# TARGET_ia64 is not set
--# TARGET_m68k is not set
--# TARGET_microblaze is not set
--# TARGET_mips is not set
--# TARGET_nios is not set
--# TARGET_nios2 is not set
--# TARGET_powerpc is not set
--# TARGET_sh is not set
--# TARGET_sh64 is not set
--# TARGET_sparc is not set
--# TARGET_v850 is not set
--# TARGET_vax is not set
--# TARGET_x86_64 is not set
--# TARGET_xtensa is not set
--UCLIBC_BSD_SPECIFIC=y
--UCLIBC_BUILD_NOEXECSTACK=y
--# UCLIBC_BUILD_NOW is not set
--# UCLIBC_BUILD_PIE is not set
--UCLIBC_BUILD_RELRO=y
--UCLIBC_CTOR_DTOR=y
--UCLIBC_DYNAMIC_ATEXIT=y
--UCLIBC_EXTRA_CFLAGS=""
--UCLIBC_GRP_BUFFER_SIZE=256
--UCLIBC_HAS_ADVANCED_REALTIME=y
--# UCLIBC_HAS_ARC4RANDOM is not set
--UCLIBC_HAS_BSD_ERR=y
--UCLIBC_HAS_BSD_RES_CLOSE=y
--# UCLIBC_HAS_COMPAT_RES_STATE is not set
--UCLIBC_HAS_CRYPT=y
--UCLIBC_HAS_CRYPT_IMPL=y
--UCLIBC_HAS_CTYPE_CHECKED=y
--# UCLIBC_HAS_CTYPE_ENFORCED is not set
--UCLIBC_HAS_CTYPE_SIGNED=y
--UCLIBC_HAS_CTYPE_TABLES=y
--# UCLIBC_HAS_CTYPE_UNSAFE is not set
--UCLIBC_HAS_EPOLL=y
--UCLIBC_HAS_ERRNO_MESSAGES=y
--# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
--# UCLIBC_HAS_FENV is not set
--UCLIBC_HAS_FLOATS=y
--UCLIBC_HAS_FNMATCH=y
--UCLIBC_HAS_FNMATCH_OLD=y
--# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
--UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
--# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
--# UCLIBC_HAS_FPU is not set
--UCLIBC_HAS_FTS=y
--UCLIBC_HAS_FTW=y
--# UCLIBC_HAS_FULL_RPC is not set
--UCLIBC_HAS_GETPT=y
--UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
--UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
--# UCLIBC_HAS_GLIBC_DIGIT_GROUPING is not set
--UCLIBC_HAS_GLOB=y
--UCLIBC_HAS_GNU_ERROR=y
--UCLIBC_HAS_GNU_GETOPT=y
--UCLIBC_HAS_GNU_GETSUBOPT=y
--UCLIBC_HAS_GNU_GLOB=y
--UCLIBC_HAS_HEXADECIMAL_FLOATS=y
--UCLIBC_HAS_IPV4=y
--UCLIBC_HAS_IPV6=y
--UCLIBC_HAS_LFS=y
--UCLIBC_HAS_LIBNSL_STUB=y
--UCLIBC_HAS_LIBRESOLV_STUB=y
--UCLIBC_HAS_LIBUTIL=y
--# UCLIBC_HAS_LOCALE is not set
--# UCLIBC_BUILD_ALL_LOCALE is not set
--# UCLIBC_BUILD_MINIMAL_LOCALE is not set
--# UCLIBC_PREGENERATED_LOCALE_DATA is not set
--UCLIBC_HAS_LONG_DOUBLE_MATH=y
--UCLIBC_HAS_NETWORK_SUPPORT=y
--UCLIBC_HAS_NFTW=y
--# UCLIBC_HAS_OBSOLETE_BSD_SIGNAL is not set
--# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
--UCLIBC_HAS_PRINTF_M_SPEC=y
--# UCLIBC_HAS_PROFILING is not set
--UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
--UCLIBC_HAS_PTY=y
--UCLIBC_HAS_REALTIME=y
--# UCLIBC_HAS_REENTRANT_RPC is not set
--UCLIBC_HAS_REGEX=y
--UCLIBC_HAS_REGEX_OLD=y
--UCLIBC_HAS_RESOLVER_SUPPORT=y
--# UCLIBC_HAS_RPC is not set
--UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
--# UCLIBC_HAS_SHA256_CRYPT_IMPL is not set
--# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set
--UCLIBC_HAS_SHADOW=y
--UCLIBC_HAS_SIGNUM_MESSAGES=y
--UCLIBC_HAS_SOCKET=y
--UCLIBC_HAS_SOFT_FLOAT=y
--# UCLIBC_HAS_SSP is not set
--UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
--# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
--# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
--# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
--UCLIBC_HAS_STDIO_BUFSIZ_4096=y
--# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
--# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
--# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
--# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
--# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
--UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
--UCLIBC_HAS_STDIO_GETC_MACRO=y
--UCLIBC_HAS_STDIO_PUTC_MACRO=y
--# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
--UCLIBC_HAS_STRING_ARCH_OPT=y
--UCLIBC_HAS_STRING_GENERIC_OPT=y
--# UCLIBC_HAS_STUBS is not set
--UCLIBC_HAS_SYSLOG=y
--# UCLIBC_HAS_SYS_ERRLIST is not set
--# UCLIBC_HAS_SYS_SIGLIST is not set
--UCLIBC_HAS_THREADS=y
--UCLIBC_HAS_TM_EXTENSIONS=y
--UCLIBC_HAS_TZ_CACHING=y
--UCLIBC_HAS_TZ_FILE=y
--UCLIBC_HAS_TZ_FILE_READ_MANY=y
--# UCLIBC_HAS_UTMPX is not set
--UCLIBC_HAS_WCHAR=y
--UCLIBC_HAS_WORDEXP=y
--# UCLIBC_HAS_XATTR is not set
--# UCLIBC_HAS_XLOCALE is not set
--UCLIBC_HAS___PROGNAME=y
--# UCLIBC_LINUX_MODULE_24 is not set
--UCLIBC_LINUX_MODULE_26=y
--UCLIBC_LINUX_SPECIFIC=y
--# UCLIBC_MALLOC_DEBUGGING is not set
--# UCLIBC_MJN3_ONLY is not set
--# UCLIBC_NTP_LEGACY is not set
--# USE_OLD_VFPRINTF is not set
--UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
--UCLIBC_PWD_BUFFER_SIZE=256
--# UCLIBC_STATIC_LDCONFIG is not set
--# UCLIBC_STRICT_HEADERS is not set
--UCLIBC_SUPPORT_AI_ADDRCONFIG=y
--UCLIBC_SUSV3_LEGACY=y
--UCLIBC_SUSV3_LEGACY_MACROS=y
--UCLIBC_SUSV4_LEGACY=y
--# UCLIBC_SV4_DEPRECATED is not set
--UCLIBC_TZ_FILE_PATH="/etc/TZ"
--# UCLIBC_FALLBACK_TO_ETC_LOCALTIME is not set
--UCLIBC_USE_NETLINK=y
--# UNIX98PTY_ONLY is not set
--USE_BX=y
--WARNINGS="-Wall"
+++ /dev/null
--DODEBUG=y
--DODEBUG_PT=y
--PTHREADS_DEBUG_SUPPORT=y
--SUPPORT_LD_DEBUG=y
--SUPPORT_LD_DEBUG_EARLY=y
--UCLIBC_MALLOC_DEBUGGING=y
+++ /dev/null
--ARCH_LITTLE_ENDIAN=y
--# CONFIG_386 is not set
--CONFIG_486=y
--# CONFIG_586 is not set
--# CONFIG_586MMX is not set
--# CONFIG_686 is not set
--# CONFIG_CRUSOE is not set
--# CONFIG_CYRIXIII is not set
--# CONFIG_ELAN is not set
--# CONFIG_GENERIC_386 is not set
--# CONFIG_K6 is not set
--# CONFIG_K7 is not set
--# CONFIG_NEHEMIAH is not set
--# CONFIG_PENTIUM4 is not set
--# CONFIG_PENTIUMII is not set
--# CONFIG_PENTIUMIII is not set
--# CONFIG_WINCHIP2 is not set
--# CONFIG_WINCHIPC6 is not set
--TARGET_ARCH="i386"
--TARGET_i386=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_LITTLE_ENDIAN=y
--# CONFIG_386 is not set
--# CONFIG_486 is not set
--# CONFIG_586 is not set
--# CONFIG_586MMX is not set
--CONFIG_686=y
--# CONFIG_CRUSOE is not set
--# CONFIG_CYRIXIII is not set
--# CONFIG_ELAN is not set
--# CONFIG_GENERIC_386 is not set
--# CONFIG_K6 is not set
--# CONFIG_K7 is not set
--# CONFIG_NEHEMIAH is not set
--# CONFIG_PENTIUM4 is not set
--# CONFIG_PENTIUMII is not set
--# CONFIG_PENTIUMIII is not set
--# CONFIG_WINCHIP2 is not set
--# CONFIG_WINCHIPC6 is not set
--TARGET_ARCH="i386"
--TARGET_i386=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_BIG_ENDIAN=y
--LINUXTHREADS_OLD=y
--TARGET_ARCH="m68k"
--TARGET_SUBARCH=""
--TARGET_m68k=y
--# UCLIBC_HAS_THREADS_NATIVE is not set
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_WANTS_BIG_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--CONFIG_MIPS_ISA_MIPS32=y
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--# CONFIG_MIPS_ISA_MIPS64 is not set
--# CONFIG_MIPS_N32_ABI is not set
--# CONFIG_MIPS_N64_ABI is not set
--CONFIG_MIPS_O32_ABI=y
--TARGET_ARCH="mips"
--TARGET_mips=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_WANTS_BIG_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--CONFIG_MIPS_N64_ABI=y
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_WANTS_BIG_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--# CONFIG_MIPS_N64_ABI is not set
--CONFIG_MIPS_O32_ABI=y
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_WANTS_BIG_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--CONFIG_MIPS_N64_ABI=y
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_BIG_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_WANTS_BIG_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--CONFIG_MIPS_N32_ABI=y
--# CONFIG_MIPS_N64_ABI is not set
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--CONFIG_MIPS_N64_ABI=y
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--# CONFIG_MIPS_N64_ABI is not set
--CONFIG_MIPS_O32_ABI=y
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--# CONFIG_MIPS_N32_ABI is not set
--CONFIG_MIPS_N64_ABI=y
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--CONFIG_MIPS_ISA_MIPS64=y
--CONFIG_MIPS_N32_ABI=y
--# CONFIG_MIPS_N64_ABI is not set
--# CONFIG_MIPS_O32_ABI is not set
--TARGET_ARCH="mips"
--TARGET_mips=y
--TARGET_SUBARCH="mips64"
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--# CONFIG_MIPS_ISA_3 is not set
--# CONFIG_MIPS_ISA_4 is not set
--CONFIG_MIPS_ISA_MIPS32=y
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--# CONFIG_MIPS_ISA_MIPS64 is not set
--# CONFIG_MIPS_N32_ABI is not set
--# CONFIG_MIPS_N64_ABI is not set
--CONFIG_MIPS_O32_ABI=y
--TARGET_ARCH="mips"
--TARGET_mips=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_ANY_ENDIAN=y
--ARCH_CFLAGS="-mno-split-addresses"
--ARCH_LITTLE_ENDIAN=y
--ARCH_WANTS_LITTLE_ENDIAN=y
--# CONFIG_MIPS_ISA_1 is not set
--# CONFIG_MIPS_ISA_2 is not set
--CONFIG_MIPS_ISA_3=y
--# CONFIG_MIPS_ISA_4 is not set
--# CONFIG_MIPS_ISA_MIPS32 is not set
--# CONFIG_MIPS_ISA_MIPS32R2 is not set
--# CONFIG_MIPS_ISA_MIPS64 is not set
--# CONFIG_MIPS_N32_ABI is not set
--# CONFIG_MIPS_N64_ABI is not set
--CONFIG_MIPS_O32_ABI=y
--TARGET_ARCH="mips"
--TARGET_mips=y
--UCLIBC_HAS_FPU=y
+++ /dev/null
--ARCH_BIG_ENDIAN=y
--CONFIG_CLASSIC=y
--# CONFIG_E500 is not set
--TARGET_ARCH="powerpc"
--TARGET_SUBARCH="classic"
--TARGET_powerpc=y
+++ /dev/null
--ARCH_BIG_ENDIAN=y
--# CONFIG_CLASSIC is not set
--CONFIG_E500=y
--TARGET_ARCH="powerpc"
--TARGET_SUBARCH="classic"
--TARGET_powerpc=y
+++ /dev/null
--ARCH_BIG_ENDIAN=y
--# CONFIG_SPARC_V7 is not set
--# CONFIG_SPARC_V8 is not set
--CONFIG_SPARC_V9=y
--# CONFIG_SPARC_V9B is not set
--TARGET_ARCH="sparc"
--TARGET_sparc=y
--UCLIBC_HAS_LONG_DOUBLE_MATH=y
+++ /dev/null
--ARCH_BIG_ENDIAN=y
--# CONFIG_SPARC_V7 is not set
--CONFIG_SPARC_V8=y
--# CONFIG_SPARC_V9 is not set
--# CONFIG_SPARC_V9B is not set
--TARGET_ARCH="sparc"
--TARGET_sparc=y
--UCLIBC_HAS_LONG_DOUBLE_MATH=y
+++ /dev/null
--ARCH_LITTLE_ENDIAN=y
--# LINUXTHREADS_NEW is not set
--TARGET_ARCH="x86_64"
--TARGET_x86_64=y
--UCLIBC_BSD_SPECIFIC=y
--UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++TARGET_ARCH="arc"
++TARGET_arc=y
++CONFIG_ARC_CPU_700=y
++# CONFIG_ARC_CPU_HS is not set
++CONFIG_ARC_PAGE_SIZE_8K=y
++# CONFIG_ARC_PAGE_SIZE_16K is not set
++# CONFIG_ARC_PAGE_SIZE_4K is not set
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++TARGET_ARCH="arc"
++TARGET_arc=y
++# CONFIG_ARC_CPU_700 is not set
++CONFIG_ARC_CPU_HS=y
++CONFIG_ARC_PAGE_SIZE_8K=y
++# CONFIG_ARC_PAGE_SIZE_16K is not set
++# CONFIG_ARC_PAGE_SIZE_4K is not set
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# COMPILE_IN_THUMB_MODE is not set
++TARGET_ARCH="arm"
++TARGET_arm=y
++# USE_BX is not set
++CONFIG_ARM_EABI=y
++
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_WANTS_BIG_ENDIAN=y
++# COMPILE_IN_THUMB_MODE is not set
++TARGET_ARCH="arm"
++TARGET_arm=y
++# USE_BX is not set
++CONFIG_ARM_EABI=y
++
--- /dev/null
--- /dev/null
++# ARCH_ANY_ENDIAN is not set
++ARCH_HAS_MMU=y
++# ARCH_HAS_NO_LDSO is not set
++# ARCH_HAS_NO_SHARED is not set
++# ARCH_LITTLE_ENDIAN is not set
++ARCH_USE_MMU=y
++# ARCH_WANTS_BIG_ENDIAN is not set
++# ARCH_WANTS_LITTLE_ENDIAN is not set
++ASSUME_DEVPTS=y
++# COMPAT_ATEXIT is not set
++CROSS_COMPILER_PREFIX=""
++DEVEL_PREFIX="/usr/"
++# DOASSERTS is not set
++# DODEBUG is not set
++# DODEBUG_PT is not set
++# DOMULTI is not set
++DOPIC=y
++DOSTRIP=y
++DO_C99_MATH=y
++# DO_XSI_MATH is not set
++# EXTRA_WARNINGS is not set
++FORCE_OPTIONS_FOR_ARCH=y
++# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
++# HARDWIRED_ABSPATH is not set
++# HAS_NO_THREADS is not set
++HAVE_DOT_CONFIG=y
++# HAVE_NO_PIC is not set
++# HAVE_NO_SSP is not set
++HAVE_SHARED=y
++KERNEL_HEADERS="."
++LDSO_BASE_FILENAME="ld.so"
++LDSO_CACHE_SUPPORT=y
++# LDSO_GNU_HASH_SUPPORT is not set
++LDSO_LD_LIBRARY_PATH=y
++LDSO_LDD_SUPPORT=y
++# LDSO_NO_CLEANUP is not set
++# LDSO_PRELINK_SUPPORT is not set
++# LDSO_PRELOAD_FILE_SUPPORT is not set
++LDSO_PRELOAD_ENV_SUPPORT=y
++LDSO_RUNPATH=y
++LDSO_SAFE_RUNPATH=y
++# LDSO_RUNPATH_OF_EXECUTABLE is not set
++# LDSO_SEARCH_INTERP_PATH is not set
++# LDSO_STANDALONE_SUPPORT is not set
++# LINUXTHREADS_NEW is not set
++# LINUXTHREADS_OLD is not set
++# UCLIBC_HAS_BACKTRACE is not set
++UCLIBC_HAS_THREADS_NATIVE=y
++# MALLOC is not set
++MALLOC_GLIBC_COMPAT=y
++# MALLOC_SIMPLE is not set
++MALLOC_STANDARD=y
++MULTILIB_DIR="lib"
++PTHREADS_DEBUG_SUPPORT=y
++RUNTIME_PREFIX="/"
++# SUPPORT_LD_DEBUG is not set
++# SUPPORT_LD_DEBUG_EARLY is not set
++TARGET_SUBARCH=""
++# TARGET_alpha is not set
++# TARGET_arc is not set
++# TARGET_arm is not set
++# TARGET_avr32 is not set
++# TARGET_bfin is not set
++# TARGET_c6x is not set
++# TARGET_cris is not set
++# TARGET_e1 is not set
++# TARGET_frv is not set
++# TARGET_h8300 is not set
++# TARGET_hppa is not set
++# TARGET_i386 is not set
++# TARGET_i960 is not set
++# TARGET_ia64 is not set
++# TARGET_lm32 is not set
++# TARGET_m68k is not set
++# TARGET_metag is not set
++# TARGET_microblaze is not set
++# TARGET_mips is not set
++# TARGET_nios is not set
++# TARGET_nios2 is not set
++# TARGET_or1k is not set
++# TARGET_powerpc is not set
++# TARGET_sh is not set
++# TARGET_sh64 is not set
++# TARGET_sparc is not set
++# TARGET_v850 is not set
++# TARGET_vax is not set
++# TARGET_x86_64 is not set
++# TARGET_xtensa is not set
++UCLIBC_BSD_SPECIFIC=y
++UCLIBC_BUILD_NOEXECSTACK=y
++# UCLIBC_BUILD_NOW is not set
++# UCLIBC_BUILD_PIE is not set
++UCLIBC_BUILD_RELRO=y
++UCLIBC_CTOR_DTOR=y
++UCLIBC_DYNAMIC_ATEXIT=y
++UCLIBC_EXTRA_CFLAGS=""
++UCLIBC_GRP_BUFFER_SIZE=256
++UCLIBC_HAS_ADVANCED_REALTIME=y
++# UCLIBC_HAS_ARC4RANDOM is not set
++UCLIBC_HAS_BSD_ERR=y
++UCLIBC_HAS_BSD_RES_CLOSE=y
++# UCLIBC_HAS_COMPAT_RES_STATE is not set
++UCLIBC_HAS_CRYPT=y
++UCLIBC_HAS_CRYPT_IMPL=y
++UCLIBC_HAS_CTYPE_CHECKED=y
++# UCLIBC_HAS_CTYPE_ENFORCED is not set
++UCLIBC_HAS_CTYPE_SIGNED=y
++UCLIBC_HAS_CTYPE_TABLES=y
++# UCLIBC_HAS_CTYPE_UNSAFE is not set
++UCLIBC_HAS_EPOLL=y
++UCLIBC_HAS_ERRNO_MESSAGES=y
++# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
++# UCLIBC_HAS_FENV is not set
++UCLIBC_HAS_FLOATS=y
++UCLIBC_HAS_FNMATCH=y
++UCLIBC_HAS_FNMATCH_OLD=y
++# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
++UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
++# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
++# UCLIBC_HAS_FPU is not set
++UCLIBC_HAS_FTS=y
++UCLIBC_HAS_FTW=y
++# UCLIBC_HAS_FULL_RPC is not set
++UCLIBC_HAS_GETPT=y
++UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
++UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
++# UCLIBC_HAS_GLIBC_DIGIT_GROUPING is not set
++UCLIBC_HAS_GLOB=y
++UCLIBC_HAS_GNU_ERROR=y
++UCLIBC_HAS_GNU_GETOPT=y
++UCLIBC_HAS_GNU_GETSUBOPT=y
++UCLIBC_HAS_GNU_GLOB=y
++UCLIBC_HAS_HEXADECIMAL_FLOATS=y
++UCLIBC_HAS_IPV4=y
++UCLIBC_HAS_IPV6=y
++UCLIBC_HAS_LFS=y
++UCLIBC_HAS_LIBNSL_STUB=y
++UCLIBC_HAS_LIBRESOLV_STUB=y
++UCLIBC_HAS_LIBUTIL=y
++# UCLIBC_HAS_LOCALE is not set
++# UCLIBC_BUILD_ALL_LOCALE is not set
++# UCLIBC_BUILD_MINIMAL_LOCALE is not set
++# UCLIBC_PREGENERATED_LOCALE_DATA is not set
++UCLIBC_HAS_LONG_DOUBLE_MATH=y
++UCLIBC_HAS_NETWORK_SUPPORT=y
++UCLIBC_HAS_NFTW=y
++UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
++# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
++UCLIBC_HAS_PRINTF_M_SPEC=y
++# UCLIBC_HAS_PROFILING is not set
++UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
++UCLIBC_HAS_PTY=y
++UCLIBC_HAS_REALTIME=y
++# UCLIBC_HAS_REENTRANT_RPC is not set
++UCLIBC_HAS_REGEX=y
++UCLIBC_HAS_REGEX_OLD=y
++UCLIBC_HAS_RESOLVER_SUPPORT=y
++# UCLIBC_HAS_RPC is not set
++UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
++# UCLIBC_HAS_SHA256_CRYPT_IMPL is not set
++# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set
++UCLIBC_HAS_SHADOW=y
++UCLIBC_HAS_SIGNUM_MESSAGES=y
++UCLIBC_HAS_SOCKET=y
++UCLIBC_HAS_SOFT_FLOAT=y
++# UCLIBC_HAS_SSP is not set
++# UCLIBC_HAS_SSP_COMPAT is not set
++UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
++# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
++# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
++# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
++UCLIBC_HAS_STDIO_BUFSIZ_4096=y
++# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
++# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
++# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
++# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
++# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
++UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
++UCLIBC_HAS_STDIO_GETC_MACRO=y
++UCLIBC_HAS_STDIO_PUTC_MACRO=y
++# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
++UCLIBC_HAS_STRING_ARCH_OPT=y
++UCLIBC_HAS_STRING_GENERIC_OPT=y
++# UCLIBC_HAS_STUBS is not set
++UCLIBC_HAS_SYSLOG=y
++# UCLIBC_HAS_SYS_ERRLIST is not set
++# UCLIBC_HAS_SYS_SIGLIST is not set
++UCLIBC_HAS_THREADS=y
++UCLIBC_HAS_TM_EXTENSIONS=y
++UCLIBC_HAS_TZ_CACHING=y
++UCLIBC_HAS_TZ_FILE=y
++UCLIBC_HAS_TZ_FILE_READ_MANY=y
++UCLIBC_HAS_UTMPX=y
++UCLIBC_HAS_UTMP=y
++UCLIBC_HAS_WCHAR=y
++UCLIBC_HAS_WORDEXP=y
++UCLIBC_HAS_XATTR=y
++# UCLIBC_HAS_XLOCALE is not set
++UCLIBC_HAS___PROGNAME=y
++# UCLIBC_LINUX_MODULE_24 is not set
++UCLIBC_LINUX_MODULE_26=y
++UCLIBC_LINUX_SPECIFIC=y
++# UCLIBC_MALLOC_DEBUGGING is not set
++# UCLIBC_MJN3_ONLY is not set
++# UCLIBC_NTP_LEGACY is not set
++# USE_OLD_VFPRINTF is not set
++UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
++UCLIBC_PWD_BUFFER_SIZE=256
++# UCLIBC_STATIC_LDCONFIG is not set
++# UCLIBC_STRICT_HEADERS is not set
++UCLIBC_SUPPORT_AI_ADDRCONFIG=y
++UCLIBC_SUSV3_LEGACY=y
++UCLIBC_SUSV3_LEGACY_MACROS=y
++UCLIBC_SUSV4_LEGACY=y
++# UCLIBC_SV4_DEPRECATED is not set
++UCLIBC_TZ_FILE_PATH="/etc/TZ"
++# UCLIBC_FALLBACK_TO_ETC_LOCALTIME is not set
++UCLIBC_USE_NETLINK=y
++# UNIX98PTY_ONLY is not set
++USE_BX=y
++WARNINGS="-Wall"
++# UCLIBC_HAS_OBSTACK is not set
++# UCLIBC_SUSV2_LEGACY is not set
++# UCLIBC_HAS_CONTEXT_FUNCS is not set
++UCLIBC_HAS_GETOPT_LONG=y
--- /dev/null
--- /dev/null
++DODEBUG=y
++DODEBUG_PT=y
++PTHREADS_DEBUG_SUPPORT=y
++SUPPORT_LD_DEBUG=y
++SUPPORT_LD_DEBUG_EARLY=y
++UCLIBC_MALLOC_DEBUGGING=y
--- /dev/null
--- /dev/null
++ARCH_LITTLE_ENDIAN=y
++# CONFIG_386 is not set
++CONFIG_486=y
++# CONFIG_586 is not set
++# CONFIG_586MMX is not set
++# CONFIG_686 is not set
++# CONFIG_CRUSOE is not set
++# CONFIG_CYRIXIII is not set
++# CONFIG_ELAN is not set
++# CONFIG_GENERIC_386 is not set
++# CONFIG_K6 is not set
++# CONFIG_K7 is not set
++# CONFIG_NEHEMIAH is not set
++# CONFIG_PENTIUM4 is not set
++# CONFIG_PENTIUMII is not set
++# CONFIG_PENTIUMIII is not set
++# CONFIG_WINCHIP2 is not set
++# CONFIG_WINCHIPC6 is not set
++TARGET_ARCH="i386"
++TARGET_i386=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_LITTLE_ENDIAN=y
++# CONFIG_386 is not set
++# CONFIG_486 is not set
++# CONFIG_586 is not set
++# CONFIG_586MMX is not set
++CONFIG_686=y
++# CONFIG_CRUSOE is not set
++# CONFIG_CYRIXIII is not set
++# CONFIG_ELAN is not set
++# CONFIG_GENERIC_386 is not set
++# CONFIG_K6 is not set
++# CONFIG_K7 is not set
++# CONFIG_NEHEMIAH is not set
++# CONFIG_PENTIUM4 is not set
++# CONFIG_PENTIUMII is not set
++# CONFIG_PENTIUMIII is not set
++# CONFIG_WINCHIP2 is not set
++# CONFIG_WINCHIPC6 is not set
++TARGET_ARCH="i386"
++TARGET_i386=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_BIG_ENDIAN=y
++LINUXTHREADS_OLD=y
++TARGET_ARCH="m68k"
++TARGET_SUBARCH=""
++TARGET_m68k=y
++# UCLIBC_HAS_THREADS_NATIVE is not set
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_WANTS_BIG_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++CONFIG_MIPS_ISA_MIPS32=y
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++# CONFIG_MIPS_ISA_MIPS64 is not set
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++# CONFIG_MIPS_N64_ABI is not set
++CONFIG_MIPS_O32_ABI=y
++TARGET_ARCH="mips"
++TARGET_mips=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_WANTS_BIG_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++CONFIG_MIPS_N64_ABI=y
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_WANTS_BIG_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++# CONFIG_MIPS_N64_ABI is not set
++CONFIG_MIPS_O32_ABI=y
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_WANTS_BIG_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++CONFIG_MIPS_N64_ABI=y
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_BIG_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_WANTS_BIG_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++CONFIG_MIPS_N32_ABI=y
++# CONFIG_MIPS_N64_ABI is not set
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++CONFIG_MIPS_N64_ABI=y
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++# CONFIG_MIPS_N64_ABI is not set
++CONFIG_MIPS_O32_ABI=y
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++CONFIG_MIPS_N64_ABI=y
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++CONFIG_MIPS_ISA_MIPS64=y
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++CONFIG_MIPS_N32_ABI=y
++# CONFIG_MIPS_N64_ABI is not set
++# CONFIG_MIPS_O32_ABI is not set
++TARGET_ARCH="mips"
++TARGET_mips=y
++TARGET_SUBARCH="mips64"
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++# CONFIG_MIPS_ISA_3 is not set
++# CONFIG_MIPS_ISA_4 is not set
++CONFIG_MIPS_ISA_MIPS32=y
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++# CONFIG_MIPS_ISA_MIPS64 is not set
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++# CONFIG_MIPS_N64_ABI is not set
++CONFIG_MIPS_O32_ABI=y
++TARGET_ARCH="mips"
++TARGET_mips=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_ANY_ENDIAN=y
++ARCH_CFLAGS="-mno-split-addresses"
++ARCH_LITTLE_ENDIAN=y
++ARCH_WANTS_LITTLE_ENDIAN=y
++# CONFIG_MIPS_ISA_1 is not set
++# CONFIG_MIPS_ISA_2 is not set
++CONFIG_MIPS_ISA_3=y
++# CONFIG_MIPS_ISA_4 is not set
++# CONFIG_MIPS_ISA_MIPS32 is not set
++# CONFIG_MIPS_ISA_MIPS32R2 is not set
++# CONFIG_MIPS_ISA_MIPS64 is not set
++# CONFIG_MIPS_ISA_MIPS64R2 is not set
++# CONFIG_MIPS_N32_ABI is not set
++# CONFIG_MIPS_N64_ABI is not set
++CONFIG_MIPS_O32_ABI=y
++TARGET_ARCH="mips"
++TARGET_mips=y
++UCLIBC_HAS_FPU=y
--- /dev/null
--- /dev/null
++ARCH_BIG_ENDIAN=y
++CONFIG_CLASSIC=y
++# CONFIG_E500 is not set
++TARGET_ARCH="powerpc"
++TARGET_SUBARCH="classic"
++TARGET_powerpc=y
--- /dev/null
--- /dev/null
++ARCH_BIG_ENDIAN=y
++# CONFIG_CLASSIC is not set
++CONFIG_E500=y
++TARGET_ARCH="powerpc"
++TARGET_SUBARCH="classic"
++TARGET_powerpc=y
--- /dev/null
--- /dev/null
++ARCH_BIG_ENDIAN=y
++# CONFIG_SPARC_V7 is not set
++# CONFIG_SPARC_V8 is not set
++CONFIG_SPARC_V9=y
++# CONFIG_SPARC_V9B is not set
++TARGET_ARCH="sparc"
++TARGET_sparc=y
++UCLIBC_HAS_LONG_DOUBLE_MATH=y
--- /dev/null
--- /dev/null
++ARCH_BIG_ENDIAN=y
++# CONFIG_SPARC_V7 is not set
++CONFIG_SPARC_V8=y
++# CONFIG_SPARC_V9 is not set
++# CONFIG_SPARC_V9B is not set
++TARGET_ARCH="sparc"
++TARGET_sparc=y
++UCLIBC_HAS_LONG_DOUBLE_MATH=y
--- /dev/null
--- /dev/null
++ARCH_LITTLE_ENDIAN=y
++# LINUXTHREADS_NEW is not set
++TARGET_ARCH="x86_64"
++TARGET_x86_64=y
++UCLIBC_BSD_SPECIFIC=y
++UCLIBC_HAS_FPU=y
+++ /dev/null
--From 76ff037059f6d387bde9d540f7e27a2b376d7cd7 Mon Sep 17 00:00:00 2001
--From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--Date: Fri, 18 Jan 2013 11:12:49 +0100
--Subject: [PATCH] mount.h: update
--
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
-- include/sys/mount.h | 45 +++++++++++++++++++++++++++++++++++----------
-- 1 file changed, 35 insertions(+), 10 deletions(-)
--
--diff --git a/include/sys/mount.h b/include/sys/mount.h
--index fbd61fd..c0e7b84 100644
----- a/include/sys/mount.h
--+++ b/include/sys/mount.h
--@@ -1,5 +1,5 @@
-- /* Header file for mounting/unmount Linux filesystems.
--- Copyright (C) 1996,1997,1998,1999,2000,2004 Free Software Foundation, Inc.
--+ Copyright (C) 1996-2000, 2004, 2010, 2012 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
--
-- The GNU C Library is free software; you can redistribute it and/or
--@@ -46,23 +46,46 @@ enum
-- #define MS_REMOUNT MS_REMOUNT
-- MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
-- #define MS_MANDLOCK MS_MANDLOCK
--- S_WRITE = 128, /* Write on file/directory/symlink. */
---#define S_WRITE S_WRITE
--- S_APPEND = 256, /* Append-only file. */
---#define S_APPEND S_APPEND
--- S_IMMUTABLE = 512, /* Immutable file. */
---#define S_IMMUTABLE S_IMMUTABLE
--+ MS_DIRSYNC = 128, /* Directory modifications are synchronous. */
--+#define MS_DIRSYNC MS_DIRSYNC
-- MS_NOATIME = 1024, /* Do not update access times. */
-- #define MS_NOATIME MS_NOATIME
-- MS_NODIRATIME = 2048, /* Do not update directory access times. */
-- #define MS_NODIRATIME MS_NODIRATIME
-- MS_BIND = 4096, /* Bind directory at different place. */
-- #define MS_BIND MS_BIND
--+ MS_MOVE = 8192,
--+#define MS_MOVE MS_MOVE
--+ MS_REC = 16384,
--+#define MS_REC MS_REC
--+ MS_SILENT = 32768,
--+#define MS_SILENT MS_SILENT
--+ MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */
--+#define MS_POSIXACL MS_POSIXACL
--+ MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */
--+#define MS_UNBINDABLE MS_UNBINDABLE
--+ MS_PRIVATE = 1 << 18, /* Change to private. */
--+#define MS_PRIVATE MS_PRIVATE
--+ MS_SLAVE = 1 << 19, /* Change to slave. */
--+#define MS_SLAVE MS_SLAVE
--+ MS_SHARED = 1 << 20, /* Change to shared. */
--+#define MS_SHARED MS_SHARED
--+ MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */
--+#define MS_RELATIME MS_RELATIME
--+ MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */
--+#define MS_KERNMOUNT MS_KERNMOUNT
--+ MS_I_VERSION = 1 << 23, /* Update inode I_version field. */
--+#define MS_I_VERSION MS_I_VERSION
--+ MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
--+#define MS_STRICTATIME MS_STRICTATIME
--+ MS_ACTIVE = 1 << 30,
--+#define MS_ACTIVE MS_ACTIVE
--+ MS_NOUSER = 1 << 31
--+#define MS_NOUSER MS_NOUSER
-- };
--
-- /* Flags that can be altered by MS_REMOUNT */
---#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \
--- |MS_NODIRATIME)
--+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
--
--
-- /* Magic mount flag number. Has to be or-ed to the flag values. */
--@@ -99,8 +122,10 @@ enum
-- #define MNT_FORCE MNT_FORCE
-- MNT_DETACH = 2, /* Just detach from the tree. */
-- #define MNT_DETACH MNT_DETACH
--- MNT_EXPIRE = 4 /* Mark for expiry. */
--+ MNT_EXPIRE = 4, /* Mark for expiry. */
-- #define MNT_EXPIRE MNT_EXPIRE
--+ UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */
--+#define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW
-- };
--
--
----
--1.9.1
--
+++ /dev/null
--From 8cfb43de636faa401634340d1a18404844f9ba5a Mon Sep 17 00:00:00 2001
--From: Mike Frysinger <vapier@gentoo.org>
--Date: Sun, 6 May 2012 03:50:44 -0400
--Subject: [PATCH] stdio: implement assignment-allocation "m" character
--
--The latest POSIX spec introduces a "m" character to allocate buffers for
--the user when using scanf type functions. This is like the old glibc "a"
--flag, but now standardized. With packages starting to use these, we need
--to implement it.
--
--for example:
-- char *s;
-- sscanf("foo", "%ms", &s);
-- printf("%s\n", s);
-- free(s);
--This will automatically allocate storage for "s", read in "foo" to it,
--and then display it.
--
--I'm not terribly familiar with the stdio layer, so this could be wrong.
--But it seems to work for me.
--
--Signed-off-by: Mike Frysinger <vapier@gentoo.org>
--Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-----
-- extra/Configs/Config.in | 13 ----------
-- libc/stdio/_scanf.c | 68 ++++++++++++++++++++++++++++---------------------
-- 2 files changed, 39 insertions(+), 42 deletions(-)
--
----- a/extra/Configs/Config.in
--+++ b/extra/Configs/Config.in
--@@ -1590,19 +1590,6 @@ config UCLIBC_PRINTF_SCANF_POSITIONAL_AR
--
-- Most people will answer 9.
--
---
---config UCLIBC_HAS_SCANF_GLIBC_A_FLAG
--- bool "Support glibc's 'a' flag for scanf string conversions (not implemented)"
--- help
--- NOTE!!! Currently Not Implemented!!! Just A Place Holder!! NOTE!!!
--- NOTE!!! Conflicts with an ANSI/ISO C99 scanf flag!! NOTE!!!
---
--- Answer Y to enable support for glibc's 'a' flag for the scanf string
--- conversions '%s', '%[', '%ls', '%l[', and '%S'. This is used to
--- auto-allocate sufficient memory to hold the data retrieved.
---
--- Most people will answer N.
---
-- choice
-- prompt "Stdio buffer size"
-- default UCLIBC_HAS_STDIO_BUFSIZ_4096
----- a/libc/stdio/_scanf.c
--+++ b/libc/stdio/_scanf.c
--@@ -77,14 +77,6 @@
-- #include <bits/uClibc_fpmax.h>
-- #endif /* __UCLIBC_HAS_FLOATS__ */
--
---#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
---#ifdef L_vfscanf
---/* only emit this once */
---#warning Forcing undef of __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ until implemented!
---#endif
---#undef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
---#endif
---
-- #undef __STDIO_HAS_VSSCANF
-- #if defined(__STDIO_BUFFERS) || !defined(__UCLIBC_HAS_WCHAR__) || defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
-- #define __STDIO_HAS_VSSCANF 1
--@@ -433,8 +425,9 @@ libc_hidden_def(vswscanf)
--
--
-- /* float layout 0123456789012345678901 repeat n for "l[" */
---#define SPEC_CHARS "npxXoudifFeEgGaACSncs["
---/* npxXoudif eEgG CS cs[ */
--+#define SPEC_CHARS "npxXoudifFeEgGaACSnmcs["
--+/* npxXoudif eEgG CS cs[ */
--+/* NOTE: the 'm' flag must come before any convs that support it */
--
-- /* NOTE: Ordering is important! In particular, CONV_LEFTBRACKET
-- * must immediately precede CONV_c. */
--@@ -444,7 +437,7 @@ enum {
-- CONV_p,
-- CONV_x, CONV_X, CONV_o, CONV_u, CONV_d, CONV_i,
-- CONV_f, CONV_F, CONV_e, CONV_E, CONV_g, CONV_G, CONV_a, CONV_A,
--- CONV_C, CONV_S, CONV_LEFTBRACKET, CONV_c, CONV_s, CONV_leftbracket,
--+ CONV_C, CONV_S, CONV_LEFTBRACKET, CONV_m, CONV_c, CONV_s, CONV_leftbracket,
-- CONV_percent, CONV_whitespace /* not in SPEC_* and no flags */
-- };
--
--@@ -474,7 +467,7 @@ enum {
-- FLAG_SURPRESS = 0x10, /* MUST BE 1ST!! See DO_FLAGS. */
-- FLAG_THOUSANDS = 0x20,
-- FLAG_I18N = 0x40, /* only works for d, i, u */
--- FLAG_MALLOC = 0x80, /* only works for s, S, and [ (and l[)*/
--+ FLAG_MALLOC = 0x80, /* only works for c, s, S, and [ (and l[)*/
-- };
--
--
--@@ -491,7 +484,7 @@ enum {
-- /* fFeEgGaA */ (0x0c|FLAG_SURPRESS|FLAG_THOUSANDS|FLAG_I18N), \
-- /* C */ ( 0|FLAG_SURPRESS), \
-- /* S and l[ */ ( 0|FLAG_SURPRESS|FLAG_MALLOC), \
--- /* c */ (0x04|FLAG_SURPRESS), \
--+ /* c */ (0x04|FLAG_SURPRESS|FLAG_MALLOC), \
-- /* s and [ */ (0x04|FLAG_SURPRESS|FLAG_MALLOC), \
-- }
--
--@@ -904,17 +897,17 @@ int attribute_hidden __psfs_parse_spec(r
-- if (*psfs->fmt == *p) {
-- int p_m_spec_chars = p - spec_chars;
--
---#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
---#error implement gnu a flag
--- if ((*p == 'a')
--- && ((psfs->fmt[1] == '[') || ((psfs->fmt[1]|0x20) == 's'))
--- ) { /* Assumes ascii for 's' and 'S' test. */
--- psfs->flags |= FLAG_MALLOC;
--+ if (*p == 'm' &&
--+ (psfs->fmt[1] == '[' || psfs->fmt[1] == 'c' ||
--+ /* Assumes ascii for 's' and 'S' test. */
--+ (psfs->fmt[1] | 0x20) == 's'))
--+ {
--+ if (psfs->store)
--+ psfs->flags |= FLAG_MALLOC;
-- ++psfs->fmt;
-- ++p;
--- continue; /* The related conversions follow 'a'. */
--+ continue; /* The related conversions follow 'm'. */
-- }
---#endif /* __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ */
--
-- for (p = spec_ranges; p_m_spec_chars > *p ; ++p) {}
-- if (((psfs->dataargtype >> 8) | psfs->flags)
--@@ -1265,12 +1258,6 @@ int VFSCANF (FILE *__restrict fp, const
-- while (*wf && __isascii(*wf) && (b < buf + sizeof(buf) - 1)) {
-- *b++ = *wf++;
-- }
---#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
---#error this is wrong... we need to ched in __psfs_parse_spec instead since this checks last char in buffer and conversion my have stopped before it.
--- if ((*b == 'a') && ((*wf == '[') || ((*wf|0x20) == 's'))) {
--- goto DONE; /* Spec was excessively long. */
--- }
---#endif /* __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ */
-- *b = 0;
-- if (b == buf) { /* Bad conversion specifier! */
-- goto DONE;
--@@ -1390,13 +1377,36 @@ int VFSCANF (FILE *__restrict fp, const
-- }
--
-- if (psfs.conv_num == CONV_s) {
--+ /* We might have to handle the allocation ourselves */
--+ int len;
--+ /* With 'm', we actually got a pointer to a pointer */
--+ unsigned char **ptr = (void *)b;
--+
--+ i = 0;
--+ if (psfs.flags & FLAG_MALLOC) {
--+ len = 0;
--+ b = NULL;
--+ } else
--+ len = -1;
--+
-- /* Yes, believe it or not, a %s conversion can store nuls. */
-- while ((__scan_getc(&sc) >= 0) && !isspace(sc.cc)) {
-- zero_conversions = 0;
--- *b = sc.cc;
--- b += psfs.store;
--+ if (i == len) {
--+ /* Pick a size that won't trigger a lot of
--+ * mallocs early on ... */
--+ len += 256;
--+ b = realloc(b, len + 1);
--+ }
--+ b[i] = sc.cc;
--+ i += psfs.store;
-- fail = 0;
-- }
--+
--+ if (psfs.flags & FLAG_MALLOC)
--+ *ptr = b;
--+ /* The code below takes care of terminating NUL */
--+ b += i;
-- } else {
-- #ifdef __UCLIBC_HAS_WCHAR__
-- assert((psfs.conv_num == CONV_LEFTBRACKET) || \
+++ /dev/null
----- a/ldso/libdl/libdl.c
--+++ b/ldso/libdl/libdl.c
--@@ -671,7 +671,7 @@ static void *do_dlsym(void *vhandle, con
-- {
-- struct elf_resolve *tpnt, *tfrom;
-- struct dyn_elf *handle;
--- ElfW(Addr) from;
--+ ElfW(Addr) from = 0;
-- struct dyn_elf *rpnt;
-- void *ret;
-- struct symbol_ref sym_ref = { NULL, NULL };
--@@ -729,7 +729,12 @@ static void *do_dlsym(void *vhandle, con
-- tpnt = NULL;
-- if (handle == _dl_symbol_tables)
-- tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
--- ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
--+ do {
--+ ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
--+ if (ret != NULL)
--+ break;
--+ handle = handle->next;
--+ } while (from && handle);
--
-- #if defined(USE_TLS) && USE_TLS && defined SHARED
-- if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
+++ /dev/null
--From be58779614b2fe9aa57a9315be9dc004dfd77b3b Mon Sep 17 00:00:00 2001
--From: Vineet Gupta <vgupta@synopsys.com>
--Date: Fri, 20 Feb 2015 15:27:08 +0530
--Subject: [PATCH] elf: Add STT_GNU_IFUNC from glibc
--
--perf in upstream Linux kernel 3.17 onwards expects STT_GNU_IFUNC
--replicate it from glibc
--
--Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
-- include/elf.h | 2 ++
-- 1 file changed, 2 insertions(+)
--
--diff --git a/include/elf.h b/include/elf.h
--index facf09c..917930b 100644
----- a/include/elf.h
--+++ b/include/elf.h
--@@ -566,6 +566,7 @@ typedef struct
-- #define STB_WEAK 2 /* Weak symbol */
-- #define STB_NUM 3 /* Number of defined types. */
-- #define STB_LOOS 10 /* Start of OS-specific */
--+#define STB_GNU_UNIQUE 10 /* Unique symbol. */
-- #define STB_HIOS 12 /* End of OS-specific */
-- #define STB_LOPROC 13 /* Start of processor-specific */
-- #define STB_HIPROC 15 /* End of processor-specific */
--@@ -581,6 +582,7 @@ typedef struct
-- #define STT_TLS 6 /* Symbol is thread-local data object*/
-- #define STT_NUM 7 /* Number of defined types. */
-- #define STT_LOOS 10 /* Start of OS-specific */
--+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
-- #define STT_HIOS 12 /* End of OS-specific */
-- #define STT_LOPROC 13 /* Start of processor-specific */
-- #define STT_HIPROC 15 /* End of processor-specific */
----
--2.1.4
--
+++ /dev/null
--From: "Peter S. Mazinger" <ps.m@gmx.net>
--Date: Thu, 21 Apr 2011 21:20:55 +0200
--Subject: [PATCH] endian.h: add some handy macros to be used in syscalls
--
--Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
--
----- a/include/endian.h
--+++ b/include/endian.h
--@@ -55,6 +55,17 @@
-- # define __LONG_LONG_PAIR(HI, LO) HI, LO
-- #endif
--
--+#ifdef _LIBC
--+# ifndef __ASSEMBLER__
--+# include <stdint.h>
--+# define OFF_HI(offset) (offset >> 31)
--+# define OFF_LO(offset) (offset)
--+# define OFF64_HI(offset) (uint32_t)(offset >> 32)
--+# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
--+# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
--+# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
--+# endif
--+#endif
--
-- #ifdef __USE_BSD
-- /* Conversion interfaces. */
+++ /dev/null
--From: "Peter S. Mazinger" <ps.m@gmx.net>
--Date: Tue, 26 Apr 2011 23:03:44 +0200
--Subject: [PATCH] add posix_madvise.c
--
--Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
-- create mode 100644 libc/sysdeps/linux/common/posix_madvise.c
--
----- a/libc/sysdeps/linux/common/Makefile.in
--+++ b/libc/sysdeps/linux/common/Makefile.in
--@@ -81,7 +81,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
-- sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
-- sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
-- # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
---CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c
--+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
-- CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
-- CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
-- CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
----- /dev/null
--+++ b/libc/sysdeps/linux/common/posix_madvise.c
--@@ -0,0 +1,25 @@
--+/* vi: set sw=4 ts=4: */
--+/* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */
--+
--+#include <sys/mman.h>
--+#include <sys/syscall.h>
--+
--+#if defined __NR_madvise && defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
--+int posix_madvise(void *addr, size_t len, int advice)
--+{
--+ int result;
--+ /* We have one problem: the kernel's MADV_DONTNEED does not
--+ * correspond to POSIX's POSIX_MADV_DONTNEED. The former simply
--+ * discards changes made to the memory without writing it back to
--+ * disk, if this would be necessary. The POSIX behaviour does not
--+ * allow this. There is no functionality mapping for the POSIX
--+ * behaviour so far so we ignore that advice for now. */
--+ if (advice == POSIX_MADV_DONTNEED)
--+ return 0;
--+
--+ /* this part might use madvise function */
--+ INTERNAL_SYSCALL_DECL (err);
--+ result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
--+ return INTERNAL_SYSCALL_ERRNO (result, err);
--+}
--+#endif
+++ /dev/null
--From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--Date: Tue, 17 Apr 2012 09:30:15 +0200
--Subject: [PATCH] libc: add posix_fallocate()
--
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
-- create mode 100644 libc/sysdeps/linux/common/posix_fallocate.c
-- create mode 100644 libc/sysdeps/linux/common/posix_fallocate64.c
-- create mode 100644 test/unistd/tst-posix_fallocate.c
-- create mode 100644 test/unistd/tst-posix_fallocate64.c
--
----- a/include/fcntl.h
--+++ b/include/fcntl.h
--@@ -210,9 +210,7 @@ extern int posix_fadvise64 (int __fd, __
--
-- #endif
--
---#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
---
---/* FIXME -- uClibc should probably implement these... */
--+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
--
-- /* Reserve storage for the data of the file associated with FD.
--
----- a/libc/sysdeps/linux/common/Makefile.in
--+++ b/libc/sysdeps/linux/common/Makefile.in
--@@ -81,7 +81,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
-- sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
-- sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
-- # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
---CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
--+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
--+ posix_fallocate.c posix_fallocate64.c
-- CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
-- CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
-- CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
----- a/libc/sysdeps/linux/common/bits/kernel-features.h
--+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
--@@ -494,6 +494,14 @@
-- # define __ASSUME_PRIVATE_FUTEX 1
-- #endif
--
--+/* Support for fallocate was added in 2.6.23,
--+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
--+#if __LINUX_KERNEL_VERSION >= 0x020617 \
--+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
--+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
--+# define __ASSUME_FALLOCATE 1
--+#endif
--+
-- /* getcpu is a syscall for x86-64 since 3.1. */
-- #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
-- # define __ASSUME_GETCPU_SYSCALL 1
----- /dev/null
--+++ b/libc/sysdeps/linux/common/posix_fallocate.c
--@@ -0,0 +1,43 @@
--+/* vi: set sw=4 ts=4: */
--+/*
--+ * posix_fallocate() for uClibc
--+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
--+ *
--+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
--+ *
--+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
--+ */
--+
--+#include <sys/syscall.h>
--+#include <fcntl.h>
--+#include <bits/kernel-features.h>
--+#include <stdint.h>
--+
--+#if defined __NR_fallocate
--+int posix_fallocate(int fd, __off_t offset, __off_t len)
--+{
--+ int ret;
--+
--+# if __WORDSIZE == 32
--+ uint32_t off_low = offset;
--+ uint32_t len_low = len;
--+ /* may assert that these >>31 are 0 */
--+ uint32_t zero = 0;
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
--+ __LONG_LONG_PAIR (zero, off_low),
--+ __LONG_LONG_PAIR (zero, len_low)));
--+# elif __WORDSIZE == 64
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
--+# else
--+# error your machine is neither 32 bit or 64 bit ... it must be magical
--+#endif
--+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--+ return INTERNAL_SYSCALL_ERRNO (ret, err);
--+ return 0;
--+}
--+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
--+strong_alias(posix_fallocate,posix_fallocate64)
--+# endif
--+#endif
----- /dev/null
--+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
--@@ -0,0 +1,39 @@
--+/* vi: set sw=4 ts=4: */
--+/*
--+ * posix_fallocate() for uClibc
--+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
--+ *
--+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
--+ *
--+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
--+ */
--+
--+#include <sys/syscall.h>
--+#include <fcntl.h>
--+#include <bits/kernel-features.h>
--+#include <stdint.h>
--+
--+#if defined __NR_fallocate
--+
--+# if __WORDSIZE == 64
--+/* Can use normal posix_fallocate() */
--+# elif __WORDSIZE == 32
--+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
--+{
--+ int ret;
--+ uint32_t off_low = offset & 0xffffffff;
--+ uint32_t off_high = offset >> 32;
--+ uint32_t len_low = len & 0xffffffff;
--+ uint32_t len_high = len >> 32;
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
--+ __LONG_LONG_PAIR (off_high, off_low),
--+ __LONG_LONG_PAIR (len_high, len_low)));
--+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--+ return INTERNAL_SYSCALL_ERRNO (ret, err);
--+ return 0;
--+}
--+# else
--+# error your machine is neither 32 bit or 64 bit ... it must be magical
--+# endif
--+#endif
----- a/test/.gitignore
--+++ b/test/.gitignore
--@@ -302,6 +302,8 @@ unistd/getcwd
-- unistd/getopt
-- unistd/getopt_long
-- unistd/tstgetopt
--+unistd/tst-posix_fallocate
--+unistd/tst-posix_fallocate64
-- unistd/tst-preadwrite
-- unistd/tst-preadwrite64
-- unistd/vfork
----- a/test/unistd/Makefile.in
--+++ b/test/unistd/Makefile.in
--@@ -2,7 +2,10 @@
-- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
--
-- ifeq ($(UCLIBC_HAS_LFS),)
---TESTS_DISABLED := tst-preadwrite64
--+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
--+endif
--+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
--+TESTS_DISABLED := tst-posix_fallocate
-- endif
-- OPTS_getopt := -abcXXX -9
-- OPTS_getopt_long := --add XXX --delete YYY --verbose
----- /dev/null
--+++ b/test/unistd/tst-posix_fallocate.c
--@@ -0,0 +1,127 @@
--+#include <fcntl.h>
--+#include <sys/stat.h>
--+
--+#ifndef TST_POSIX_FALLOCATE64
--+# define stat64 stat
--+# define fstat64 fstat
--+# else
--+# ifndef O_LARGEFILE
--+# error no O_LARGEFILE but you want to test with LFS enabled
--+# endif
--+#endif
--+
--+static void do_prepare (void);
--+#define PREPARE(argc, argv) do_prepare ()
--+static int do_test (void);
--+#define TEST_FUNCTION do_test ()
--+#include <test-skeleton.c>
--+
--+static int fd;
--+static void
--+do_prepare (void)
--+{
--+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
--+ if (fd == -1)
--+ {
--+ printf ("cannot create temporary file: %m\n");
--+ exit (1);
--+ }
--+}
--+
--+
--+static int
--+do_test (void)
--+{
--+ struct stat64 st;
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("1st fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 0)
--+ {
--+ puts ("file not created with size 0");
--+ return 1;
--+ }
--+
--+ if (posix_fallocate (fd, 512, 768) != 0)
--+ {
--+ puts ("1st posix_fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("2nd fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 512 + 768)
--+ {
--+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
--+ (unsigned long long int) st.st_size, 512u + 768u);
--+ return 1;
--+ }
--+
--+ if (posix_fallocate (fd, 0, 1024) != 0)
--+ {
--+ puts ("2nd posix_fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("3rd fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 512 + 768)
--+ {
--+ puts ("file size changed in 2nd posix_fallocate");
--+ return 1;
--+ }
--+
--+ if (posix_fallocate (fd, 2048, 64) != 0)
--+ {
--+ puts ("3rd posix_fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("4th fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 2048 + 64)
--+ {
--+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
--+ (unsigned long long int) st.st_size, 2048u + 64u);
--+ return 1;
--+ }
--+#ifdef TST_POSIX_FALLOCATE64
--+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
--+ {
--+ puts ("4th posix_fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("5th fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
--+ {
--+ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
--+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
--+ return 1;
--+ }
--+#endif
--+ close (fd);
--+
--+ return 0;
--+}
----- /dev/null
--+++ b/test/unistd/tst-posix_fallocate64.c
--@@ -0,0 +1,2 @@
--+#define TST_POSIX_FALLOCATE64
--+#include "tst-posix_fallocate.c"
+++ /dev/null
--From: "Anthony G. Basile" <blueness@gentoo.org>
--Date: Sun, 7 Sep 2014 15:33:46 -0400
--Subject: [PATCH] libc: add fallocate() and fallocate64()
--
--We add the Linux-specific function fallocate() which allows the user to
--directly manipulate allocate space for a file. fallocate() can operate
--in different modes, but the default mode is equivalent to posix_fallocate()
--which is specified in POSIX.1.
--
--Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be
--available.
--
--Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
-- create mode 100644 libc/sysdeps/linux/common/fallocate.c
-- create mode 100644 libc/sysdeps/linux/common/fallocate64.c
-- create mode 100644 test/unistd/tst-fallocate.c
-- create mode 100644 test/unistd/tst-fallocate64.c
--
----- a/extra/Configs/Config.in
--+++ b/extra/Configs/Config.in
--@@ -952,8 +952,8 @@ config UCLIBC_LINUX_SPECIFIC
-- default y
-- help
-- accept4(), bdflush(),
--- capget(), capset(), eventfd(), fstatfs(),
--- inotify_*(), ioperm(), iopl(),
--+ capget(), capset(), eventfd(), fallocate(),
--+ fstatfs(), inotify_*(), ioperm(), iopl(),
-- madvise(), modify_ldt(), pipe2(), personality(),
-- prctl()/arch_prctl(), pivot_root(), modify_ldt(),
-- ppoll(), readahead(), reboot(), remap_file_pages(),
----- a/include/fcntl.h
--+++ b/include/fcntl.h
--@@ -237,6 +237,38 @@ extern int __fcntl_nocancel (int fd, int
-- libc_hidden_proto(__fcntl_nocancel)
-- #endif
--
--+#if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) || defined _LIBC
--+/* Reserve storage for the data of a file associated with FD. This function
--+ is Linux-specific. For the portable version, use posix_fallocate().
--+ Unlike the latter, fallocate can operate in different modes. The default
--+ mode = 0 is equivalent to posix_fallocate().
--+
--+ Note: These declarations are used in posix_fallocate.c and
--+ posix_fallocate64.c, so we expose them internally.
--+ */
--+
--+/* Flags for fallocate's mode. */
--+# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
--+ even if offset + len is
--+ greater than file size. */
--+# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */
--+
--+# ifndef __USE_FILE_OFFSET64
--+extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
--+# else
--+# ifdef __REDIRECT
--+extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
--+ __off64_t __len),
--+ fallocate64);
--+# else
--+# define fallocate fallocate64
--+# endif
--+# endif
--+# ifdef __USE_LARGEFILE64
--+extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
--+# endif
--+#endif
--+
-- __END_DECLS
--
-- #endif /* fcntl.h */
----- a/libc/sysdeps/linux/common/Makefile.in
--+++ b/libc/sysdeps/linux/common/Makefile.in
--@@ -61,6 +61,10 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
-- vmsplice.c
-- CSRC-$(if $(findstring yy,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_LFS)),y) += \
-- sendfile64.c
--+# posix_fallocate() needs __libc_fallocate() from fallocate.c
--+# posix_fallocate64() needs __libc_fallocate64() from fallocate64.c
--+CSRC-$(if $(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME),y,) += \
--+ fallocate.c $(filter fallocate64.c,$(CSRC-y))
-- # NPTL needs these internally: madvise.c
-- CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c
-- ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
----- /dev/null
--+++ b/libc/sysdeps/linux/common/fallocate.c
--@@ -0,0 +1,48 @@
--+/* vi: set sw=4 ts=4: */
--+/*
--+ * fallocate() for uClibc - Based off of posix_fallocate() by Erik Andersen
--+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
--+ *
--+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
--+ *
--+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
--+ */
--+
--+#include <sys/syscall.h>
--+#include <fcntl.h>
--+#include <bits/kernel-features.h>
--+#include <stdint.h>
--+
--+#if defined __NR_fallocate
--+extern __typeof(fallocate) __libc_fallocate attribute_hidden;
--+int attribute_hidden __libc_fallocate(int fd, int mode, __off_t offset, __off_t len)
--+{
--+ int ret;
--+
--+# if __WORDSIZE == 32
--+ uint32_t off_low = offset;
--+ uint32_t len_low = len;
--+ /* may assert that these >>31 are 0 */
--+ uint32_t zero = 0;
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
--+ __LONG_LONG_PAIR (zero, off_low),
--+ __LONG_LONG_PAIR (zero, len_low)));
--+# elif __WORDSIZE == 64
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, mode, offset, len));
--+# else
--+# error your machine is neither 32 bit or 64 bit ... it must be magical
--+# endif
--+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--+ return INTERNAL_SYSCALL_ERRNO (ret, err);
--+ return 0;
--+}
--+
--+# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
--+strong_alias(__libc_fallocate,fallocate)
--+# if __WORDSIZE == 64
--+strong_alias(__libc_fallocate,fallocate64)
--+# endif
--+# endif
--+#endif
----- /dev/null
--+++ b/libc/sysdeps/linux/common/fallocate64.c
--@@ -0,0 +1,42 @@
--+/* vi: set sw=4 ts=4: */
--+/*
--+ * fallocate() for uClibc - based off posix_fallocate() by Erik Andersen
--+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
--+ *
--+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
--+ *
--+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
--+ */
--+
--+#include <sys/syscall.h>
--+
--+#include <fcntl.h>
--+#include <bits/kernel-features.h>
--+#include <stdint.h>
--+
--+#if defined __NR_fallocate
--+
--+# if __WORDSIZE == 64
--+/* Can use normal fallocate() */
--+# elif __WORDSIZE == 32
--+extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
--+int attribute_hidden __libc_fallocate64(int fd, int mode, __off64_t offset,
--+ __off64_t len)
--+{
--+ int ret;
--+ INTERNAL_SYSCALL_DECL(err);
--+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
--+ OFF64_HI_LO (offset), OFF64_HI_LO (len)));
--+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--+ return INTERNAL_SYSCALL_ERRNO (ret, err);
--+ return 0;
--+}
--+
--+# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
--+strong_alias(__libc_fallocate64,fallocate64)
--+# endif
--+
--+# else
--+# error your machine is neither 32 bit or 64 bit ... it must be magical
--+# endif
--+#endif
----- a/libc/sysdeps/linux/common/posix_fallocate.c
--+++ b/libc/sysdeps/linux/common/posix_fallocate.c
--@@ -14,28 +14,10 @@
-- #include <stdint.h>
--
-- #if defined __NR_fallocate
--+extern __typeof(fallocate) __libc_fallocate attribute_hidden;
-- int posix_fallocate(int fd, __off_t offset, __off_t len)
-- {
--- int ret;
---
---# if __WORDSIZE == 32
--- uint32_t off_low = offset;
--- uint32_t len_low = len;
--- /* may assert that these >>31 are 0 */
--- uint32_t zero = 0;
--- INTERNAL_SYSCALL_DECL(err);
--- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
--- __LONG_LONG_PAIR (zero, off_low),
--- __LONG_LONG_PAIR (zero, len_low)));
---# elif __WORDSIZE == 64
--- INTERNAL_SYSCALL_DECL(err);
--- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
---# else
---# error your machine is neither 32 bit or 64 bit ... it must be magical
---#endif
--- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--- return INTERNAL_SYSCALL_ERRNO (ret, err);
--- return 0;
--+ return __libc_fallocate(fd, 0, offset, len);
-- }
-- # if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
-- strong_alias(posix_fallocate,posix_fallocate64)
----- a/libc/sysdeps/linux/common/posix_fallocate64.c
--+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
--@@ -18,22 +18,12 @@
-- # if __WORDSIZE == 64
-- /* Can use normal posix_fallocate() */
-- # elif __WORDSIZE == 32
--+extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
-- int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
-- {
--- int ret;
--- uint32_t off_low = offset & 0xffffffff;
--- uint32_t off_high = offset >> 32;
--- uint32_t len_low = len & 0xffffffff;
--- uint32_t len_high = len >> 32;
--- INTERNAL_SYSCALL_DECL(err);
--- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
--- __LONG_LONG_PAIR (off_high, off_low),
--- __LONG_LONG_PAIR (len_high, len_low)));
--- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
--- return INTERNAL_SYSCALL_ERRNO (ret, err);
--- return 0;
--+ return __libc_fallocate64(fd, 0, offset, len);
-- }
-- # else
---# error your machine is neither 32 bit or 64 bit ... it must be magical
--+# error your machine is neither 32 bit or 64 bit ... it must be magical
-- # endif
-- #endif
----- a/test/.gitignore
--+++ b/test/.gitignore
--@@ -302,6 +302,8 @@ unistd/getcwd
-- unistd/getopt
-- unistd/getopt_long
-- unistd/tstgetopt
--+unistd/tst-fallocate
--+unistd/tst-fallocate64
-- unistd/tst-posix_fallocate
-- unistd/tst-posix_fallocate64
-- unistd/tst-preadwrite
----- /dev/null
--+++ b/test/unistd/tst-fallocate.c
--@@ -0,0 +1,166 @@
--+#include <fcntl.h>
--+#include <sys/stat.h>
--+
--+#ifndef TST_FALLOCATE64
--+# define stat64 stat
--+# define fstat64 fstat
--+# else
--+# ifndef O_LARGEFILE
--+# error no O_LARGEFILE but you want to test with LFS enabled
--+# endif
--+#endif
--+
--+static void do_prepare(void);
--+static int do_test(void);
--+#define PREPARE(argc, argv) do_prepare ()
--+#define TEST_FUNCTION do_test ()
--+#include <test-skeleton.c>
--+
--+static int fd;
--+static void
--+do_prepare (void)
--+{
--+ fd = create_temp_file ("tst-fallocate.", NULL);
--+ if (fd == -1)
--+ {
--+ printf ("cannot create temporary file: %m\n");
--+ exit (1);
--+ }
--+}
--+
--+
--+static int
--+do_test (void)
--+{
--+ struct stat64 st;
--+ int c;
--+ char garbage[4096];
--+ blkcnt_t blksb4;
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("1st fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 0)
--+ {
--+ puts ("file not created with size 0");
--+ return 1;
--+ }
--+
--+ /* This is the default mode which is identical to posix_fallocate().
--+ Note: we need a few extra blocks for FALLOC_FL_PUNCH_HOLE below.
--+ While block sizes vary, we'll assume eight 4K blocks for good measure. */
--+ if (fallocate (fd, 0, 8 * 4096, 128) != 0)
--+ {
--+ puts ("1st fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("2nd fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 8 * 4096 + 128)
--+ {
--+ printf ("file size after 1st fallocate call is %llu, expected %u\n",
--+ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
--+ return 1;
--+ }
--+
--+ /* Without FALLOC_FL_KEEP_SIZE, this would increaste the size of the file. */
--+ if (fallocate (fd, FALLOC_FL_KEEP_SIZE, 0, 16 * 4096) != 0)
--+ {
--+ puts ("2nd fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("3rd fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 8 * 4096 + 128)
--+ {
--+ printf ("file size changed in 2nd fallocate call to %llu, expected %u\n",
--+ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
--+ return 1;
--+ }
--+
--+ /* Let's fill up the first eight 4k blocks with 'x' to force some allocations. */
--+
--+ memset(garbage, 'x', 4096);
--+ for(c=0; c < 8; c++)
--+ if(write(fd, garbage, 4096) == -1)
--+ {
--+ puts ("write failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("4th fstat failed");
--+ return 1;
--+ }
--+
--+ blksb4 = st.st_blocks;
--+
--+ /* Let's punch a hole in the entire file, turning it effectively into a sparse file. */
--+ if (fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 8 * 4096 + 128) != 0)
--+ {
--+ puts ("3rd fallocate call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("5th fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 8 * 4096 + 128)
--+ {
--+ printf ("file size after 3rd fallocate call is %llu, expected %u\n",
--+ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
--+ return 1;
--+ }
--+
--+ /* The number of allocated blocks should decrease. I hope this works on
--+ all filesystems! */
--+ if (st.st_blocks >= blksb4)
--+ {
--+ printf ("number of blocks after 3rd fallocate call is %lu, expected less than %lu\n",
--+ (unsigned long int) st.st_blocks, blksb4);
--+ return 1;
--+ }
--+
--+#ifdef TST_FALLOCATE64
--+ /* We'll just do a mode = 0 test for fallocate64() */
--+ if (fallocate64 (fd, 0, 4097ULL, 4294967295ULL + 2ULL) != 0)
--+ {
--+ puts ("1st fallocate64 call failed");
--+ return 1;
--+ }
--+
--+ if (fstat64 (fd, &st) != 0)
--+ {
--+ puts ("6th fstat failed");
--+ return 1;
--+ }
--+
--+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
--+ {
--+ printf ("file size after 1st fallocate64 call is %llu, expected %llu\n",
--+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
--+ return 1;
--+ }
--+#endif
--+ close (fd);
--+
--+ return 0;
--+}
--+
----- /dev/null
--+++ b/test/unistd/tst-fallocate64.c
--@@ -0,0 +1,2 @@
--+#define TST_FALLOCATE64
--+#include "tst-fallocate.c"
----- a/test/unistd/Makefile.in
--+++ b/test/unistd/Makefile.in
--@@ -2,10 +2,13 @@
-- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
--
-- ifeq ($(UCLIBC_HAS_LFS),)
---TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
--+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64 tst-fallocate64
-- endif
-- ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
---TESTS_DISABLED := tst-posix_fallocate
--+TESTS_DISABLED := tst-posix_fallocate tst-fallocate64
--+endif
--+ifeq ($(UCLIBC_LINUX_SPECIFIC),)
--+TESTS_DISABLED += tst-fallocate
-- endif
-- OPTS_getopt := -abcXXX -9
-- OPTS_getopt_long := --add XXX --delete YYY --verbose
+++ /dev/null
--From: Natanael Copa <natanael.copa@gmail.com>
--Date: Thu, 5 Jul 2012 11:55:19 +0000
--Subject: [PATCH] i386/bits/syscalls.h: allow immediate values as 6th syscall
-- arg
--
--Allow use of immedate values as the 6th syscall argument. Otherwise we must
--store the arg on memory. This gives gcc more options to optimize better.
--
--This also works around an issue with posix_fallocate.
--
--Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
--
----- a/libc/sysdeps/linux/i386/bits/syscalls.h
--+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
--@@ -136,7 +136,7 @@ __asm__ (
-- #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
-- , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
-- #define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
--- , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "m" (arg6)
--+ , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "g" (arg6)
--
-- #else /* !PIC */
--
+++ /dev/null
--Index: uClibc-0.9.33.2/libc/sysdeps/linux/common/sync_file_range.c
--===================================================================
----- uClibc-0.9.33.2.orig/libc/sysdeps/linux/common/sync_file_range.c 2012-05-15 09:20:09.000000000 +0200
--+++ uClibc-0.9.33.2/libc/sysdeps/linux/common/sync_file_range.c 2015-04-03 00:27:47.701221722 +0200
--@@ -4,24 +4,39 @@
-- *
-- * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
-- *
--- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
--+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
-- */
--
-- #include <sys/syscall.h>
---#if defined __USE_GNU
---#include <fcntl.h>
--+#if defined __UCLIBC_HAS_LFS__ && defined __USE_GNU
--+# include <bits/wordsize.h>
--+# include <endian.h>
--+# include <fcntl.h>
--
---#if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
---#define __NR___syscall_sync_file_range __NR_sync_file_range
---static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
--- off_t, offset_hi, off_t, offset_lo,
--- off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
--+# ifdef __NR_sync_file_range2
--+# undef __NR_sync_file_range
--+# define __NR_sync_file_range __NR_sync_file_range2
--+# endif
--+
--+# ifdef __NR_sync_file_range
-- int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
-- {
--- return __syscall_sync_file_range(fd,
--- __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
--- __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
--- flags);
--+# if defined __powerpc__ && __WORDSIZE == 64
--+ return INLINE_SYSCALL(sync_file_range, 4, fd, flags, offset, nbytes);
--+# elif (defined __mips__ && _MIPS_SIM == _ABIO32) || \
--+ (defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) && !(defined(__powerpc__) || defined(__xtensa__)))
--+ /* arch with 64-bit data in even reg alignment #2: [arcv2/others-in-future]
--+ * stock syscall handler in kernel (reg hole punched)
--+ * see libc/sysdeps/linux/common/posix_fadvise.c for more details */
--+ return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
--+ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
--+# elif defined __NR_sync_file_range2
--+ return INLINE_SYSCALL(sync_file_range, 6, fd, flags,
--+ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes));
--+# else
--+ return INLINE_SYSCALL(sync_file_range, 6, fd,
--+ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
--+# endif
-- }
---#endif
--+# endif
-- #endif
+++ /dev/null
----- a/extra/scripts/unifdef.c
--+++ b/extra/scripts/unifdef.c
--@@ -78,8 +78,6 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/
-- #define errx(exit_code, fmt, args...) ({ warnx(fmt, ## args); exit(exit_code); })
-- #define err(exit_code, fmt, args...) errx(exit_code, fmt ": %s", ## args, strerror(errno))
--
---size_t strlcpy(char *dst, const char *src, size_t siz);
---
-- /* types of input lines: */
-- typedef enum {
-- LT_TRUEI, /* a true #if with ignore flag */
+++ /dev/null
----- a/include/string.h
--+++ b/include/string.h
--@@ -355,18 +355,40 @@ extern char *index (__const char *__s, i
-- /* Find the last occurrence of C in S (same as strrchr). */
-- extern char *rindex (__const char *__s, int __c)
-- __THROW __attribute_pure__ __nonnull ((1));
---# else
---# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
--+# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
-- /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
-- * They are replaced as proposed by SuSv3. Don't sync this part
-- * with glibc and keep it in sync with strings.h. */
--
---# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
---# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
---# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
---# define index(s,c) strchr((s), (c))
---# define rindex(s,c) strrchr((s), (c))
---# endif
--+/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
--+static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
--+{
--+ memmove(__dest, __src, __n);
--+}
--+
--+/* Set N bytes of S to 0. */
--+static __inline__ void bzero (void *__s, size_t __n)
--+{
--+ memset(__s, 0, __n);
--+}
--+
--+/* Compare N bytes of S1 and S2 (same as memcmp). */
--+static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
--+{
--+ return memcmp(__s1, __s2, __n);
--+}
--+
--+/* Find the first occurrence of C in S (same as strchr). */
--+static __inline__ char *index (__const char *__s, int __c)
--+{
--+ return strchr(__s, __c);
--+}
--+
--+/* Find the last occurrence of C in S (same as strrchr). */
--+static __inline__ char *rindex (__const char *__s, int __c)
--+{
--+ return strrchr(__s, __c);
--+}
-- # endif
--
-- /* Return the position of the first bit set in I, or 0 if none are set.
+++ /dev/null
----- a/include/sys/timex.h
--+++ b/include/sys/timex.h
--@@ -116,9 +116,8 @@ struct timex
--
-- __BEGIN_DECLS
--
---#if 0
---extern int __adjtimex (struct timex *__ntx) __THROW;
---#endif
--+#undef __adjtimex
--+#define __adjtimex adjtimex
-- extern int adjtimex (struct timex *__ntx) __THROW;
-- libc_hidden_proto(adjtimex)
--
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -1631,6 +1631,7 @@ int attribute_hidden __read_etc_hosts_r(
-- * struct in[6]_addr
-- * char line_buffer[BUFSZ+];
-- */
--+ memset(buf, 0, buflen);
-- parser->data = buf;
-- parser->data_len = aliaslen;
-- parser->line_len = buflen - aliaslen;
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -3654,11 +3654,11 @@ res_init(void)
-- */
-- if (!_res.id)
-- _res.id = res_randomid();
--- __res_sync = res_sync_func;
--
-- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
--
-- __res_vinit(&_res, 1);
--+ __res_sync = res_sync_func;
--
-- return 0;
-- }
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -317,6 +317,7 @@ Domain name in a message can be represen
-- #include <sys/utsname.h>
-- #include <sys/un.h>
-- #include <sys/stat.h>
--+#include <net/if.h>
-- #include <bits/uClibc_mutex.h>
-- #include "internal/parse_config.h"
--
--@@ -1861,7 +1862,6 @@ int getnameinfo(const struct sockaddr *s
-- c = inet_ntop(AF_INET6,
-- (const void *) &sin6p->sin6_addr,
-- host, hostlen);
---#if 0
-- /* Does scope id need to be supported? */
-- uint32_t scopeid;
-- scopeid = sin6p->sin6_scope_id;
--@@ -1898,7 +1898,6 @@ int getnameinfo(const struct sockaddr *s
-- return EAI_SYSTEM;
-- memcpy(host + real_hostlen, scopebuf, scopelen + 1);
-- }
---#endif
-- }
-- #endif /* __UCLIBC_HAS_IPV6__ */
-- #if defined __UCLIBC_HAS_IPV4__
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -3536,6 +3536,61 @@ __res_vinit(res_state rp, int preinit)
-- return 0;
-- }
--
--+static unsigned int
--+res_randomid(void)
--+{
--+ return 0xffff & getpid();
--+}
--+
--+/* Our res_init never fails (always returns 0) */
--+int
--+res_init(void)
--+{
--+ /*
--+ * These three fields used to be statically initialized. This made
--+ * it hard to use this code in a shared library. It is necessary,
--+ * now that we're doing dynamic initialization here, that we preserve
--+ * the old semantics: if an application modifies one of these three
--+ * fields of _res before res_init() is called, res_init() will not
--+ * alter them. Of course, if an application is setting them to
--+ * _zero_ before calling res_init(), hoping to override what used
--+ * to be the static default, we can't detect it and unexpected results
--+ * will follow. Zero for any of these fields would make no sense,
--+ * so one can safely assume that the applications were already getting
--+ * unexpected results.
--+ *
--+ * _res.options is tricky since some apps were known to diddle the bits
--+ * before res_init() was first called. We can't replicate that semantic
--+ * with dynamic initialization (they may have turned bits off that are
--+ * set in RES_DEFAULT). Our solution is to declare such applications
--+ * "broken". They could fool us by setting RES_INIT but none do (yet).
--+ */
--+
--+ __UCLIBC_MUTEX_LOCK(__resolv_lock);
--+
--+ if (!_res.retrans)
--+ _res.retrans = RES_TIMEOUT;
--+ if (!_res.retry)
--+ _res.retry = 4;
--+ if (!(_res.options & RES_INIT))
--+ _res.options = RES_DEFAULT;
--+
--+ /*
--+ * This one used to initialize implicitly to zero, so unless the app
--+ * has set it to something in particular, we can randomize it now.
--+ */
--+ if (!_res.id)
--+ _res.id = res_randomid();
--+
--+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
--+
--+ __res_vinit(&_res, 1);
--+ __res_sync = res_sync_func;
--+
--+ return 0;
--+}
--+libc_hidden_def(res_init)
--+
-- static void
-- __res_iclose(void)
-- {
--@@ -3608,61 +3663,6 @@ struct __res_state *__resp = &_res;
-- # endif
-- #endif /* !__UCLIBC_HAS_THREADS__ */
--
---static unsigned int
---res_randomid(void)
---{
--- return 0xffff & getpid();
---}
---
---/* Our res_init never fails (always returns 0) */
---int
---res_init(void)
---{
--- /*
--- * These three fields used to be statically initialized. This made
--- * it hard to use this code in a shared library. It is necessary,
--- * now that we're doing dynamic initialization here, that we preserve
--- * the old semantics: if an application modifies one of these three
--- * fields of _res before res_init() is called, res_init() will not
--- * alter them. Of course, if an application is setting them to
--- * _zero_ before calling res_init(), hoping to override what used
--- * to be the static default, we can't detect it and unexpected results
--- * will follow. Zero for any of these fields would make no sense,
--- * so one can safely assume that the applications were already getting
--- * unexpected results.
--- *
--- * _res.options is tricky since some apps were known to diddle the bits
--- * before res_init() was first called. We can't replicate that semantic
--- * with dynamic initialization (they may have turned bits off that are
--- * set in RES_DEFAULT). Our solution is to declare such applications
--- * "broken". They could fool us by setting RES_INIT but none do (yet).
--- */
---
--- __UCLIBC_MUTEX_LOCK(__resolv_lock);
---
--- if (!_res.retrans)
--- _res.retrans = RES_TIMEOUT;
--- if (!_res.retry)
--- _res.retry = 4;
--- if (!(_res.options & RES_INIT))
--- _res.options = RES_DEFAULT;
---
--- /*
--- * This one used to initialize implicitly to zero, so unless the app
--- * has set it to something in particular, we can randomize it now.
--- */
--- if (!_res.id)
--- _res.id = res_randomid();
---
--- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
---
--- __res_vinit(&_res, 1);
--- __res_sync = res_sync_func;
---
--- return 0;
---}
---libc_hidden_def(res_init)
---
-- /*
-- * Set up default settings. If the configuration file exist, the values
-- * there will have precedence. Otherwise, the server address is set to
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -3432,6 +3432,7 @@ static void res_sync_func(void)
-- */
-- }
--
--+/* has to be called under __resolv_lock */
-- static int
-- __res_vinit(res_state rp, int preinit)
-- {
--@@ -3440,7 +3441,6 @@ __res_vinit(res_state rp, int preinit)
-- int m = 0;
-- #endif
--
--- __UCLIBC_MUTEX_LOCK(__resolv_lock);
-- __close_nameservers();
-- __open_nameservers();
--
--@@ -3532,7 +3532,6 @@ __res_vinit(res_state rp, int preinit)
--
-- rp->options |= RES_INIT;
--
--- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
-- return 0;
-- }
--
--@@ -3582,11 +3581,11 @@ res_init(void)
-- if (!_res.id)
-- _res.id = res_randomid();
--
--- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
---
-- __res_vinit(&_res, 1);
-- __res_sync = res_sync_func;
--
--+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
--+
-- return 0;
-- }
-- libc_hidden_def(res_init)
--@@ -3687,7 +3686,11 @@ struct __res_state *__resp = &_res;
-- int
-- res_ninit(res_state statp)
-- {
--- return __res_vinit(statp, 0);
--+ int ret;
--+ __UCLIBC_MUTEX_LOCK(__resolv_lock);
--+ ret = __res_vinit(statp, 0);
--+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
--+ return ret;
-- }
--
-- #endif /* L_res_init */
+++ /dev/null
----- a/libc/inet/resolv.c
--+++ b/libc/inet/resolv.c
--@@ -3581,6 +3581,7 @@ res_init(void)
-- if (!_res.id)
-- _res.id = res_randomid();
--
--+ __res_sync = NULL;
-- __res_vinit(&_res, 1);
-- __res_sync = res_sync_func;
--
+++ /dev/null
--Reduce the initial buffer size for open_memstream (used by vasprintf),
--as most strings are usually smaller than that.
--Realloc the buffer after finishing the string to further reduce size.
--
--Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--
----- a/libc/stdio/vasprintf.c
--+++ b/libc/stdio/vasprintf.c
--@@ -39,6 +39,8 @@ int vasprintf(char **__restrict buf, con
-- if (rv < 0) {
-- free(*buf);
-- *buf = NULL;
--+ } else {
--+ *buf = realloc(*buf, rv + 1);
-- }
-- }
--
----- a/libc/stdio/open_memstream.c
--+++ b/libc/stdio/open_memstream.c
--@@ -17,6 +17,8 @@
--
-- #define COOKIE ((__oms_cookie *) cookie)
--
--+#define MEMSTREAM_BUFSIZ 256
--+
-- typedef struct {
-- char *buf;
-- size_t len;
--@@ -134,7 +136,7 @@ FILE *open_memstream(char **__restrict b
-- register FILE *fp;
--
-- if ((cookie = malloc(sizeof(__oms_cookie))) != NULL) {
--- if ((cookie->buf = malloc(cookie->len = BUFSIZ)) == NULL) {
--+ if ((cookie->buf = malloc(cookie->len = MEMSTREAM_BUFSIZ)) == NULL) {
-- goto EXIT_cookie;
-- }
-- *cookie->buf = 0; /* Set nul terminator for buffer. */
+++ /dev/null
----- a/include/math.h
--+++ b/include/math.h
--@@ -195,7 +195,7 @@ extern int signgam;
--
--
-- /* ISO C99 defines some generic macros which work on any data type. */
---#ifdef __USE_ISOC99
--+#if defined(__USE_ISOC99) || defined(__USE_BSD)
--
-- /* Get the architecture specific values describing the floating-point
-- evaluation. The following symbols will get defined:
--@@ -315,6 +315,11 @@ enum
--
-- #endif /* Use ISO C99. */
--
--+/* BSD compat */
--+#define finite(x) __finite(x)
--+#define finitef(x) __finitef(x)
--+#define finitel(x) __finitel(x)
--+
-- #ifdef __USE_MISC
-- /* Support for various different standard error handling behaviors. */
-- typedef enum
+++ /dev/null
----- a/libpthread/nptl/cleanup_defer_compat.c
--+++ b/libpthread/nptl/cleanup_defer_compat.c
--@@ -22,7 +22,7 @@
--
-- void
-- attribute_protected
---_pthread_cleanup_push_defer (
--+__pthread_cleanup_push_defer (
-- struct _pthread_cleanup_buffer *buffer,
-- void (*routine) (void *),
-- void *arg)
--@@ -57,12 +57,12 @@ _pthread_cleanup_push_defer (
--
-- THREAD_SETMEM (self, cleanup, buffer);
-- }
---strong_alias (_pthread_cleanup_push_defer, __pthread_cleanup_push_defer)
--+strong_alias (__pthread_cleanup_push_defer, _pthread_cleanup_push_defer)
--
--
-- void
-- attribute_protected
---_pthread_cleanup_pop_restore (
--+__pthread_cleanup_pop_restore (
-- struct _pthread_cleanup_buffer *buffer,
-- int execute)
-- {
--@@ -97,4 +97,4 @@ _pthread_cleanup_pop_restore (
-- if (execute)
-- buffer->__routine (buffer->__arg);
-- }
---strong_alias (_pthread_cleanup_pop_restore, __pthread_cleanup_pop_restore)
--+strong_alias (__pthread_cleanup_pop_restore, _pthread_cleanup_pop_restore)
----- a/libpthread/nptl/init.c
--+++ b/libpthread/nptl/init.c
--@@ -112,8 +112,8 @@ static const struct pthread_functions pt
-- .ptr___pthread_key_create = __pthread_key_create_internal,
-- .ptr___pthread_getspecific = __pthread_getspecific_internal,
-- .ptr___pthread_setspecific = __pthread_setspecific_internal,
--- .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
--- .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
--+ .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
--+ .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
-- .ptr_nthreads = &__nptl_nthreads,
-- .ptr___pthread_unwind = &__pthread_unwind,
-- .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
+++ /dev/null
----- a/libpthread/nptl/init.c
--+++ b/libpthread/nptl/init.c
--@@ -402,6 +402,10 @@ __pthread_initialize_minimal_internal (v
-- Use the minimal size acceptable. */
-- limit.rlim_cur = PTHREAD_STACK_MIN;
--
--+ /* Do not exceed architecture specific default */
--+ if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
--+ limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
--+
-- /* Make sure it meets the minimum size that allocate_stack
-- (allocatestack.c) will demand, which depends on the page size. */
-- const uintptr_t pagesz = sysconf (_SC_PAGESIZE);
+++ /dev/null
----- a/Rules.mak
--+++ b/Rules.mak
--@@ -707,7 +707,6 @@ endif
-- ifeq ($(UCLIBC_HAS_THREADS),y)
-- ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-- PTNAME := nptl
--- CFLAGS += -DHAVE_FORCED_UNWIND
-- else
-- ifeq ($(LINUXTHREADS_OLD),y)
-- PTNAME := linuxthreads.old
+++ /dev/null
----- a/libc/sysdeps/linux/mips/Makefile.arch
--+++ b/libc/sysdeps/linux/mips/Makefile.arch
--@@ -20,6 +20,8 @@ ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-- SSRC += vfork.S clone.S
-- endif
--
--+CFLAGS-crt1.S += $(PICFLAG)
--+
-- ASFLAGS-syscall_error.S += -D_LIBC_REENTRANT
--
-- ARCH_HEADERS := sgidefs.h
+++ /dev/null
--commit 3e3ae40f053b22fbb9bef50067d6edad4c358c4c
--Author: Mirko Vogt <dev@nanl.de>
--Date: Tue May 24 14:36:42 2011 +0200
--
-- use 'fputws_unlocked(S,F)' instead of 'fputws(S,F)'
--
-- this eliminates a source of reproduceable freezes
--
----- a/libc/stdio/_vfprintf.c
--+++ b/libc/stdio/_vfprintf.c
--@@ -1229,7 +1229,7 @@ static size_t _fp_out_narrow(FILE *fp, i
-- #define STRLEN wcslen
-- #define _PPFS_init _ppwfs_init
-- /* Pulls in fseek: */
---#define OUTPUT(F,S) fputws(S,F)
--+#define OUTPUT(F,S) fputws_unlocked(S,F)
-- /* TODO: #define OUTPUT(F,S) _wstdio_fwrite((S),wcslen(S),(F)) */
-- #define _outnwcs(stream, wstring, len) _wstdio_fwrite((const wchar_t *)(wstring), len, stream)
-- #define FP_OUT _fp_out_wide
+++ /dev/null
----- a/libc/stdio/_stdio.c
--+++ b/libc/stdio/_stdio.c
--@@ -124,7 +124,7 @@ static FILE _stdio_streams[] = {
-- __FLAG_NBF|__FLAG_WRITEONLY, \
-- 2, \
-- NULL, \
--- NULL, \
--+ 0, \
-- 0 )
-- };
--
+++ /dev/null
----- a/libc/sysdeps/linux/powerpc/Makefile.arch
--+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
--@@ -5,7 +5,7 @@
-- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-- #
--
---CSRC := __syscall_error.c pread_write.c ioctl.c
--+CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
--
-- ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-- CSRC += posix_fadvise.c posix_fadvise64.c
----- /dev/null
--+++ b/libc/sysdeps/linux/powerpc/copysignl.c
--@@ -0,0 +1,89 @@
--+/* s_copysignl.c -- long double version of s_copysign.c.
--+ * Conversion to long double by Ulrich Drepper,
--+ * Cygnus Support, drepper@cygnus.com.
--+ */
--+
--+/*
--+ * ====================================================
--+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
--+ *
--+ * Developed at SunPro, a Sun Microsystems, Inc. business.
--+ * Permission to use, copy, modify, and distribute this
--+ * software is freely granted, provided that this notice
--+ * is preserved.
--+ * ====================================================
--+ */
--+
--+/*
--+ * copysignl(long double x, long double y)
--+ * copysignl(x,y) returns a value with the magnitude of x and
--+ * with the sign bit of y.
--+ */
--+
--+#include <endian.h>
--+#include <stdint.h>
--+
--+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
--+
--+typedef union
--+{
--+ long double value;
--+ struct
--+ {
--+ int sign_exponent:16;
--+ unsigned int empty:16;
--+ uint32_t msw;
--+ uint32_t lsw;
--+ } parts;
--+} ieee_long_double_shape_type;
--+
--+#endif
--+
--+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
--+
--+typedef union
--+{
--+ long double value;
--+ struct
--+ {
--+ uint32_t lsw;
--+ uint32_t msw;
--+ int sign_exponent:16;
--+ unsigned int empty:16;
--+ } parts;
--+} ieee_long_double_shape_type;
--+
--+#endif
--+
--+/* Get int from the exponent of a long double. */
--+
--+#define GET_LDOUBLE_EXP(exp,d) \
--+do { \
--+ ieee_long_double_shape_type ge_u; \
--+ ge_u.value = (d); \
--+ (exp) = ge_u.parts.sign_exponent; \
--+} while (0)
--+
--+/* Set exponent of a long double from an int. */
--+
--+#define SET_LDOUBLE_EXP(d,exp) \
--+do { \
--+ ieee_long_double_shape_type se_u; \
--+ se_u.value = (d); \
--+ se_u.parts.sign_exponent = (exp); \
--+ (d) = se_u.value; \
--+} while (0)
--+
--+long double copysignl(long double x, long double y);
--+libc_hidden_proto(copysignl);
--+
--+long double copysignl(long double x, long double y)
--+{
--+ uint32_t es1,es2;
--+ GET_LDOUBLE_EXP(es1,x);
--+ GET_LDOUBLE_EXP(es2,y);
--+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
--+ return x;
--+}
--+
--+libc_hidden_def(copysignl);
+++ /dev/null
----- a/libc/sysdeps/linux/powerpc/sys/ptrace.h
--+++ b/libc/sysdeps/linux/powerpc/sys/ptrace.h
--@@ -1,5 +1,5 @@
-- /* `ptrace' debugger support interface. Linux version.
--- Copyright (C) 2001 Free Software Foundation, Inc.
--+ Copyright (C) 2001, 2006, 2007, 2011 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
--
-- The GNU C Library is free software; you can redistribute it and/or
--@@ -13,9 +13,8 @@
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
--- License along with the GNU C Library; if not, write to the Free
--- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
--- 02111-1307 USA. */
--+ License along with the GNU C Library; if not, see
--+ <http://www.gnu.org/licenses/>. */
--
-- #ifndef _SYS_PTRACE_H
-- #define _SYS_PTRACE_H 1
--@@ -79,8 +78,73 @@ enum __ptrace_request
-- #define PT_DETACH PTRACE_DETACH
--
-- /* Continue and stop at the next (return from) syscall. */
--- PTRACE_SYSCALL = 24
--+ PTRACE_SYSCALL = 24,
-- #define PT_SYSCALL PTRACE_SYSCALL
--+
--+ /* Set ptrace filter options. */
--+ PTRACE_SETOPTIONS = 0x4200,
--+#define PT_SETOPTIONS PTRACE_SETOPTIONS
--+
--+ /* Get last ptrace message. */
--+ PTRACE_GETEVENTMSG = 0x4201,
--+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
--+
--+ /* Get siginfo for process. */
--+ PTRACE_GETSIGINFO = 0x4202,
--+#define PT_GETSIGINFO PTRACE_GETSIGINFO
--+
--+ /* Set new siginfo for process. */
--+ PTRACE_SETSIGINFO = 0x4203,
--+#define PT_SETSIGINFO PTRACE_SETSIGINFO
--+
--+ /* Get register content. */
--+ PTRACE_GETREGSET = 0x4204,
--+#define PTRACE_GETREGSET PTRACE_GETREGSET
--+
--+ /* Set register content. */
--+ PTRACE_SETREGSET = 0x4205,
--+#define PTRACE_SETREGSET PTRACE_SETREGSET
--+
--+ /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
--+ signal or group stop state. */
--+ PTRACE_SEIZE = 0x4206,
--+#define PTRACE_SEIZE PTRACE_SEIZE
--+
--+ /* Trap seized tracee. */
--+ PTRACE_INTERRUPT = 0x4207,
--+#define PTRACE_INTERRUPT PTRACE_INTERRUPT
--+
--+ /* Wait for next group event. */
--+ PTRACE_LISTEN = 0x4208
--+};
--+
--+
--+/* Flag for PTRACE_LISTEN. */
--+enum __ptrace_flags
--+{
--+ PTRACE_SEIZE_DEVEL = 0x80000000
--+};
--+
--+/* Options set using PTRACE_SETOPTIONS. */
--+enum __ptrace_setoptions {
--+ PTRACE_O_TRACESYSGOOD = 0x00000001,
--+ PTRACE_O_TRACEFORK = 0x00000002,
--+ PTRACE_O_TRACEVFORK = 0x00000004,
--+ PTRACE_O_TRACECLONE = 0x00000008,
--+ PTRACE_O_TRACEEXEC = 0x00000010,
--+ PTRACE_O_TRACEVFORKDONE = 0x00000020,
--+ PTRACE_O_TRACEEXIT = 0x00000040,
--+ PTRACE_O_MASK = 0x0000007f
--+};
--+
--+/* Wait extended result codes for the above trace options. */
--+enum __ptrace_eventcodes {
--+ PTRACE_EVENT_FORK = 1,
--+ PTRACE_EVENT_VFORK = 2,
--+ PTRACE_EVENT_CLONE = 3,
--+ PTRACE_EVENT_EXEC = 4,
--+ PTRACE_EVENT_VFORK_DONE = 5,
--+ PTRACE_EVENT_EXIT = 6
-- };
--
-- /* Perform process tracing functions. REQUEST is one of the values
+++ /dev/null
----- a/libc/sysdeps/linux/powerpc/syscall.S
--+++ b/libc/sysdeps/linux/powerpc/syscall.S
--@@ -30,6 +30,7 @@ syscall:
-- mr 5,6
-- mr 6,7
-- mr 7,8
--+ mr 8,9
-- sc
-- bnslr;
--
+++ /dev/null
----- a/ldso/ldso/powerpc/elfinterp.c
--+++ b/ldso/ldso/powerpc/elfinterp.c
--@@ -297,22 +297,17 @@ _dl_do_reloc (struct elf_resolve *tpnt,s
-- break;
-- #endif
-- case R_PPC_REL24:
---#if 0
-- {
-- Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
-- if (unlikely(delta<<6>>6 != delta)) {
-- _dl_dprintf(2, "%s: symbol '%s' R_PPC_REL24 is out of range.\n\t"
-- "Compile shared libraries with -fPIC!\n",
-- _dl_progname, symname);
--- _dl_exit(1);
--+ return -1;
-- }
-- *reloc_addr = (*reloc_addr & 0xfc000003) | (delta & 0x3fffffc);
-- break;
-- }
---#else
--- _dl_dprintf(2,"R_PPC_REL24: Compile shared libraries with -fPIC!\n");
--- return -1;
---#endif
-- case R_PPC_NONE:
-- goto out_nocode; /* No code code modified */
-- default:
+++ /dev/null
--From 7810e4f8027b5c4c8ceec6fefec4eb779362ebb5 Mon Sep 17 00:00:00 2001
--From: Khem Raj <raj.khem@gmail.com>
--Date: Sun, 10 Jun 2012 16:36:23 +0000
--Subject: eventfd: Implement eventfd2 and fix eventfd
--
--eventfd: evntfd assumes to take two arguments instead it
--should be one evntfd expects two therefore implement both syscalls with
--correct parameters
--
--Thanks Eugene Rudoy for reporting it and also providing the patch
--
--Signed-off-by: Khem Raj <raj.khem@gmail.com>
-----
----- a/libc/sysdeps/linux/common/eventfd.c
--+++ b/libc/sysdeps/linux/common/eventfd.c
--@@ -7,12 +7,24 @@
-- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-- */
--
--+#include <errno.h>
-- #include <sys/syscall.h>
-- #include <sys/eventfd.h>
--
-- /*
-- * eventfd()
-- */
---#ifdef __NR_eventfd
---_syscall2(int, eventfd, int, count, int, flags)
--+#if defined __NR_eventfd || defined __NR_eventfd2
--+int eventfd (int count, int flags)
--+{
--+#if defined __NR_eventfd2
--+ return INLINE_SYSCALL (eventfd2, 2, count, flags);
--+#elif defined __NR_eventfd
--+ if (flags != 0) {
--+ __set_errno (EINVAL);
--+ return -1;
--+ }
--+ return INLINE_SYSCALL (eventfd, 1, count);
--+#endif
--+}
-- #endif
----- a/libc/sysdeps/linux/common/stubs.c
--+++ b/libc/sysdeps/linux/common/stubs.c
--@@ -93,7 +93,7 @@ make_stub(epoll_ctl)
-- make_stub(epoll_wait)
-- #endif
--
---#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__
--+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__
-- make_stub(eventfd)
-- #endif
--
+++ /dev/null
--From 603af30d6992e94ac30a66b953264076f4f2fd71 Mon Sep 17 00:00:00 2001
--From: Markos Chandras <markos.chandras@imgtec.com>
--Date: Thu, 11 Jul 2013 16:59:16 +0000
--Subject: Rules.mak: MIPS64: Select correct interpreter
--
--gcc (eg 4.7.3) hardcodes the MIPS64 interpreters like this:
--(see gcc/config/linux.h and gcc/config/mips/linux64.h)
--
--o32: UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
--n32: UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
--n64: UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
--
--The existing check for MIPS64 in uClibc is wrong because it does
--not respect the selected ABI
--
--We fix this by explicitely checking the selected ABI instead of the
--selected MIPS variant.
--
--Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
--Cc: Anthony G. Basile <blueness@gentoo.org>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
--
----- a/Rules.mak
--+++ b/Rules.mak
--@@ -118,13 +118,19 @@ export MAJOR_VERSION MINOR_VERSION SUBLE
-- LIBC := libc
-- SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION)
-- UBACKTRACE_DSO := libubacktrace.so.$(ABI_VERSION)
---ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 mips64 powerpc64 s390x sparc64 x86_64 ),)
--+
--+UCLIBC_LDSO_NAME := ld-uClibc
--+ARCH_NATIVE_BIT := 32
--+ifneq ($(findstring $(TARGET_ARCH),hppa64 ia64 powerpc64 s390x sparc64 x86_64),)
-- UCLIBC_LDSO_NAME := ld64-uClibc
-- ARCH_NATIVE_BIT := 64
-- else
---UCLIBC_LDSO_NAME := ld-uClibc
---ARCH_NATIVE_BIT := 32
--+ifeq ($(CONFIG_MIPS_N64_ABI),y)
--+UCLIBC_LDSO_NAME := ld64-uClibc
--+ARCH_NATIVE_BIT := 64
-- endif
--+endif
--+
-- UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
-- NONSHARED_LIBNAME := uclibc_nonshared.a
-- libc := $(top_builddir)lib/$(SHARED_LIBNAME)
+++ /dev/null
--commit e5cde2eb0ed7df9416fdd6070af07c8448c72a30
--Author: Steve Ellcey <sellcey@mips.com>
--Date: Wed Feb 12 11:01:35 2014 -0800
--
-- mips: Remove duplicate macro definitions
--
-- The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros
-- are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and
-- libc/sysdeps/linux/mips/bits/syscalls.h. The macros are the same
-- in both cases except that syscalls.h defines internal_syscalls[567]
-- the same for N32 and N64 ABIs and has a different definition for O32.
-- I believe that is correct. The sysdep.h header uses the O32 versions
-- for N32 and has different definitions for N64. I think that is wrong
-- and that N32 and N64 should share the same definition (modulo the
-- type 'long' vs. 'long long' for the arguments. This setup (from
-- sysdep.h) now agrees with what glibc has.
--
-- I am not positive about which header (sysdep.h vs syscalls.h) is
-- really the right one to have these definitions in but using sysdep.h
-- seems to work for all my builds.
--
-- Signed-off-by: Steve Ellcey <sellcey@mips.com>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
----- a/libc/sysdeps/linux/mips/sysdep.h
--+++ b/libc/sysdeps/linux/mips/sysdep.h
--@@ -133,258 +133,6 @@ L(syse1):
--
-- #else /* ! __ASSEMBLER__ */
--
---/* Define a macro which expands into the inline wrapper code for a system
--- call. */
---#undef INLINE_SYSCALL
---#define INLINE_SYSCALL(name, nr, args...) \
--- ({ INTERNAL_SYSCALL_DECL(err); \
--- long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
--- if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
--- { \
--- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
--- result_var = -1L; \
--- } \
--- result_var; })
---
---#undef INTERNAL_SYSCALL_DECL
---#define INTERNAL_SYSCALL_DECL(err) long err
---
---#undef INTERNAL_SYSCALL_ERROR_P
---#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err))
---
---#undef INTERNAL_SYSCALL_ERRNO
---#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
---
---#undef INTERNAL_SYSCALL
---#define INTERNAL_SYSCALL(name, err, nr, args...) \
--- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
--- "i" (SYS_ify (name)), err, args)
---
---#undef INTERNAL_SYSCALL_NCS
---#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
--- internal_syscall##nr (= number, , "r" (__v0), err, args)
---#undef internal_syscall0
---#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
---({ \
--- long _sys_result; \
--- \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a3 __asm__("$7"); \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- ".set reorder" \
--- : "=r" (__v0), "=r" (__a3) \
--- : input \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall1
---#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
---({ \
--- long _sys_result; \
--- \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a3 __asm__("$7"); \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- ".set reorder" \
--- : "=r" (__v0), "=r" (__a3) \
--- : input, "r" (__a0) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall2
---#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
---({ \
--- long _sys_result; \
--- \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a3 __asm__("$7"); \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "=r" (__a3) \
--- : input, "r" (__a0), "r" (__a1) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall3
---#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\
---({ \
--- long _sys_result; \
--- \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a2 __asm__("$6") = (long) arg3; \
--- register long __a3 __asm__("$7"); \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "=r" (__a3) \
--- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall4
---#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\
---({ \
--- long _sys_result; \
--- \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a2 __asm__("$6") = (long) arg3; \
--- register long __a3 __asm__("$7") = (long) arg4; \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "+r" (__a3) \
--- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---/* We need to use a frame pointer for the functions in which we
--- adjust $sp around the syscall, or debug information and unwind
--- information will be $sp relative and thus wrong during the syscall. As
--- of GCC 3.4.3, this is sufficient. */
---#define FORCE_FRAME_POINTER alloca (4)
---
---#undef internal_syscall5
---#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\
---({ \
--- long _sys_result; \
--- \
--- FORCE_FRAME_POINTER; \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a2 __asm__("$6") = (long) arg3; \
--- register long __a3 __asm__("$7") = (long) arg4; \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- "subu\t$29, 32\n\t" \
--- "sw\t%6, 16($29)\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- "addiu\t$29, 32\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "+r" (__a3) \
--- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
--- "r" ((long)arg5) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall6
---#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\
---({ \
--- long _sys_result; \
--- \
--- FORCE_FRAME_POINTER; \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a2 __asm__("$6") = (long) arg3; \
--- register long __a3 __asm__("$7") = (long) arg4; \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- "subu\t$29, 32\n\t" \
--- "sw\t%6, 16($29)\n\t" \
--- "sw\t%7, 20($29)\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- "addiu\t$29, 32\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "+r" (__a3) \
--- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
--- "r" ((long)arg5), "r" ((long)arg6) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef internal_syscall7
---#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
---({ \
--- long _sys_result; \
--- \
--- FORCE_FRAME_POINTER; \
--- { \
--- register long __v0 __asm__("$2") ncs_init; \
--- register long __a0 __asm__("$4") = (long) arg1; \
--- register long __a1 __asm__("$5") = (long) arg2; \
--- register long __a2 __asm__("$6") = (long) arg3; \
--- register long __a3 __asm__("$7") = (long) arg4; \
--- __asm__ __volatile__ ( \
--- ".set\tnoreorder\n\t" \
--- "subu\t$29, 32\n\t" \
--- "sw\t%6, 16($29)\n\t" \
--- "sw\t%7, 20($29)\n\t" \
--- "sw\t%8, 24($29)\n\t" \
--- cs_init \
--- "syscall\n\t" \
--- "addiu\t$29, 32\n\t" \
--- ".set\treorder" \
--- : "=r" (__v0), "+r" (__a3) \
--- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
--- "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \
--- : __SYSCALL_CLOBBERS); \
--- err = __a3; \
--- _sys_result = __v0; \
--- } \
--- _sys_result; \
---})
---
---#undef __SYSCALL_CLOBBERS
---#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
--- "$14", "$15", "$24", "$25", "memory"
---
-- /* Pointer mangling is not yet supported for MIPS. */
-- #define PTR_MANGLE(var) (void) (var)
-- #define PTR_DEMANGLE(var) (void) (var)
+++ /dev/null
--commit 2952c70804b48bb5c87eea21df5e401969dc4ec1
--Author: Kevin Cernekee <cernekee@gmail.com>
--Date: Tue Jun 5 15:05:20 2012 -0700
--
-- MIPS: Use $a0 instead of $v0 for __syscall_error() argument
--
-- $a0 is saved across _dl_runtime_resolve(); $v0 is not. Unfortunately,
-- __syscall_error() uses $v0 for its argument, not $a0 as is the MIPS ABI
-- standard. This means that if lazy binding was used for __syscall_error(),
-- the errno value in $v0 could get corrupted.
--
-- The problem can be easily seen in testcases where syscalls in librt fail;
-- when librt tries to call __syscall_error() in libc, the argument gets
-- lost and errno gets set to a bogus value:
--
-- # ./tst-mqueue1 ; echo $?
-- mq_receive on O_WRONLY mqd_t did not fail with EBADF: Unknown error 2004684208
-- 1
-- # ./tst-mqueue2 ; echo $?
-- mq_timedreceive with too small msg_len did not fail with EMSGSIZE: Unknown error 1997360560
-- 1
-- # ./tst-mqueue4 ; echo $?
-- mq_timedsend did not fail with ETIMEDOUT: Unknown error 2008747440
-- 1
--
-- When _dl_runtime_resolve() was taken out of the equation, the same test
-- cases passed:
--
-- # LD_BIND_NOW=y ./tst-mqueue1 ; echo $?
-- 0
-- # LD_BIND_NOW=y ./tst-mqueue2 ; echo $?
-- 0
-- # LD_BIND_NOW=y ./tst-mqueue4 ; echo $?
-- 0
--
-- Changing __syscall_error() to look at $a0 instead of $v0 fixed the
-- problem.
--
-- (Note that there is also a "__syscall_error.c" file which presumably
-- uses the standard C calling conventions, but I do not think it is used
-- on MIPS.)
--
-- Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
--commit 3c58d95d918c7e2fda374c37a52f81b34b81e4ca
--Author: Kevin Cernekee <cernekee@gmail.com>
--Date: Tue Jun 5 15:05:19 2012 -0700
--
-- MIPS: Convert __syscall_error() callers to use $a0 for argument
--
-- Some callers passed the first argument in $v0, while others used $a0.
-- Change the callers to use $a0 consistently.
--
-- Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
----- a/libc/sysdeps/linux/mips/vfork.S
--+++ b/libc/sysdeps/linux/mips/vfork.S
--@@ -84,6 +84,7 @@ NESTED(__vfork,FRAMESZ,sp)
--
-- /* Something bad happened -- no child created. */
-- L(error):
--+ move a0, v0
-- #ifdef __PIC__
-- PTR_LA t9, __syscall_error
-- RESTORE_GP64
----- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
--+++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
--@@ -31,7 +31,7 @@
-- # undef PSEUDO
-- # define PSEUDO(name, syscall_name, args) \
-- .align 2; \
--- 99: \
--+ 99: move a0, v0; \
-- PTR_LA t9,__syscall_error; \
-- /* manual cpreturn. */ \
-- REG_L gp, STKOFF_GP(sp); \
----- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
--+++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
--@@ -80,6 +80,7 @@ NESTED(__vfork,FRAMESZ,sp)
--
-- /* Something bad happened -- no child created. */
-- L(error):
--+ move a0, v0
-- #ifdef __PIC__
-- PTR_LA t9, __syscall_error
-- RESTORE_GP64
----- a/libc/sysdeps/linux/mips/syscall_error.S
--+++ b/libc/sysdeps/linux/mips/syscall_error.S
--@@ -43,7 +43,7 @@ ENTRY(__syscall_error)
-- #ifdef __PIC__
-- SAVE_GP(GPOFF)
-- #endif
--- REG_S v0, V0OFF(sp)
--+ REG_S a0, V0OFF(sp)
-- REG_S ra, RAOFF(sp)
--
-- /* Find our per-thread errno address */
+++ /dev/null
--commit 052bcf13afb067cafac5e7f4fc21fbad2b34b11f
--Author: Waldemar Brodkorb <wbx@openadk.org>
--Date: Wed Nov 27 09:55:51 2013 +0100
--
-- Fix for SIGBUS error on MIPS64 with N64 ABI
--
-- When accessing errno, a per thread variable, from _stdio_init
-- a SIGBUS error happens. This change fixes the wrong relocation
-- and debug output.
--
-- Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
----- a/ldso/ldso/mips/elfinterp.c
--+++ b/ldso/ldso/mips/elfinterp.c
--@@ -259,11 +259,11 @@ int _dl_parse_relocation_information(str
-- case R_MIPS_TLS_TPREL32:
-- case R_MIPS_TLS_TPREL64:
-- CHECK_STATIC_TLS((struct link_map *)tls_tpnt);
--- *(ElfW(Word) *)reloc_addr +=
--+ *(ElfW(Addr) *)reloc_addr +=
-- TLS_TPREL_VALUE (tls_tpnt, symbol_addr);
-- #ifdef __SUPPORT_LD_DEBUG__
-- _dl_dprintf(2, "TLS_TPREL : %s, %x, %x\n",
--- symname, old_val, *((unsigned int *)reloc_addr));
--+ symname, old_val, *((unsigned long *)reloc_addr));
-- #endif
-- break;
-- }
+++ /dev/null
----- a/ldso/ldso/mips/elfinterp.c
--+++ b/ldso/ldso/mips/elfinterp.c
--@@ -239,7 +239,7 @@ int _dl_parse_relocation_information(str
-- case R_MIPS_TLS_DTPMOD64:
-- case R_MIPS_TLS_DTPMOD32:
-- if (tls_tpnt)
--- *(ElfW(Word) *)reloc_addr = tls_tpnt->l_tls_modid;
--+ *(ElfW(Addr) *)reloc_addr = tls_tpnt->l_tls_modid;
-- #ifdef __SUPPORT_LD_DEBUG__
-- _dl_dprintf(2, "TLS_DTPMOD : %s, %d, %d\n",
-- symname, old_val, *((unsigned int *)reloc_addr));
--@@ -248,7 +248,7 @@ int _dl_parse_relocation_information(str
--
-- case R_MIPS_TLS_DTPREL64:
-- case R_MIPS_TLS_DTPREL32:
--- *(ElfW(Word) *)reloc_addr +=
--+ *(ElfW(Addr) *)reloc_addr +=
-- TLS_DTPREL_VALUE (symbol_addr);
-- #ifdef __SUPPORT_LD_DEBUG__
-- _dl_dprintf(2, "TLS_DTPREL : %s, %x, %x\n",
+++ /dev/null
--commit 70a04a287a2875c82e6822c36e071afba5b63a62
--Author: Waldemar Brodkorb <wbx@openadk.org>
--Date: Wed Jan 29 18:58:56 2014 +0100
--
-- libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI
--
-- When booting a Linux system with qemu-system-mips64 the execution
-- of $(pwd) in the ash shell triggers a segmentation fault. Ash uses
-- setjmp/longjmp for exception handling.
--
-- After looking at the glibc implementation,
-- I found some differences, with this patch tries to resolve.
-- Now the system boots up fine and no segmentation faults occur.
--
-- The global pointer should be restored and the types for the
-- register values should be wide enough.
--
-- See:
-- http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html
--
-- Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
----- a/libc/sysdeps/linux/mips/bits/setjmp.h
--+++ b/libc/sysdeps/linux/mips/bits/setjmp.h
--@@ -26,13 +26,19 @@
--
-- #include <sgidefs.h>
--
--+#if _MIPS_SIM == _MIPS_SIM_ABI32
--+#define ptrsize void *
--+#else
--+#define ptrsize long long
--+#endif
--+
-- typedef struct
-- {
-- /* Program counter. */
--- void * __pc;
--+ ptrsize __pc;
--
-- /* Stack pointer. */
--- void * __sp;
--+ ptrsize __sp;
--
-- /* Callee-saved registers s0 through s7. */
-- #if _MIPS_SIM == _MIPS_SIM_ABI32
--@@ -42,10 +48,10 @@ typedef struct
-- #endif
--
-- /* The frame pointer. */
--- void * __fp;
--+ ptrsize __fp;
--
-- /* The global pointer. */
--- void * __gp;
--+ ptrsize __gp;
--
-- /* Floating point status register. */
-- int __fpc_csr;
----- a/libc/sysdeps/linux/mips/setjmp.S
--+++ b/libc/sysdeps/linux/mips/setjmp.S
--@@ -53,6 +53,7 @@ __sigsetjmp:
-- PTR_LA t9, __sigsetjmp_aux
-- #if _MIPS_SIM != _MIPS_SIM_ABI32
-- .cpreturn
--+ move a4, gp
-- #endif
-- jr t9
-- #else
----- a/libc/sysdeps/linux/mips/setjmp_aux.c
--+++ b/libc/sysdeps/linux/mips/setjmp_aux.c
--@@ -31,7 +31,7 @@ extern int __sigjmp_save (sigjmp_buf, in
--
-- int
-- #if _MIPS_SIM == _MIPS_SIM_ABI64
---__sigsetjmp_aux (jmp_buf env, int savemask, long sp, long fp)
--+__sigsetjmp_aux (jmp_buf env, int savemask, long long sp, long long fp, long long gp)
-- #else /* O32 || N32 */
-- __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
-- #endif /* O32 || N32 */
--@@ -65,14 +65,14 @@ __sigsetjmp_aux (jmp_buf env, int savema
-- #endif
--
-- /* .. and the stack pointer; */
--- env[0].__jmpbuf[0].__sp = (void *) sp;
--+ env[0].__jmpbuf[0].__sp = (ptrsize) sp;
--
-- /* .. and the FP; it'll be in s8. */
--- env[0].__jmpbuf[0].__fp = (void *) fp;
--+ env[0].__jmpbuf[0].__fp = (ptrsize) fp;
--
-- /* .. and the GP; */
-- #if _MIPS_SIM == _MIPS_SIM_ABI64
--- __asm__ __volatile__ ("sd $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
--+ env[0].__jmpbuf[0].__gp = (ptrsize) gp;
-- #else
-- __asm__ __volatile__ ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
-- #endif
+++ /dev/null
--commit b97b4b698b023f75b54f987859c856ab4861ea00
--Author: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
--Date: Thu Jan 2 15:02:12 2014 +0000
--
-- siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into account
--
-- Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips
-- and ia64 arches.
--
-- Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
-- Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--
----- a/libc/sysdeps/linux/alpha/bits/siginfo.h
--+++ b/libc/sysdeps/linux/alpha/bits/siginfo.h
--@@ -258,7 +258,11 @@ enum
--
-- /* Structure to transport application-defined values with signals. */
-- # define __SIGEV_MAX_SIZE 64
---# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
--+# if __WORDSIZE == 64
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
--+# else
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
--+# endif
--
-- typedef struct sigevent
-- {
----- a/libc/sysdeps/linux/ia64/bits/siginfo.h
--+++ b/libc/sysdeps/linux/ia64/bits/siginfo.h
--@@ -298,7 +298,11 @@ enum
--
-- /* Structure to transport application-defined values with signals. */
-- # define __SIGEV_MAX_SIZE 64
---# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
--+# if __WORDSIZE == 64
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
--+# else
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
--+# endif
--
-- typedef struct sigevent
-- {
----- a/libc/sysdeps/linux/mips/bits/siginfo.h
--+++ b/libc/sysdeps/linux/mips/bits/siginfo.h
--@@ -265,8 +265,11 @@ enum
--
-- /* Structure to transport application-defined values with signals. */
-- # define __SIGEV_MAX_SIZE 64
---# define __SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
---# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE - __SIGEV_HEAD_SIZE) / sizeof (int))
--+# if __WORDSIZE == 64
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
--+# else
--+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
--+# endif
--
-- /* Forward declaration of the `pthread_attr_t' type. */
-- struct __pthread_attr_s;
+++ /dev/null
----- a/libc/sysdeps/linux/common/xstatconv.c
--+++ b/libc/sysdeps/linux/common/xstatconv.c
--@@ -39,9 +39,12 @@ void __xstat_conv(struct kernel_stat *kb
-- buf->st_size = kbuf->st_size;
-- buf->st_blksize = kbuf->st_blksize;
-- buf->st_blocks = kbuf->st_blocks;
--- buf->st_atim = kbuf->st_atim;
--- buf->st_mtim = kbuf->st_mtim;
--- buf->st_ctim = kbuf->st_ctim;
--+ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
--+ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
--+ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
--+ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
--+ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
--+ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
-- }
--
-- void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
--@@ -58,9 +61,12 @@ void __xstat32_conv(struct kernel_stat64
-- buf->st_size = kbuf->st_size;
-- buf->st_blksize = kbuf->st_blksize;
-- buf->st_blocks = kbuf->st_blocks;
--- buf->st_atim = kbuf->st_atim;
--- buf->st_mtim = kbuf->st_mtim;
--- buf->st_ctim = kbuf->st_ctim;
--+ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
--+ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
--+ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
--+ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
--+ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
--+ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
-- }
--
-- #ifdef __UCLIBC_HAS_LFS__
--@@ -82,9 +88,12 @@ void __xstat64_conv(struct kernel_stat64
-- buf->st_size = kbuf->st_size;
-- buf->st_blksize = kbuf->st_blksize;
-- buf->st_blocks = kbuf->st_blocks;
--- buf->st_atim = kbuf->st_atim;
--- buf->st_mtim = kbuf->st_mtim;
--- buf->st_ctim = kbuf->st_ctim;
--+ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
--+ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
--+ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
--+ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
--+ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
--+ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
-- }
--
-- #endif /* __UCLIBC_HAS_LFS__ */
----- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
--+++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
--@@ -8,6 +8,18 @@
-- #include <sgidefs.h>
--
-- #if _MIPS_SIM == _MIPS_SIM_ABI64
--+typedef struct {
--+ unsigned int tv_sec;
--+ unsigned int tv_nsec;
--+} __ktimespec_t;
--+#else
--+typedef struct {
--+ time_t tv_sec;
--+ unsigned long tv_nsec;
--+} __ktimespec_t;
--+#endif
--+
--+#if _MIPS_SIM == _MIPS_SIM_ABI64
-- /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
-- struct kernel_stat {
-- __kernel_dev_t st_dev;
--@@ -20,9 +32,9 @@ struct kernel_stat {
-- __kernel_dev_t st_rdev;
-- unsigned int st_pad2[3];
-- __kernel_off_t st_size;
--- struct timespec st_atim;
--- struct timespec st_mtim;
--- struct timespec st_ctim;
--+ __ktimespec_t st_atim;
--+ __ktimespec_t st_mtim;
--+ __ktimespec_t st_ctim;
-- unsigned int st_blksize;
-- unsigned int reserved3;
-- unsigned long st_blocks;
--@@ -41,9 +53,9 @@ struct kernel_stat {
-- unsigned int st_rdev;
-- unsigned int st_pad2[3];
-- unsigned long long st_size;
--- struct timespec st_atim;
--- struct timespec st_mtim;
--- struct timespec st_ctim;
--+ __ktimespec_t st_atim;
--+ __ktimespec_t st_mtim;
--+ __ktimespec_t st_ctim;
-- unsigned int st_blksize;
-- unsigned int reserved3;
-- unsigned long long st_blocks;
--@@ -62,9 +74,9 @@ struct kernel_stat {
-- long st_pad2[2];
-- __kernel_off_t st_size;
-- long st_pad3;
--- struct timespec st_atim;
--- struct timespec st_mtim;
--- struct timespec st_ctim;
--+ __ktimespec_t st_atim;
--+ __ktimespec_t st_mtim;
--+ __ktimespec_t st_ctim;
-- long st_blksize;
-- long st_blocks;
-- long st_pad4[14];
--@@ -81,9 +93,9 @@ struct kernel_stat64 {
-- unsigned long st_rdev;
-- unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
-- long long st_size;
--- struct timespec st_atim;
--- struct timespec st_mtim;
--- struct timespec st_ctim;
--+ __ktimespec_t st_atim;
--+ __ktimespec_t st_mtim;
--+ __ktimespec_t st_ctim;
-- unsigned long st_blksize;
-- unsigned long st_pad2;
-- long long st_blocks;
+++ /dev/null
----- a/libc/sysdeps/linux/mips/bits/setjmp.h
--+++ b/libc/sysdeps/linux/mips/bits/setjmp.h
--@@ -27,18 +27,18 @@
-- #include <sgidefs.h>
--
-- #if _MIPS_SIM == _MIPS_SIM_ABI32
---#define ptrsize void *
--+#define __setjmp_ptr void *
-- #else
---#define ptrsize long long
--+#define __setjmp_ptr long long
-- #endif
--
-- typedef struct
-- {
-- /* Program counter. */
--- ptrsize __pc;
--+ __setjmp_ptr __pc;
--
-- /* Stack pointer. */
--- ptrsize __sp;
--+ __setjmp_ptr __sp;
--
-- /* Callee-saved registers s0 through s7. */
-- #if _MIPS_SIM == _MIPS_SIM_ABI32
--@@ -48,10 +48,10 @@ typedef struct
-- #endif
--
-- /* The frame pointer. */
--- ptrsize __fp;
--+ __setjmp_ptr __fp;
--
-- /* The global pointer. */
--- ptrsize __gp;
--+ __setjmp_ptr __gp;
--
-- /* Floating point status register. */
-- int __fpc_csr;
----- a/libc/sysdeps/linux/mips/setjmp_aux.c
--+++ b/libc/sysdeps/linux/mips/setjmp_aux.c
--@@ -65,14 +65,14 @@ __sigsetjmp_aux (jmp_buf env, int savema
-- #endif
--
-- /* .. and the stack pointer; */
--- env[0].__jmpbuf[0].__sp = (ptrsize) sp;
--+ env[0].__jmpbuf[0].__sp = (__setjmp_ptr) sp;
--
-- /* .. and the FP; it'll be in s8. */
--- env[0].__jmpbuf[0].__fp = (ptrsize) fp;
--+ env[0].__jmpbuf[0].__fp = (__setjmp_ptr) fp;
--
-- /* .. and the GP; */
-- #if _MIPS_SIM == _MIPS_SIM_ABI64
--- env[0].__jmpbuf[0].__gp = (ptrsize) gp;
--+ env[0].__jmpbuf[0].__gp = (__setjmp_ptr) gp;
-- #else
-- __asm__ __volatile__ ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
-- #endif
+++ /dev/null
----- a/libc/sysdeps/linux/mips/sysdep.h
--+++ b/libc/sysdeps/linux/mips/sysdep.h
--@@ -96,7 +96,8 @@
-- backwards into the previous fn. */
--
-- #ifdef __PIC__
---#define PSEUDO(name, syscall_name, args) \
--+# if _MIPS_SIM == _ABIO32
--+# define PSEUDO(name, syscall_name, args) \
-- .align 2; \
-- 99: move a0, v0; \
-- la t9,__syscall_error; \
--@@ -109,6 +110,23 @@
-- .set reorder; \
-- bne a3, zero, 99b; \
-- L(syse1):
--+# else
--+# define PSEUDO(name, syscall_name, args) \
--+ .align 2; \
--+ 99: \
--+ .set noat; \
--+ .cpsetup t9, $1, name; \
--+ .set at; \
--+ move a0, v0; \
--+ dla t9,__syscall_error; \
--+ .cpreturn; \
--+ jr t9; \
--+ ENTRY(name) \
--+ li v0, SYS_ify(syscall_name); \
--+ syscall; \
--+ bne a3, zero, 99b; \
--+L(syse1):
--+# endif
-- #else
-- #define PSEUDO(name, syscall_name, args) \
-- .set noreorder; \
+++ /dev/null
----- a/extra/Configs/Config.in
--+++ b/extra/Configs/Config.in
--@@ -235,6 +235,7 @@ config TARGET_SUBARCH
-- default "i486" if CONFIG_486
-- default "i586" if CONFIG_586 || CONFIG_586MMX
-- default "i686" if TARGET_ARCH = "i386"
--+ default "mips64" if CONFIG_MIPS_N64_ABI
-- default ""
--
-- source "extra/Configs/Config.in.arch"
----- /dev/null
--+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
--@@ -0,0 +1,182 @@
--+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library. If not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#include <sysdep.h>
--+#include <tls.h>
--+#ifndef __ASSEMBLER__
--+# include <pthreadP.h>
--+#endif
--+#include <sys/asm.h>
--+
--+/* Gas will put the initial save of $gp into the CIE, because it appears to
--+ happen before any instructions. So we use cfi_same_value instead of
--+ cfi_restore. */
--+
--+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
--+
--+#ifdef __PIC__
--+# undef PSEUDO
--+# define PSEUDO(name, syscall_name, args) \
--+ .align 2; \
--+ L(pseudo_start): \
--+ cfi_startproc; \
--+ cfi_adjust_cfa_offset (STKSPACE); \
--+ cfi_rel_offset (gp, STKOFF_GP); \
--+ 99: move a0, v0; \
--+ PTR_LA t9,__syscall_error; \
--+ /* manual cpreturn */ \
--+ REG_L gp, STKOFF_GP(sp); \
--+ cfi_same_value (gp); \
--+ RESTORESTK; \
--+ jr t9; \
--+ .type __##syscall_name##_nocancel, @function; \
--+ .globl __##syscall_name##_nocancel; \
--+ __##syscall_name##_nocancel: \
--+ SAVESTK; \
--+ .cpsetup t9, STKOFF_GP, name; \
--+ cfi_rel_offset (gp, STKOFF_GP); \
--+ li v0, SYS_ify(syscall_name); \
--+ syscall; \
--+ bne a3, zero, SYSCALL_ERROR_LABEL; \
--+ /* manual cpreturn */ \
--+ REG_L gp, STKOFF_GP(sp); \
--+ cfi_same_value (gp); \
--+ RESTORESTK; \
--+ ret; \
--+ .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
--+ ENTRY (name) \
--+ SAVESTK; \
--+ .cpsetup t9, STKOFF_GP, name; \
--+ cfi_rel_offset (gp, STKOFF_GP); \
--+ SINGLE_THREAD_P(v1); \
--+ bne zero, v1, L(pseudo_cancel); \
--+ .set noreorder; \
--+ li v0, SYS_ify(syscall_name); \
--+ syscall; \
--+ .set reorder; \
--+ bne a3, zero, SYSCALL_ERROR_LABEL; \
--+ /* manual cpreturn */ \
--+ REG_L gp, STKOFF_GP(sp); \
--+ cfi_same_value (gp); \
--+ RESTORESTK; \
--+ ret; \
--+ L(pseudo_cancel): \
--+ cfi_adjust_cfa_offset (STKSPACE); \
--+ cfi_rel_offset (gp, STKOFF_GP); \
--+ REG_S ra, STKOFF_RA(sp); \
--+ cfi_rel_offset (ra, STKOFF_RA); \
--+ PUSHARGS_##args; /* save syscall args */ \
--+ CENABLE; \
--+ REG_S v0, STKOFF_SVMSK(sp); /* save mask */ \
--+ POPARGS_##args; /* restore syscall args */ \
--+ .set noreorder; \
--+ li v0, SYS_ify (syscall_name); \
--+ syscall; \
--+ .set reorder; \
--+ REG_S v0, STKOFF_SC_V0(sp); /* save syscall result */ \
--+ REG_S a3, STKOFF_SC_ERR(sp); /* save syscall error flag */ \
--+ REG_L a0, STKOFF_SVMSK(sp); /* pass mask as arg1 */ \
--+ CDISABLE; \
--+ REG_L a3, STKOFF_SC_ERR(sp); /* restore syscall error flag */ \
--+ REG_L ra, STKOFF_RA(sp); /* restore return address */ \
--+ REG_L v0, STKOFF_SC_V0(sp); /* restore syscall result */ \
--+ bne a3, zero, SYSCALL_ERROR_LABEL; \
--+ /* manual cpreturn */ \
--+ REG_L gp, STKOFF_GP(sp); \
--+ cfi_same_value (gp); \
--+ RESTORESTK; \
--+ L(pseudo_end):
--+
--+
--+# undef PSEUDO_END
--+# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
--+
--+#endif
--+
--+# define PUSHARGS_0 /* nothing to do */
--+# define PUSHARGS_1 PUSHARGS_0 REG_S a0, STKOFF_A0(sp); cfi_rel_offset (a0, STKOFF_A0);
--+# define PUSHARGS_2 PUSHARGS_1 REG_S a1, STKOFF_A1(sp); cfi_rel_offset (a1, STKOFF_A1);
--+# define PUSHARGS_3 PUSHARGS_2 REG_S a2, STKOFF_A2(sp); cfi_rel_offset (a2, STKOFF_A2);
--+# define PUSHARGS_4 PUSHARGS_3 REG_S a3, STKOFF_A3(sp); cfi_rel_offset (a3, STKOFF_A3);
--+# define PUSHARGS_5 PUSHARGS_4 REG_S a4, STKOFF_A4(sp); cfi_rel_offset (a3, STKOFF_A4);
--+# define PUSHARGS_6 PUSHARGS_5 REG_S a5, STKOFF_A5(sp); cfi_rel_offset (a3, STKOFF_A5);
--+
--+# define POPARGS_0 /* nothing to do */
--+# define POPARGS_1 POPARGS_0 REG_L a0, STKOFF_A0(sp);
--+# define POPARGS_2 POPARGS_1 REG_L a1, STKOFF_A1(sp);
--+# define POPARGS_3 POPARGS_2 REG_L a2, STKOFF_A2(sp);
--+# define POPARGS_4 POPARGS_3 REG_L a3, STKOFF_A3(sp);
--+# define POPARGS_5 POPARGS_4 REG_L a4, STKOFF_A4(sp);
--+# define POPARGS_6 POPARGS_5 REG_L a5, STKOFF_A5(sp);
--+
--+/* Save an even number of slots. Should be 0 if an even number of slots
--+ are used below, or SZREG if an odd number are used. */
--+# define STK_PAD SZREG
--+
--+/* Place values that we are more likely to use later in this sequence, i.e.
--+ closer to the SP at function entry. If you do that, the are more
--+ likely to already be in your d-cache. */
--+# define STKOFF_A5 (STK_PAD)
--+# define STKOFF_A4 (STKOFF_A5 + SZREG)
--+# define STKOFF_A3 (STKOFF_A4 + SZREG)
--+# define STKOFF_A2 (STKOFF_A3 + SZREG) /* MT and more args. */
--+# define STKOFF_A1 (STKOFF_A2 + SZREG) /* MT and 2 args. */
--+# define STKOFF_A0 (STKOFF_A1 + SZREG) /* MT and 1 arg. */
--+# define STKOFF_RA (STKOFF_A0 + SZREG) /* Used if MT. */
--+# define STKOFF_SC_V0 (STKOFF_RA + SZREG) /* Used if MT. */
--+# define STKOFF_SC_ERR (STKOFF_SC_V0 + SZREG) /* Used if MT. */
--+# define STKOFF_SVMSK (STKOFF_SC_ERR + SZREG) /* Used if MT. */
--+# define STKOFF_GP (STKOFF_SVMSK + SZREG) /* Always used. */
--+
--+# define STKSPACE (STKOFF_GP + SZREG)
--+# define SAVESTK PTR_SUBU sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE)
--+# define RESTORESTK PTR_ADDU sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE)
--+
--+# ifdef IS_IN_libpthread
--+# define CENABLE PTR_LA t9, __pthread_enable_asynccancel; jalr t9
--+# define CDISABLE PTR_LA t9, __pthread_disable_asynccancel; jalr t9
--+# elif defined IS_IN_librt
--+# define CENABLE PTR_LA t9, __librt_enable_asynccancel; jalr t9
--+# define CDISABLE PTR_LA t9, __librt_disable_asynccancel; jalr t9
--+# else
--+# define CENABLE PTR_LA t9, __libc_enable_asynccancel; jalr t9
--+# define CDISABLE PTR_LA t9, __libc_disable_asynccancel; jalr t9
--+# endif
--+
--+# ifndef __ASSEMBLER__
--+# define SINGLE_THREAD_P \
--+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
--+ header.multiple_threads) \
--+ == 0, 1)
--+# else
--+# define SINGLE_THREAD_P(reg) \
--+ READ_THREAD_POINTER(reg); \
--+ lw reg, MULTIPLE_THREADS_OFFSET(reg)
--+#endif
--+
--+#elif !defined __ASSEMBLER__
--+
--+# define SINGLE_THREAD_P 1
--+# define NO_CANCELLATION 1
--+
--+#endif
--+
--+#ifndef __ASSEMBLER__
--+# define RTLD_SINGLE_THREAD_P \
--+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
--+ header.multiple_threads) == 0, 1)
--+#endif
+++ /dev/null
--Rely on the compiler to be properly setup for the default ABI.
--
--When installing-headers, there are two cases:
--- NPTL: no issue, a cross-compiler is already expected
--- LinuxThreads: no issue, EABI/OABI has no impact on installed headers.
--
--Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
--Cc: Khem Raj <raj.khem@gmail.com>
--Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
--Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
-----
--
----- a/extra/Configs/Config.arm
--+++ b/extra/Configs/Config.arm
--@@ -12,17 +12,6 @@ config FORCE_OPTIONS_FOR_ARCH
-- default y
-- select ARCH_ANY_ENDIAN
--
---config CONFIG_ARM_EABI
--- bool "Build for EABI"
--- help
--- If you say 'y' here, functions and constants required by the
--- ARM EABI will be built into the library. You should say 'y'
--- if your compiler uses the ARM EABI, in which case you will also
--- need a kernel supporting the EABI system call interface.
---
--- If you say 'n' here, then the library will be built for the
--- old Linux ABI.
---
-- config COMPILE_IN_THUMB_MODE
-- bool "Build using Thumb mode"
-- select USE_BX
+++ /dev/null
--From 6a76edddaa62ff06f178143b582167734cb55c18 Mon Sep 17 00:00:00 2001
--From: Chris Packham <chris.packham@alliedtelesis.co.nz>
--Date: Mon, 01 Oct 2012 05:12:54 +0000
--Subject: libc/sysdeps: add __kernel_long and __kernel_ulong
--
--Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various
--exported header files were updated to use these new types. Add the
--definitions for __kernel_long_t and __kernel_ulong_t to the relevant
--kernel_types.h headers.
--
--This change was automated with the following scriptlet
--
-- git grep --name-only 'typedef.*__kernel_old_dev_t' \
-- | xargs sed -i '/typedef.*__kernel_old_dev_t/ a\
-- typedef long\t\t__kernel_long_t;\
-- typedef unsigned long\t__kernel_ulong_t;'
--
--Whitespace in arm, avr32, hppa, sparc was then manually fixed up.
--
--Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
----
--Here's a cleaned up patch which should get the whitespace right. I'm a
--bit iffy about the sparc changes they make sense to me but it's not a
--platform I have access to.
--
--I can break this up per arch or per maintainer if requested.
--
-- libc/sysdeps/linux/alpha/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/arm/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/avr32/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/bfin/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/c6x/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/cris/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/e1/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/h8300/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/hppa/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/i386/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/ia64/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/m68k/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/microblaze/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/mips/bits/kernel_types.h | 4 ++++
-- libc/sysdeps/linux/nios2/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/powerpc/bits/kernel_types.h | 4 ++++
-- libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/sh64/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/sparc/bits/kernel_types.h | 4 ++++
-- libc/sysdeps/linux/v850/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/x86_64/bits/kernel_types.h | 2 ++
-- libc/sysdeps/linux/xtensa/bits/kernel_types.h | 2 ++
-- 22 files changed, 50 insertions(+)
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
----- a/libc/sysdeps/linux/alpha/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/alpha/bits/kernel_types.h
--@@ -33,6 +33,8 @@ typedef __kernel_gid_t __kernel_old_gid_
-- typedef __kernel_uid_t __kernel_uid32_t;
-- typedef __kernel_gid_t __kernel_gid32_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- int val[2];
----- a/libc/sysdeps/linux/arm/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/arm/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid
-- typedef unsigned short __kernel_old_gid_t;
-- typedef long long __kernel_loff_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/avr32/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/avr32/bits/kernel_types.h
--@@ -39,6 +39,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef unsigned short __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- #ifdef __GNUC__
-- typedef long long __kernel_loff_t;
----- a/libc/sysdeps/linux/bfin/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/bfin/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
-- typedef unsigned short __kernel_old_gid_t;
-- typedef long long __kernel_loff_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/c6x/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h
--@@ -22,6 +22,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned int __kernel_old_uid_t;
-- typedef unsigned int __kernel_old_gid_t;
-- typedef unsigned int __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef unsigned int __kernel_size_t;
-- typedef int __kernel_ssize_t;
-- typedef int __kernel_ptrdiff_t;
----- a/libc/sysdeps/linux/cris/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/cris/bits/kernel_types.h
--@@ -28,6 +28,8 @@ typedef unsigned int __kernel_gid32_t
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- #ifdef __GNUC__
-- typedef long long __kernel_loff_t;
----- a/libc/sysdeps/linux/e1/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/e1/bits/kernel_types.h
--@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- /*
----- a/libc/sysdeps/linux/h8300/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/h8300/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
-- typedef unsigned short __kernel_old_gid_t;
-- typedef long long __kernel_loff_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/hppa/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/hppa/bits/kernel_types.h
--@@ -45,6 +45,8 @@ typedef long long __kernel_off64_t;
-- typedef unsigned long long __kernel_ino64_t;
--
-- typedef unsigned int __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/i386/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/i386/bits/kernel_types.h
--@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- typedef struct {
----- a/libc/sysdeps/linux/ia64/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/ia64/bits/kernel_types.h
--@@ -52,5 +52,7 @@ typedef __kernel_gid_t __kernel_gid32_t;
--
-- typedef unsigned int __kernel_dev_t;
-- typedef unsigned int __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- #endif /* _ASM_IA64_POSIX_TYPES_H */
----- a/libc/sysdeps/linux/m68k/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/m68k/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
-- typedef unsigned short __kernel_old_gid_t;
-- typedef long long __kernel_loff_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/microblaze/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/microblaze/bits/kernel_types.h
--@@ -44,6 +44,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned int __kernel_old_uid_t;
-- typedef unsigned int __kernel_old_gid_t;
-- typedef unsigned int __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- #ifdef __GNUC__
-- typedef long long __kernel_loff_t;
----- a/libc/sysdeps/linux/mips/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/mips/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef int __kernel_gid32_t;
-- typedef __kernel_uid_t __kernel_old_uid_t;
-- typedef __kernel_gid_t __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
-- #else
-- typedef unsigned int __kernel_dev_t;
--@@ -68,6 +70,8 @@ typedef int __kernel_gid32_t;
-- typedef __kernel_uid_t __kernel_old_uid_t;
-- typedef __kernel_gid_t __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
-- #endif
--
----- a/libc/sysdeps/linux/nios2/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/nios2/bits/kernel_types.h
--@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef unsigned short __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- typedef struct {
----- a/libc/sysdeps/linux/powerpc/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/powerpc/bits/kernel_types.h
--@@ -36,6 +36,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned int __kernel_old_uid_t;
-- typedef unsigned int __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- #else
-- typedef unsigned int __kernel_dev_t;
-- typedef unsigned int __kernel_ino_t;
--@@ -61,6 +63,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned int __kernel_old_uid_t;
-- typedef unsigned int __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
-- #endif
--
----- a/libc/sysdeps/linux/sh/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/sh/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- typedef struct {
----- a/libc/sysdeps/linux/sh64/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/sh64/bits/kernel_types.h
--@@ -43,6 +43,8 @@ typedef unsigned int __kernel_gid32_t
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- typedef struct {
----- a/libc/sysdeps/linux/sparc/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/sparc/bits/kernel_types.h
--@@ -32,6 +32,8 @@ typedef unsigned short __kernel_g
-- typedef __kernel_uid_t __kernel_old_uid_t;
-- typedef __kernel_gid_t __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef __kernel_uid_t __kernel_uid32_t;
-- typedef __kernel_gid_t __kernel_gid32_t;
-- typedef int __kernel_suseconds_t;
--@@ -62,6 +64,8 @@ typedef unsigned int __kernel_gid
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
-- #endif
--
----- a/libc/sysdeps/linux/v850/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/v850/bits/kernel_types.h
--@@ -41,6 +41,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
--
-- typedef struct {
-- #ifdef __USE_ALL
----- a/libc/sysdeps/linux/x86_64/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/x86_64/bits/kernel_types.h
--@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef __kernel_dev_t __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- typedef struct {
----- a/libc/sysdeps/linux/xtensa/bits/kernel_types.h
--+++ b/libc/sysdeps/linux/xtensa/bits/kernel_types.h
--@@ -33,6 +33,8 @@ typedef unsigned int __kernel_gid32_t;
-- typedef unsigned short __kernel_old_uid_t;
-- typedef unsigned short __kernel_old_gid_t;
-- typedef unsigned short __kernel_old_dev_t;
--+typedef long __kernel_long_t;
--+typedef unsigned long __kernel_ulong_t;
-- typedef long long __kernel_loff_t;
--
-- /* Beginning in 2.6 kernels, which is the first version that includes the
+++ /dev/null
--From 7e509aae23665b9a79f6c9b4c24d1d8a55bd3582 Mon Sep 17 00:00:00 2001
--From: Gustavo Zacarias <gustavo@zacarias.com.ar>
--Date: Wed, 24 Jul 2013 15:30:35 +0000
--Subject: Rules.mak: Fix setting arch native bit
--
--fix breakage from 603af30d
--
--Removing the whitespace from findstring for 64 bit architectures has
--bad consequences since powerpc would be a match in powerpc64 and sparc
--would also be a match in sparc64.
--That doesn't make them 64 bits in reality causing general breakage.
--
--Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
--Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
--
----- a/Rules.mak
--+++ b/Rules.mak
--@@ -121,7 +121,7 @@ UBACKTRACE_DSO := libubacktrace.so.$(ABI
--
-- UCLIBC_LDSO_NAME := ld-uClibc
-- ARCH_NATIVE_BIT := 32
---ifneq ($(findstring $(TARGET_ARCH),hppa64 ia64 powerpc64 s390x sparc64 x86_64),)
--+ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 ),)
-- UCLIBC_LDSO_NAME := ld64-uClibc
-- ARCH_NATIVE_BIT := 64
-- else
+++ /dev/null
----- a/libpthread/nptl/allocatestack.c
--+++ b/libpthread/nptl/allocatestack.c
--@@ -100,7 +100,7 @@
-- /* Cache handling for not-yet free stacks. */
--
-- /* Maximum size in kB of cache. */
---static size_t stack_cache_maxsize = 40 * 1024 * 1024; /* 40MiBi by default. */
--+static size_t stack_cache_maxsize = 0; /* embedded systems don't have enough ram for dirty stack caches */
-- static size_t stack_cache_actsize;
--
-- /* Mutex protecting this variable. */
+++ /dev/null
----- a/extra/locale/gen_wctype.c
--+++ b/extra/locale/gen_wctype.c
--@@ -227,11 +227,12 @@ int main(int argc, char **argv)
-- ++verbose;
-- continue;
-- }
--- if (!setlocale(LC_CTYPE, *argv)) {
--+ /* setlocale might be just a stub */
--+ /* if (!setlocale(LC_CTYPE, *argv)) {
-- verbose_msg("setlocale(LC_CTYPE,%s) failed! Skipping this locale...\n", *argv);
-- continue;
-- }
---
--+ */
-- if (!(totitle = wctrans("totitle"))) {
-- verbose_msg("no totitle transformation.\n");
-- }
--@@ -306,43 +307,43 @@ int main(int argc, char **argv)
-- #endif
-- #if 0
-- if (c < 256) {
--- unsigned int glibc;
--+ unsigned int curr_stdclib;
--
--- glibc = 0;
--- if (isalnum(c)) ++glibc; glibc <<= 1;
--- if (isalpha(c)) ++glibc; glibc <<= 1;
--- if (isblank(c)) ++glibc; glibc <<= 1;
--- if (iscntrl(c)) ++glibc; glibc <<= 1;
--- if (isdigit(c)) ++glibc; glibc <<= 1;
--- if (isgraph(c)) ++glibc; glibc <<= 1;
--- if (islower(c)) ++glibc; glibc <<= 1;
--- if (isprint(c)) ++glibc; glibc <<= 1;
--- if (ispunct(c)) ++glibc; glibc <<= 1;
--- if (isspace(c)) ++glibc; glibc <<= 1;
--- if (isupper(c)) ++glibc; glibc <<= 1;
--- if (isxdigit(c)) ++glibc;
--- verbose_msg("%#8x : ctype %#4x\n", c, glibc);
--+ curr_stdclib = 0;
--+ if (isalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iscntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (islower(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (ispunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (isxdigit(c)) ++curr_stdclib;
--+ verbose_msg("%#8x : ctype %#4x\n", c, curr_stdclib);
-- }
-- #endif
-- #if 1
-- /* Paranoid checking... */
-- {
--- unsigned int glibc;
--+ unsigned int curr_stdclib;
-- unsigned int mine;
--
--- glibc = 0;
--- if (iswalnum(c)) ++glibc; glibc <<= 1;
--- if (iswalpha(c)) ++glibc; glibc <<= 1;
--- if (iswblank(c)) ++glibc; glibc <<= 1;
--- if (iswcntrl(c)) ++glibc; glibc <<= 1;
--- if (iswdigit(c)) ++glibc; glibc <<= 1;
--- if (iswgraph(c)) ++glibc; glibc <<= 1;
--- if (iswlower(c)) ++glibc; glibc <<= 1;
--- if (iswprint(c)) ++glibc; glibc <<= 1;
--- if (iswpunct(c)) ++glibc; glibc <<= 1;
--- if (iswspace(c)) ++glibc; glibc <<= 1;
--- if (iswupper(c)) ++glibc; glibc <<= 1;
--- if (iswxdigit(c)) ++glibc;
--+ curr_stdclib = 0;
--+ if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswxdigit(c)) ++curr_stdclib;
--
-- mine = 0;
-- if (mywalnum(d,c)) ++mine; mine <<= 1;
--@@ -358,15 +359,15 @@ int main(int argc, char **argv)
-- if (mywupper(d,c)) ++mine; mine <<= 1;
-- if (mywxdigit(d,c)) ++mine;
--
--- if (glibc != mine) {
--- verbose_msg("%#8x : glibc %#4x != %#4x mine %u\n", c, glibc, mine, d);
--+ if (curr_stdclib != mine) {
--+ verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine %u\n", c, curr_stdclib, mine, d);
-- return EXIT_FAILURE;
-- }
-- #if 0
-- if (iswctype(c,is_comb) || iswctype(c,is_comb3)) {
-- /* if (!iswpunct(c)) { */
-- verbose_msg("%#8x : %d %d %#4x\n",
--- c, iswctype(c,is_comb),iswctype(c,is_comb3), glibc);
--+ c, iswctype(c,is_comb),iswctype(c,is_comb3), curr_stdclib);
-- /* } */
-- }
-- #endif
--@@ -553,7 +554,7 @@ int main(int argc, char **argv)
-- for (c = 0; c <= 0x10ffffUL; c++)
-- #endif
-- {
--- unsigned int glibc;
--+ unsigned int curr_stdclib;
-- unsigned int mine;
-- unsigned int upper, lower;
--
--@@ -568,19 +569,19 @@ int main(int argc, char **argv)
-- }
-- #endif
-- #endif
--- glibc = 0;
--- if (iswalnum(c)) ++glibc; glibc <<= 1;
--- if (iswalpha(c)) ++glibc; glibc <<= 1;
--- if (iswblank(c)) ++glibc; glibc <<= 1;
--- if (iswcntrl(c)) ++glibc; glibc <<= 1;
--- if (iswdigit(c)) ++glibc; glibc <<= 1;
--- if (iswgraph(c)) ++glibc; glibc <<= 1;
--- if (iswlower(c)) ++glibc; glibc <<= 1;
--- if (iswprint(c)) ++glibc; glibc <<= 1;
--- if (iswpunct(c)) ++glibc; glibc <<= 1;
--- if (iswspace(c)) ++glibc; glibc <<= 1;
--- if (iswupper(c)) ++glibc; glibc <<= 1;
--- if (iswxdigit(c)) ++glibc;
--+ curr_stdclib = 0;
--+ if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
--+ if (iswxdigit(c)) ++curr_stdclib;
--
-- {
-- unsigned int u;
--@@ -630,8 +631,8 @@ int main(int argc, char **argv)
-- if (mywupper(d,c)) ++mine; mine <<= 1;
-- if (mywxdigit(d,c)) ++mine;
--
--- if (glibc != mine) {
--- verbose_msg("%#8x : glibc %#4x != %#4x mine %d\n", c, glibc, mine, d);
--+ if (curr_stdclib != mine) {
--+ verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine %d\n", c, curr_stdclib, mine, d);
-- if (c < 0x30000UL) {
-- verbose_msg("sc=%#x u=%#x n=%#x i0=%#x i1=%#x\n", sc, u, n, i0, i1);
-- }
--@@ -655,17 +656,17 @@ int main(int argc, char **argv)
-- }
--
-- if (towupper(c) != upper) {
--- verbose_msg("%#8x : towupper glibc %#4x != %#4x mine\n",
--+ verbose_msg("%#8x : towupper curr_stdclib %#4x != %#4x mine\n",
-- c, towupper(c), upper);
-- }
--
-- if (towlower(c) != lower) {
--- verbose_msg("%#8x : towlower glibc %#4x != %#4x mine i0 = %d\n",
--+ verbose_msg("%#8x : towlower curr_stdclib %#4x != %#4x mine i0 = %d\n",
-- c, towlower(c), lower, i0);
-- }
--
-- if (totitle && ((tt = towctrans(c, totitle)) != upper)) {
--- verbose_msg("%#8x : totitle glibc %#4lx != %#4x mine i0 = %d\n",
--+ verbose_msg("%#8x : totitle curr_stdclib %#4lx != %#4x mine i0 = %d\n",
-- c, tt, upper, i0);
-- }
-- }
+++ /dev/null
--Index: uClibc/libc/sysdeps/linux/common/bits/siginfo.h
--===================================================================
----- uClibc.orig/libc/sysdeps/linux/common/bits/siginfo.h
--+++ uClibc/libc/sysdeps/linux/common/bits/siginfo.h
--@@ -104,6 +104,14 @@ typedef struct siginfo
-- long int si_band; /* Band event for SIGPOLL. */
-- int si_fd;
-- } _sigpoll;
--+
--+ /* SIGSYS. */
--+ struct
--+ {
--+ void *_call_addr; /* Calling user insn. */
--+ int _syscall; /* Triggering system call number. */
--+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
--+ } _sigsys;
-- } _sifields;
-- } siginfo_t;
--
--@@ -122,6 +130,9 @@ typedef struct siginfo
-- # define si_addr _sifields._sigfault.si_addr
-- # define si_band _sifields._sigpoll.si_band
-- # define si_fd _sifields._sigpoll.si_fd
--+# define si_call_addr _sifields._sigsys._call_addr
--+# define si_syscall _sifields._sigsys._syscall
--+# define si_arch _sifields._sigsys._arch
--
--
-- /* Values for `si_code'. Positive values are reserved for kernel-generated
--Index: uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h
--===================================================================
----- uClibc.orig/libc/sysdeps/linux/alpha/bits/siginfo.h
--+++ uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h
--@@ -98,6 +98,14 @@ typedef struct siginfo
-- int si_band; /* Band event for SIGPOLL. */
-- int si_fd;
-- } _sigpoll;
--+
--+ /* SIGSYS. */
--+ struct
--+ {
--+ void *_call_addr; /* Calling user insn. */
--+ int _syscall; /* Triggering system call number. */
--+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
--+ } _sigsys;
-- } _sifields;
-- } siginfo_t;
--
--@@ -116,6 +124,9 @@ typedef struct siginfo
-- # define si_addr _sifields._sigfault.si_addr
-- # define si_band _sifields._sigpoll.si_band
-- # define si_fd _sifields._sigpoll.si_fd
--+# define si_call_addr _sifields._sigsys._call_addr
--+# define si_syscall _sifields._sigsys._syscall
--+# define si_arch _sifields._sigsys._arch
--
--
-- /* Values for `si_code'. Positive values are reserved for kernel-generated
--Index: uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h
--===================================================================
----- uClibc.orig/libc/sysdeps/linux/ia64/bits/siginfo.h
--+++ uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h
--@@ -103,6 +103,14 @@ typedef struct siginfo
-- long int si_band; /* Band event for SIGPOLL. */
-- int si_fd;
-- } _sigpoll;
--+
--+ /* SIGSYS. */
--+ struct
--+ {
--+ void *_call_addr; /* Calling user insn. */
--+ int _syscall; /* Triggering system call number. */
--+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
--+ } _sigsys;
-- } _sifields;
-- } siginfo_t;
--
--@@ -121,6 +129,9 @@ typedef struct siginfo
-- # define si_addr _sifields._sigfault.si_addr
-- # define si_band _sifields._sigpoll.si_band
-- # define si_fd _sifields._sigpoll.si_fd
--+# define si_call_addr _sifields._sigsys._call_addr
--+# define si_syscall _sifields._sigsys._syscall
--+# define si_arch _sifields._sigsys._arch
--
-- # ifdef __USE_GNU
-- # define si_imm _sifields._sigfault._si_imm
--Index: uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
--===================================================================
----- uClibc.orig/libc/sysdeps/linux/mips/bits/siginfo.h
--+++ uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
--@@ -107,6 +107,14 @@ typedef struct siginfo
-- __uid_t si_uid; /* Real user ID of sending process. */
-- sigval_t si_sigval; /* Signal value. */
-- } _rt;
--+
--+ /* SIGSYS. */
--+ struct
--+ {
--+ void *_call_addr; /* Calling user insn. */
--+ int _syscall; /* Triggering system call number. */
--+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
--+ } _sigsys;
-- } _sifields;
-- } siginfo_t;
--
--@@ -123,6 +131,9 @@ typedef struct siginfo
-- # define si_addr _sifields._sigfault.si_addr
-- # define si_band _sifields._sigpoll.si_band
-- # define si_fd _sifields._sigpoll.si_fd
--+# define si_call_addr _sifields._sigsys._call_addr
--+# define si_syscall _sifields._sigsys._syscall
--+# define si_arch _sifields._sigsys._arch
--
--
-- /* Values for `si_code'. Positive values are reserved for kernel-generated
--Index: uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h
--===================================================================
----- uClibc.orig/libc/sysdeps/linux/sparc/bits/siginfo.h
--+++ uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h
--@@ -105,6 +105,14 @@ typedef struct siginfo
-- int si_band; /* Band event for SIGPOLL. */
-- int si_fd;
-- } _sigpoll;
--+
--+ /* SIGSYS. */
--+ struct
--+ {
--+ void *_call_addr; /* Calling user insn. */
--+ int _syscall; /* Triggering system call number. */
--+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
--+ } _sigsys;
-- } _sifields;
-- } siginfo_t;
--
--@@ -124,6 +132,9 @@ typedef struct siginfo
-- # define si_trapno _sifields._sigfault.si_trapno
-- # define si_band _sifields._sigpoll.si_band
-- # define si_fd _sifields._sigpoll.si_fd
--+# define si_call_addr _sifields._sigsys._call_addr
--+# define si_syscall _sifields._sigsys._syscall
--+# define si_arch _sifields._sigsys._arch
--
--
-- /* Values for `si_code'. Positive values are reserved for kernel-generated
+++ /dev/null
--From fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 Mon Sep 17 00:00:00 2001
--From: Hiroaki KAWAI <kawai@stratosphere.co.jp>
--Date: Fri, 19 Apr 2013 01:09:35 +0000
--Subject: eventfd.h: Use new "bits/" scheme for arch-specific flags
--
--As in timerfd.h, eventfd.h needs arch-specific definition files.
--alpha, mips and sparc needs separate file, all the other arch
--will use common definition.
--
--This problem is already fixed in glibc.
--
--Also sanitize and provide bits for hppa.
--Make sure not to install the new bits/eventfd unless eventfd support is
--enabled.
--
--Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
--Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-----
----- a/Makefile.in
--+++ b/Makefile.in
--@@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR)
-- HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
-- HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/eventfd.h sys/fsuid.h \
-- bits/inotify.h \
--+ bits/eventfd.h \
-- sys/inotify.h \
-- sys/kdaemon.h \
-- sys/perm.h \
----- /dev/null
--+++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
--@@ -0,0 +1,31 @@
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library; if not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#ifndef _SYS_EVENTFD_H
--+# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
--+#endif
--+
--+/* Flags for eventfd. */
--+enum
--+ {
--+ EFD_SEMAPHORE = 000000001,
--+#define EFD_SEMAPHORE EFD_SEMAPHORE
--+ EFD_CLOEXEC = 010000000,
--+#define EFD_CLOEXEC EFD_CLOEXEC
--+ EFD_NONBLOCK = 000000004
--+#define EFD_NONBLOCK EFD_NONBLOCK
--+ };
----- /dev/null
--+++ b/libc/sysdeps/linux/common/bits/eventfd.h
--@@ -0,0 +1,31 @@
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library; if not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#ifndef _SYS_EVENTFD_H
--+# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
--+#endif
--+
--+/* Flags for eventfd. */
--+enum
--+ {
--+ EFD_SEMAPHORE = 00000001,
--+#define EFD_SEMAPHORE EFD_SEMAPHORE
--+ EFD_CLOEXEC = 02000000,
--+#define EFD_CLOEXEC EFD_CLOEXEC
--+ EFD_NONBLOCK = 00004000
--+#define EFD_NONBLOCK EFD_NONBLOCK
--+ };
----- a/libc/sysdeps/linux/common/sys/eventfd.h
--+++ b/libc/sysdeps/linux/common/sys/eventfd.h
--@@ -1,4 +1,4 @@
---/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
--
-- The GNU C Library is free software; you can redistribute it and/or
--@@ -21,21 +21,12 @@
--
-- #include <stdint.h>
--
--+/* Get the platform-dependent flags. */
--+#include <bits/eventfd.h>
--
-- /* Type for event counter. */
-- typedef uint64_t eventfd_t;
--
---/* Flags for signalfd. */
---enum
--- {
--- EFD_SEMAPHORE = 1,
---#define EFD_SEMAPHORE EFD_SEMAPHORE
--- EFD_CLOEXEC = 02000000,
---#define EFD_CLOEXEC EFD_CLOEXEC
--- EFD_NONBLOCK = 04000
---#define EFD_NONBLOCK EFD_NONBLOCK
--- };
---
--
-- __BEGIN_DECLS
--
--@@ -43,6 +34,16 @@ __BEGIN_DECLS
-- value to COUNT. */
-- extern int eventfd (int __count, int __flags) __THROW;
--
--+#if 0 /* not (yet) implemented in uClibc */
--+
--+/* Read event counter and possibly wait for events. */
--+extern int eventfd_read (int __fd, eventfd_t *__value);
--+
--+/* Increment event counter. */
--+extern int eventfd_write (int __fd, eventfd_t __value);
--+
--+#endif
--+
-- __END_DECLS
--
-- #endif /* sys/eventfd.h */
----- /dev/null
--+++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
--@@ -0,0 +1,32 @@
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library. If not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#ifndef _SYS_EVENTFD_H
--+# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
--+#endif
--+
--+/* Flags for signalfd. */
--+enum
--+ {
--+ EFD_SEMAPHORE = 000000001,
--+#define EFD_SEMAPHORE EFD_SEMAPHORE
--+ EFD_CLOEXEC = 010000000,
--+#define EFD_CLOEXEC EFD_CLOEXEC
--+/* the below value looks suspicious, should be 000200004 for consistency */
--+ EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
--+#define EFD_NONBLOCK EFD_NONBLOCK
--+ };
----- /dev/null
--+++ b/libc/sysdeps/linux/mips/bits/eventfd.h
--@@ -0,0 +1,31 @@
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library; if not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#ifndef _SYS_EVENTFD_H
--+# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
--+#endif
--+
--+/* Flags for eventfd. */
--+enum
--+ {
--+ EFD_SEMAPHORE = 00000001,
--+#define EFD_SEMAPHORE EFD_SEMAPHORE
--+ EFD_CLOEXEC = 02000000,
--+#define EFD_CLOEXEC EFD_CLOEXEC
--+ EFD_NONBLOCK = 00000200
--+#define EFD_NONBLOCK EFD_NONBLOCK
--+ };
----- /dev/null
--+++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
--@@ -0,0 +1,31 @@
--+/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
--+ This file is part of the GNU C Library.
--+
--+ The GNU C Library is free software; you can redistribute it and/or
--+ modify it under the terms of the GNU Lesser General Public
--+ License as published by the Free Software Foundation; either
--+ version 2.1 of the License, or (at your option) any later version.
--+
--+ The GNU C Library is distributed in the hope that it will be useful,
--+ but WITHOUT ANY WARRANTY; without even the implied warranty of
--+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--+ Lesser General Public License for more details.
--+
--+ You should have received a copy of the GNU Lesser General Public
--+ License along with the GNU C Library; if not, see
--+ <http://www.gnu.org/licenses/>. */
--+
--+#ifndef _SYS_EVENTFD_H
--+# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
--+#endif
--+
--+/* Flags for eventfd. */
--+enum
--+ {
--+ EFD_SEMAPHORE = 1,
--+#define EFD_SEMAPHORE EFD_SEMAPHORE
--+ EFD_CLOEXEC = 0x400000,
--+#define EFD_CLOEXEC EFD_CLOEXEC
--+ EFD_NONBLOCK = 0x004000
--+#define EFD_NONBLOCK EFD_NONBLOCK
--+ };
include $(TOPDIR)/rules.mk
PKG_NAME:=mkimage
--PKG_VERSION:=2014.10-librecmc
++PKG_VERSION:=2014.10
PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=\
-- http://downloads.librecmc.org/sources \
--
--PKG_MD5SUM:=a4d242902687a4ee46fe8dabb5c0f12e
++ http://mirror2.librecmc.org/sources \
++ ftp://ftp.denx.de/pub/u-boot
++PKG_MD5SUM:=3ddcaee2f05b7c464778112ec83664b5
PKG_CAT:=bzcat
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)
--- a/include/image.h
+++ b/include/image.h
--@@ -44,6 +44,10 @@
++@@ -44,6 +44,10 @@ struct lmb;
#endif /* USE_HOSTCC */
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
--@@ -24,6 +24,7 @@
++@@ -24,6 +24,7 @@ struct image_tool_params params = {
.arch = IH_ARCH_PPC,
.type = IH_TYPE_KERNEL,
.comp = IH_COMP_GZIP,
.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
.imagename = "",
.imagename2 = "",
--@@ -168,6 +169,16 @@
++@@ -168,6 +169,16 @@ main (int argc, char **argv)
genimg_get_comp_id (*++argv)) < 0)
usage ();
goto NXTARG;
case 'D':
if (--argc <= 0)
usage ();
--@@ -623,12 +634,13 @@
++@@ -623,12 +634,13 @@ static void usage(void)
fprintf (stderr, "Usage: %s -l image\n"
" -l ==> list image header information\n",
params.cmdname);
" -n ==> set image name to 'name'\n"
--- a/tools/default_image.c
+++ b/tools/default_image.c
--@@ -98,7 +98,7 @@
++@@ -98,7 +98,7 @@ static void image_set_header(void *ptr,
sbuf->st_size - sizeof(image_header_t));
/* Build new header */
image_set_load(hdr, params->addr);
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
--@@ -44,6 +44,7 @@
++@@ -44,6 +44,7 @@ struct image_tool_params {
int arch;
int type;
int comp;
--- /dev/null
--- /dev/null
++From f3f431a712729a1af94d01bd1bfde17a252ff02c Mon Sep 17 00:00:00 2001
++From: Paul Kocialkowski <contact@paulk.fr>
++Date: Sun, 26 Jul 2015 18:48:15 +0200
++Subject: [PATCH] Reproducible U-Boot build support, using SOURCE_DATE_EPOCH
++
++In order to achieve reproducible builds in U-Boot, timestamps that are defined
++at build-time have to be somewhat eliminated. The SOURCE_DATE_EPOCH environment
++variable allows setting a fixed value for those timestamps.
++
++Simply by setting SOURCE_DATE_EPOCH to a fixed value, a number of targets can be
++built reproducibly. This is the case for e.g. sunxi devices.
++
++However, some other devices might need some more tweaks, especially regarding
++the image generation tools.
++
++Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
++---
++ Makefile | 7 ++++---
++ README | 12 ++++++++++++
++ tools/default_image.c | 21 ++++++++++++++++++++-
++ 3 files changed, 36 insertions(+), 4 deletions(-)
++
++--- a/README
+++++ b/README
++@@ -4928,6 +4928,18 @@ within that device.
++ normal addressable memory via the LBC. CONFIG_SYS_LS_MC_FW_ADDR is the
++ virtual address in NOR flash.
++
+++Reproducible builds
+++-------------------
+++
+++In order to achieve reproducible builds, timestamps used in the U-Boot build
+++process have to be set to a fixed value.
+++
+++This is done using the SOURCE_DATE_EPOCH environment variable.
+++SOURCE_DATE_EPOCH is to be set on the build host's shell, not as a configuration
+++option for U-Boot or an environment variable in U-Boot.
+++
+++SOURCE_DATE_EPOCH should be set to a number of seconds since the epoch, in UTC.
+++
++ Building the Software:
++ ======================
++
++--- a/tools/default_image.c
+++++ b/tools/default_image.c
++@@ -89,6 +89,9 @@ static void image_set_header(void *ptr,
++ struct image_tool_params *params)
++ {
++ uint32_t checksum;
+++ char *source_date_epoch;
+++ struct tm *time_universal;
+++ time_t time;
++
++ image_header_t * hdr = (image_header_t *)ptr;
++
++@@ -97,9 +100,25 @@ static void image_set_header(void *ptr,
++ sizeof(image_header_t)),
++ sbuf->st_size - sizeof(image_header_t));
++
+++ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+++ if (source_date_epoch != NULL) {
+++ time = (time_t) strtol(source_date_epoch, NULL, 10);
+++
+++ time_universal = gmtime(&time);
+++ if (time_universal == NULL) {
+++ fprintf(stderr, "%s: SOURCE_DATE_EPOCH is not valid\n",
+++ __func__);
+++ time = 0;
+++ } else {
+++ time = mktime(time_universal);
+++ }
+++ } else {
+++ time = sbuf->st_mtime;
+++ }
+++
++ /* Build new header */
++ image_set_magic(hdr, params->magic);
++- image_set_time(hdr, sbuf->st_mtime);
+++ image_set_time(hdr, time);
++ image_set_size(hdr, sbuf->st_size - sizeof(image_header_t));
++ image_set_load(hdr, params->addr);
++ image_set_ep(hdr, params->ep);
--- /dev/null
--- /dev/null
++diff --git b/include/linux/compiler-gcc.h a/include/linux/compiler-gcc.h
++index e057bd2..22ab246 100644
++--- b/include/linux/compiler-gcc.h
+++++ a/include/linux/compiler-gcc.h
++@@ -5,14 +5,28 @@
++ /*
++ * Common definitions for all gcc versions go here.
++ */
++-#define GCC_VERSION (__GNUC__ * 10000 \
++- + __GNUC_MINOR__ * 100 \
++- + __GNUC_PATCHLEVEL__)
++-
+++#define GCC_VERSION (__GNUC__ * 10000 \
+++ + __GNUC_MINOR__ * 100 \
+++ + __GNUC_PATCHLEVEL__)
++
++ /* Optimization barrier */
+++
++ /* The "volatile" is due to gcc bugs */
++ #define barrier() __asm__ __volatile__("": : :"memory")
+++/*
+++ * This version is i.e. to prevent dead stores elimination on @ptr
+++ * where gcc and llvm may behave differently when otherwise using
+++ * normal barrier(): while gcc behavior gets along with a normal
+++ * barrier(), llvm needs an explicit input variable to be assumed
+++ * clobbered. The issue is as follows: while the inline asm might
+++ * access any memory it wants, the compiler could have fit all of
+++ * @ptr into memory registers instead, and since @ptr never escaped
+++ * from that, it proofed that the inline asm wasn't touching any of
+++ * it. This version works well with both compilers, i.e. we're telling
+++ * the compiler that the inline asm absolutely may see the contents
+++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
+++ */
+++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
++
++ /*
++ * This macro obfuscates arithmetic on a variable address so that gcc
++@@ -32,58 +46,63 @@
++ * the inline assembly constraint from =g to =r, in this particular
++ * case either is valid.
++ */
++-#define RELOC_HIDE(ptr, off) \
++- ({ unsigned long __ptr; \
++- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
++- (typeof(ptr)) (__ptr + (off)); })
+++#define RELOC_HIDE(ptr, off) \
+++({ \
+++ unsigned long __ptr; \
+++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
+++ (typeof(ptr)) (__ptr + (off)); \
+++})
++
++ /* Make the optimizer believe the variable can be manipulated arbitrarily. */
++-#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var))
+++#define OPTIMIZER_HIDE_VAR(var) \
+++ __asm__ ("" : "=r" (var) : "0" (var))
++
++ #ifdef __CHECKER__
++-#define __must_be_array(arr) 0
+++#define __must_be_array(a) 0
++ #else
++ /* &a[0] degrades to a pointer: a different type from an array */
++-#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
++ #endif
++
++ /*
++ * Force always-inline if the user requests it so via the .config,
++ * or if gcc is too old:
++ */
++-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
++ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
++-# define inline inline __attribute__((always_inline)) notrace
++-# define __inline__ __inline__ __attribute__((always_inline)) notrace
++-# define __inline __inline __attribute__((always_inline)) notrace
+++#define inline inline __attribute__((always_inline)) notrace
+++#define __inline__ __inline__ __attribute__((always_inline)) notrace
+++#define __inline __inline __attribute__((always_inline)) notrace
++ #else
++ /* A lot of inline functions can cause havoc with function tracing */
++-# define inline inline notrace
++-# define __inline__ __inline__ notrace
++-# define __inline __inline notrace
+++#define inline inline notrace
+++#define __inline__ __inline__ notrace
+++#define __inline __inline notrace
++ #endif
++
++-#define __deprecated __attribute__((deprecated))
++-#ifndef __packed
++-#define __packed __attribute__((packed))
++-#endif
++-#ifndef __weak
++-#define __weak __attribute__((weak))
++-#endif
+++#define __always_inline inline __attribute__((always_inline))
+++#define noinline __attribute__((noinline))
+++
+++#define __deprecated __attribute__((deprecated))
+++#define __packed __attribute__((packed))
+++#define __weak __attribute__((weak))
+++#define __alias(symbol) __attribute__((alias(#symbol)))
++
++ /*
++- * it doesn't make sense on ARM (currently the only user of __naked) to trace
++- * naked functions because then mcount is called without stack and frame pointer
++- * being set up and there is no chance to restore the lr register to the value
++- * before mcount was called.
+++ * it doesn't make sense on ARM (currently the only user of __naked)
+++ * to trace naked functions because then mcount is called without
+++ * stack and frame pointer being set up and there is no chance to
+++ * restore the lr register to the value before mcount was called.
+++ *
+++ * The asm() bodies of naked functions often depend on standard calling
+++ * conventions, therefore they must be noinline and noclone.
++ *
++- * The asm() bodies of naked functions often depend on standard calling conventions,
++- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
++- * this, so we must do so ourselves. See GCC PR44290.
+++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
+++ * See GCC PR44290.
++ */
++-#define __naked __attribute__((naked)) noinline __noclone notrace
+++#define __naked __attribute__((naked)) noinline __noclone notrace
++
++-#define __noreturn __attribute__((noreturn))
+++#define __noreturn __attribute__((noreturn))
++
++ /*
++ * From the GCC manual:
++@@ -95,34 +114,170 @@
++ * would be.
++ * [...]
++ */
++-#ifndef __pure
++-#define __pure __attribute__((pure))
+++#define __pure __attribute__((pure))
+++#define __aligned(x) __attribute__((aligned(x)))
+++#define __printf(a, b) __attribute__((format(printf, a, b)))
+++#define __scanf(a, b) __attribute__((format(scanf, a, b)))
+++#define __attribute_const__ __attribute__((__const__))
+++#define __maybe_unused __attribute__((unused))
+++#define __always_unused __attribute__((unused))
+++
+++/* gcc version specific checks */
+++
+++#if GCC_VERSION < 30200
+++# error Sorry, your compiler is too old - please upgrade it.
+++#endif
+++
+++#if GCC_VERSION < 30300
+++# define __used __attribute__((__unused__))
+++#else
+++# define __used __attribute__((__used__))
+++#endif
+++
+++#ifdef CONFIG_GCOV_KERNEL
+++# if GCC_VERSION < 30400
+++# error "GCOV profiling support for gcc versions below 3.4 not included"
+++# endif /* __GNUC_MINOR__ */
+++#endif /* CONFIG_GCOV_KERNEL */
+++
+++#if GCC_VERSION >= 30400
+++#define __must_check __attribute__((warn_unused_result))
+++#endif
+++
+++#if GCC_VERSION >= 40000
+++
+++/* GCC 4.1.[01] miscompiles __weak */
+++#ifdef __KERNEL__
+++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
+++# error Your version of gcc miscompiles the __weak directive
+++# endif
+++#endif
+++
+++#define __used __attribute__((__used__))
+++#define __compiler_offsetof(a, b) \
+++ __builtin_offsetof(a, b)
+++
+++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
+++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+++#endif
+++
+++#if GCC_VERSION >= 40300
+++/* Mark functions as cold. gcc will assume any path leading to a call
+++ * to them will be unlikely. This means a lot of manual unlikely()s
+++ * are unnecessary now for any paths leading to the usual suspects
+++ * like BUG(), printk(), panic() etc. [but let's keep them for now for
+++ * older compilers]
+++ *
+++ * Early snapshots of gcc 4.3 don't support this and we can't detect this
+++ * in the preprocessor, but we can live with this because they're unreleased.
+++ * Maketime probing would be overkill here.
+++ *
+++ * gcc also has a __attribute__((__hot__)) to move hot functions into
+++ * a special section, but I don't see any sense in this right now in
+++ * the kernel context
+++ */
+++#define __cold __attribute__((__cold__))
+++
+++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+++
+++#ifndef __CHECKER__
+++# define __compiletime_warning(message) __attribute__((warning(message)))
+++# define __compiletime_error(message) __attribute__((error(message)))
+++#endif /* __CHECKER__ */
+++#endif /* GCC_VERSION >= 40300 */
+++
+++#if GCC_VERSION >= 40500
+++/*
+++ * Mark a position in code as unreachable. This can be used to
+++ * suppress control flow warnings after asm blocks that transfer
+++ * control elsewhere.
+++ *
+++ * Early snapshots of gcc 4.5 don't support this and we can't detect
+++ * this in the preprocessor, but we can live with this because they're
+++ * unreleased. Really, we need to have autoconf for the kernel.
+++ */
+++#define unreachable() __builtin_unreachable()
+++
+++/* Mark a function definition as prohibited from being cloned. */
+++#define __noclone __attribute__((__noclone__))
+++
+++#endif /* GCC_VERSION >= 40500 */
+++
+++#if GCC_VERSION >= 40600
+++/*
+++ * When used with Link Time Optimization, gcc can optimize away C functions or
+++ * variables which are referenced only from assembly code. __visible tells the
+++ * optimizer that something else uses this function or variable, thus preventing
+++ * this.
+++ */
+++#define __visible __attribute__((externally_visible))
++ #endif
++-#ifndef __aligned
++-#define __aligned(x) __attribute__((aligned(x)))
+++
+++
+++#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
+++/*
+++ * __assume_aligned(n, k): Tell the optimizer that the returned
+++ * pointer can be assumed to be k modulo n. The second argument is
+++ * optional (default 0), so we use a variadic macro to make the
+++ * shorthand.
+++ *
+++ * Beware: Do not apply this to functions which may return
+++ * ERR_PTRs. Also, it is probably unwise to apply it to functions
+++ * returning extra information in the low bits (but in that case the
+++ * compiler should see some alignment anyway, when the return value is
+++ * massaged by 'flags = ptr & 3; ptr &= ~3;').
+++ */
+++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
++ #endif
++-#define __printf(a, b) __attribute__((format(printf, a, b)))
++-#define __scanf(a, b) __attribute__((format(scanf, a, b)))
++-#define noinline __attribute__((noinline))
++-#define __attribute_const__ __attribute__((__const__))
++-#define __maybe_unused __attribute__((unused))
++-#define __always_unused __attribute__((unused))
++
++-#define __gcc_header(x) #x
++-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
++-#define gcc_header(x) _gcc_header(x)
++-#include gcc_header(__GNUC__)
+++/*
+++ * GCC 'asm goto' miscompiles certain code sequences:
+++ *
+++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+++ *
+++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+++ *
+++ * (asm goto is automatically volatile - the naming reflects this.)
+++ */
+++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
+++
+++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+++#if GCC_VERSION >= 40400
+++#define __HAVE_BUILTIN_BSWAP32__
+++#define __HAVE_BUILTIN_BSWAP64__
+++#endif
+++#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
+++#define __HAVE_BUILTIN_BSWAP16__
+++#endif
+++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+++
+++#if GCC_VERSION >= 50000
+++#define KASAN_ABI_VERSION 4
+++#elif GCC_VERSION >= 40902
+++#define KASAN_ABI_VERSION 3
+++#endif
+++
+++#if GCC_VERSION >= 40902
+++/*
+++ * Tell the compiler that address safety instrumentation (KASAN)
+++ * should not be applied to that function.
+++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
+++ */
+++#define __no_sanitize_address __attribute__((no_sanitize_address))
+++#endif
+++
+++#endif /* gcc version >= 40000 specific checks */
++
++ #if !defined(__noclone)
++ #define __noclone /* not needed */
++ #endif
++
+++#if !defined(__no_sanitize_address)
+++#define __no_sanitize_address
+++#endif
+++
++ /*
++ * A trick to suppress uninitialized variable warning without generating any
++ * code
++ */
++ #define uninitialized_var(x) x = x
++-
++-#ifndef __always_inline
++-#define __always_inline inline __attribute__((always_inline))
++-#endif
++diff --git b/include/linux/compiler-gcc3.h a/include/linux/compiler-gcc3.h
++deleted file mode 100644
++index 7d89feb..0000000
++--- b/include/linux/compiler-gcc3.h
+++++ /dev/null
++@@ -1,23 +0,0 @@
++-#ifndef __LINUX_COMPILER_H
++-#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
++-#endif
++-
++-#if GCC_VERSION < 30200
++-# error Sorry, your compiler is too old - please upgrade it.
++-#endif
++-
++-#if GCC_VERSION >= 30300
++-# define __used __attribute__((__used__))
++-#else
++-# define __used __attribute__((__unused__))
++-#endif
++-
++-#if GCC_VERSION >= 30400
++-#define __must_check __attribute__((warn_unused_result))
++-#endif
++-
++-#ifdef CONFIG_GCOV_KERNEL
++-# if GCC_VERSION < 30400
++-# error "GCOV profiling support for gcc versions below 3.4 not included"
++-# endif /* __GNUC_MINOR__ */
++-#endif /* CONFIG_GCOV_KERNEL */
++diff --git b/include/linux/compiler-gcc4.h a/include/linux/compiler-gcc4.h
++deleted file mode 100644
++index c982a09..0000000
++--- b/include/linux/compiler-gcc4.h
+++++ /dev/null
++@@ -1,81 +0,0 @@
++-#ifndef __LINUX_COMPILER_H
++-#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
++-#endif
++-
++-#define __used __attribute__((__used__))
++-#define __must_check __attribute__((warn_unused_result))
++-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
++-
++-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
++-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
++-#endif
++-
++-#if GCC_VERSION >= 40300
++-/* Mark functions as cold. gcc will assume any path leading to a call
++- to them will be unlikely. This means a lot of manual unlikely()s
++- are unnecessary now for any paths leading to the usual suspects
++- like BUG(), printk(), panic() etc. [but let's keep them for now for
++- older compilers]
++-
++- Early snapshots of gcc 4.3 don't support this and we can't detect this
++- in the preprocessor, but we can live with this because they're unreleased.
++- Maketime probing would be overkill here.
++-
++- gcc also has a __attribute__((__hot__)) to move hot functions into
++- a special section, but I don't see any sense in this right now in
++- the kernel context */
++-#define __cold __attribute__((__cold__))
++-
++-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
++-
++-#ifndef __CHECKER__
++-# define __compiletime_warning(message) __attribute__((warning(message)))
++-# define __compiletime_error(message) __attribute__((error(message)))
++-#endif /* __CHECKER__ */
++-#endif /* GCC_VERSION >= 40300 */
++-
++-#if GCC_VERSION >= 40500
++-/*
++- * Mark a position in code as unreachable. This can be used to
++- * suppress control flow warnings after asm blocks that transfer
++- * control elsewhere.
++- *
++- * Early snapshots of gcc 4.5 don't support this and we can't detect
++- * this in the preprocessor, but we can live with this because they're
++- * unreleased. Really, we need to have autoconf for the kernel.
++- */
++-#define unreachable() __builtin_unreachable()
++-
++-/* Mark a function definition as prohibited from being cloned. */
++-#define __noclone __attribute__((__noclone__))
++-
++-#endif /* GCC_VERSION >= 40500 */
++-
++-#if GCC_VERSION >= 40600
++-/*
++- * Tell the optimizer that something else uses this function or variable.
++- */
++-#define __visible __attribute__((externally_visible))
++-#endif
++-
++-/*
++- * GCC 'asm goto' miscompiles certain code sequences:
++- *
++- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
++- *
++- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
++- * Fixed in GCC 4.8.2 and later versions.
++- *
++- * (asm goto is automatically volatile - the naming reflects this.)
++- */
++-#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
++-
++-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
++-#if GCC_VERSION >= 40400
++-#define __HAVE_BUILTIN_BSWAP32__
++-#define __HAVE_BUILTIN_BSWAP64__
++-#endif
++-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
++-#define __HAVE_BUILTIN_BSWAP16__
++-#endif
++-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
++diff --git b/include/linux/compiler-intel.h a/include/linux/compiler-intel.h
++index ba147a1..d4c7113 100644
++--- b/include/linux/compiler-intel.h
+++++ a/include/linux/compiler-intel.h
++@@ -13,9 +13,14 @@
++ /* Intel ECC compiler doesn't support gcc specific asm stmts.
++ * It uses intrinsics to do the equivalent things.
++ */
+++#undef barrier
+++#undef barrier_data
++ #undef RELOC_HIDE
++ #undef OPTIMIZER_HIDE_VAR
++
+++#define barrier() __memory_barrier()
+++#define barrier_data(ptr) barrier()
+++
++ #define RELOC_HIDE(ptr, off) \
++ ({ unsigned long __ptr; \
++ __ptr = (unsigned long) (ptr); \
++diff --git b/include/linux/compiler.h a/include/linux/compiler.h
++index d5ad7b1..020ad16 100644
++--- b/include/linux/compiler.h
+++++ a/include/linux/compiler.h
++@@ -17,6 +17,7 @@
++ # define __release(x) __context__(x,-1)
++ # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
++ # define __percpu __attribute__((noderef, address_space(3)))
+++# define __pmem __attribute__((noderef, address_space(5)))
++ #ifdef CONFIG_SPARSE_RCU_POINTER
++ # define __rcu __attribute__((noderef, address_space(4)))
++ #else
++@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
++ # define __cond_lock(x,c) (c)
++ # define __percpu
++ # define __rcu
+++# define __pmem
++ #endif
++
++ /* Indirect macros required for expanded argument pasting, eg. __LINE__. */
++@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile void __iomem *);
++ #include <linux/compiler-gcc.h>
++ #endif
++
+++#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
+++#define notrace __attribute__((hotpatch(0,0)))
+++#else
++ #define notrace __attribute__((no_instrument_function))
+++#endif
++
++ /* Intel compiler defines __GNUC__. So we will overwrite implementations
++ * coming from above header files here
++@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++ */
++ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
++ #define __trace_if(cond) \
++- if (__builtin_constant_p((cond)) ? !!(cond) : \
+++ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
++ ({ \
++ int ______r; \
++ static struct ftrace_branch_data \
++@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++ # define barrier() __memory_barrier()
++ #endif
++
+++#ifndef barrier_data
+++# define barrier_data(ptr) barrier()
+++#endif
+++
++ /* Unreachable code */
++ #ifndef unreachable
++ # define unreachable() do { } while (1)
++@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++ # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
++ #endif
++
+++#include <linux/types.h>
+++
+++#define __READ_ONCE_SIZE \
+++({ \
+++ switch (size) { \
+++ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \
+++ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \
+++ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \
+++ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
+++ default: \
+++ barrier(); \
+++ __builtin_memcpy((void *)res, (const void *)p, size); \
+++ barrier(); \
+++ } \
+++})
+++
+++static __always_inline
+++void __read_once_size(const volatile void *p, void *res, int size)
+++{
+++ __READ_ONCE_SIZE;
+++}
+++
+++#ifdef CONFIG_KASAN
+++/*
+++ * This function is not 'inline' because __no_sanitize_address confilcts
+++ * with inlining. Attempt to inline it may cause a build failure.
+++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
+++ * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
+++ */
+++static __no_sanitize_address __maybe_unused
+++void __read_once_size_nocheck(const volatile void *p, void *res, int size)
+++{
+++ __READ_ONCE_SIZE;
+++}
+++#else
+++static __always_inline
+++void __read_once_size_nocheck(const volatile void *p, void *res, int size)
+++{
+++ __READ_ONCE_SIZE;
+++}
+++#endif
+++
+++static __always_inline void __write_once_size(volatile void *p, void *res, int size)
+++{
+++ switch (size) {
+++ case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
+++ case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
+++ case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
+++ case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
+++ default:
+++ barrier();
+++ __builtin_memcpy((void *)p, (const void *)res, size);
+++ barrier();
+++ }
+++}
+++
+++/*
+++ * Prevent the compiler from merging or refetching reads or writes. The
+++ * compiler is also forbidden from reordering successive instances of
+++ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the
+++ * compiler is aware of some particular ordering. One way to make the
+++ * compiler aware of ordering is to put the two invocations of READ_ONCE,
+++ * WRITE_ONCE or ACCESS_ONCE() in different C statements.
+++ *
+++ * In contrast to ACCESS_ONCE these two macros will also work on aggregate
+++ * data types like structs or unions. If the size of the accessed data
+++ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
+++ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a
+++ * compile-time warning.
+++ *
+++ * Their two major use cases are: (1) Mediating communication between
+++ * process-level code and irq/NMI handlers, all running on the same CPU,
+++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
+++ * mutilate accesses that either do not require ordering or that interact
+++ * with an explicit memory barrier or atomic instruction that provides the
+++ * required ordering.
+++ */
+++
+++#define __READ_ONCE(x, check) \
+++({ \
+++ union { typeof(x) __val; char __c[1]; } __u; \
+++ if (check) \
+++ __read_once_size(&(x), __u.__c, sizeof(x)); \
+++ else \
+++ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
+++ __u.__val; \
+++})
+++#define READ_ONCE(x) __READ_ONCE(x, 1)
+++
+++/*
+++ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need
+++ * to hide memory access from KASAN.
+++ */
+++#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0)
+++
+++#define WRITE_ONCE(x, val) \
+++({ \
+++ union { typeof(x) __val; char __c[1]; } __u = \
+++ { .__val = (__force typeof(x)) (val) }; \
+++ __write_once_size(&(x), __u.__c, sizeof(x)); \
+++ __u.__val; \
+++})
+++
+++/**
+++ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering
+++ * @cond: boolean expression to wait for
+++ *
+++ * Equivalent to using smp_load_acquire() on the condition variable but employs
+++ * the control dependency of the wait to reduce the barrier on many platforms.
+++ *
+++ * The control dependency provides a LOAD->STORE order, the additional RMB
+++ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order,
+++ * aka. ACQUIRE.
+++ */
+++#define smp_cond_acquire(cond) do { \
+++ while (!(cond)) \
+++ cpu_relax(); \
+++ smp_rmb(); /* ctrl + rmb := acquire */ \
+++} while (0)
+++
++ #endif /* __KERNEL__ */
++
++ #endif /* __ASSEMBLY__ */
++@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++ #define __visible
++ #endif
++
+++/*
+++ * Assume alignment of return value.
+++ */
+++#ifndef __assume_aligned
+++#define __assume_aligned(a, ...)
+++#endif
+++
+++
++ /* Are two types/vars the same type (ignoring qualifiers)? */
++ #ifndef __same_type
++ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
++@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++
++ /* Is this type a native word size -- useful for atomic operations */
++ #ifndef __native_word
++-# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
+++# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
++ #endif
++
++ /* Compile time object size, -1 for unknown */
++@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
++ * to make the compiler aware of ordering is to put the two invocations of
++ * ACCESS_ONCE() in different C statements.
++ *
++- * This macro does absolutely -nothing- to prevent the CPU from reordering,
++- * merging, or refetching absolutely anything at any time. Its main intended
++- * use is to mediate communication between process-level code and irq/NMI
++- * handlers, all running on the same CPU.
+++ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE
+++ * on a union member will work as long as the size of the member matches the
+++ * size of the union and the size is smaller than word size.
+++ *
+++ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication
+++ * between process-level code and irq/NMI handlers, all running on the same CPU,
+++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
+++ * mutilate accesses that either do not require ordering or that interact
+++ * with an explicit memory barrier or atomic instruction that provides the
+++ * required ordering.
+++ *
+++ * If possible use READ_ONCE()/WRITE_ONCE() instead.
+++ */
+++#define __ACCESS_ONCE(x) ({ \
+++ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \
+++ (volatile typeof(x) *)&(x); })
+++#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
+++
+++/**
+++ * lockless_dereference() - safely load a pointer for later dereference
+++ * @p: The pointer to load
+++ *
+++ * Similar to rcu_dereference(), but for situations where the pointed-to
+++ * object's lifetime is managed by something other than RCU. That
+++ * "something other" might be reference counting or simple immortality.
++ */
++-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+++#define lockless_dereference(p) \
+++({ \
+++ typeof(p) _________p1 = READ_ONCE(p); \
+++ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
+++ (_________p1); \
+++})
++
++ /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
++ #ifdef CONFIG_KPROBES
+++ /dev/null
--From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001
--From: Hans de Goede <hdegoede@redhat.com>
--Date: Sat, 7 Feb 2015 22:52:40 +0100
--Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5
--
--Add linux/compiler-gcc5/h from the kernel sources at:
--
--commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
--Author: Steven Noonan <steven@uplinklabs.net>
--Date: Sat Oct 25 15:09:42 2014 -0700
--
-- compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
--
--Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-----
-- include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++
-- 1 file changed, 65 insertions(+)
-- create mode 100644 include/linux/compiler-gcc5.h
--
--diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
--new file mode 100644
--index 0000000..c8c5659
----- /dev/null
--+++ b/include/linux/compiler-gcc5.h
--@@ -0,0 +1,65 @@
--+#ifndef __LINUX_COMPILER_H
--+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
--+#endif
--+
--+#define __used __attribute__((__used__))
--+#define __must_check __attribute__((warn_unused_result))
--+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
--+
--+/* Mark functions as cold. gcc will assume any path leading to a call
--+ to them will be unlikely. This means a lot of manual unlikely()s
--+ are unnecessary now for any paths leading to the usual suspects
--+ like BUG(), printk(), panic() etc. [but let's keep them for now for
--+ older compilers]
--+
--+ Early snapshots of gcc 4.3 don't support this and we can't detect this
--+ in the preprocessor, but we can live with this because they're unreleased.
--+ Maketime probing would be overkill here.
--+
--+ gcc also has a __attribute__((__hot__)) to move hot functions into
--+ a special section, but I don't see any sense in this right now in
--+ the kernel context */
--+#define __cold __attribute__((__cold__))
--+
--+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
--+
--+#ifndef __CHECKER__
--+# define __compiletime_warning(message) __attribute__((warning(message)))
--+# define __compiletime_error(message) __attribute__((error(message)))
--+#endif /* __CHECKER__ */
--+
--+/*
--+ * Mark a position in code as unreachable. This can be used to
--+ * suppress control flow warnings after asm blocks that transfer
--+ * control elsewhere.
--+ *
--+ * Early snapshots of gcc 4.5 don't support this and we can't detect
--+ * this in the preprocessor, but we can live with this because they're
--+ * unreleased. Really, we need to have autoconf for the kernel.
--+ */
--+#define unreachable() __builtin_unreachable()
--+
--+/* Mark a function definition as prohibited from being cloned. */
--+#define __noclone __attribute__((__noclone__))
--+
--+/*
--+ * Tell the optimizer that something else uses this function or variable.
--+ */
--+#define __visible __attribute__((externally_visible))
--+
--+/*
--+ * GCC 'asm goto' miscompiles certain code sequences:
--+ *
--+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
--+ *
--+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
--+ *
--+ * (asm goto is automatically volatile - the naming reflects this.)
--+ */
--+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
--+
--+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
--+#define __HAVE_BUILTIN_BSWAP32__
--+#define __HAVE_BUILTIN_BSWAP64__
--+#define __HAVE_BUILTIN_BSWAP16__
--+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
----
--1.7.10.4
--