summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in1
-rw-r--r--config/binutils/binutils.in37
-rw-r--r--config/cc/gcc.in26
-rw-r--r--config/companion_libs.in8
-rw-r--r--config/companion_libs/cloog.in9
-rw-r--r--config/companion_libs/expat.in11
-rw-r--r--config/companion_libs/gmp.in6
-rw-r--r--config/companion_libs/isl.in52
-rw-r--r--config/companion_libs/mpfr.in5
-rw-r--r--config/debug/gdb.in68
-rw-r--r--config/debug/gdb.in.native1
-rw-r--r--config/debug/strace.in57
-rw-r--r--config/libc/mingw.in39
-rw-r--r--config/libc/musl.in12
-rw-r--r--config/libc/newlib.in37
-rw-r--r--config/libc/newlib.in.2104
-rw-r--r--config/libc/uClibc.in7
-rw-r--r--config/toolchain.in4
-rw-r--r--configure.ac22
-rw-r--r--ct-ng.in2
-rw-r--r--kconfig/Makefile3
-rw-r--r--kconfig/zconf.gperf2
-rw-r--r--patches/binutils/2.27/120-sh-conf.patch33
-rw-r--r--patches/binutils/2.27/300-001_ld_makefile_patch.patch26
-rw-r--r--patches/binutils/2.27/300-012_check_ldrunpath_length.patch22
-rw-r--r--patches/binutils/2.27/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch11
-rw-r--r--patches/binutils/2.27/330-Dont-link-to-libfl-as-its-unnecessary.patch108
-rw-r--r--patches/binutils/2.27/340-Darwin-gold-binary-cc-include-string-not-cstring.patch13
-rw-r--r--patches/binutils/2.27/350-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch77
-rw-r--r--patches/binutils/2.27/500-sysroot.patch37
-rw-r--r--patches/binutils/2.27/600-poison-system-directories.patch285
-rw-r--r--patches/binutils/2.27/999-xtensa-reverse-shift-count.patch33
-rw-r--r--patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch14
-rw-r--r--patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch14
-rw-r--r--patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch14
-rw-r--r--patches/gcc/6.3.0/100-uclibc-conf.patch (renamed from patches/gcc/6.2.0/100-uclibc-conf.patch)0
-rw-r--r--patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch14
-rw-r--r--patches/gcc/6.3.0/301-missing-execinfo_h.patch (renamed from patches/gcc/6.2.0/301-missing-execinfo_h.patch)0
-rw-r--r--patches/gcc/6.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch (renamed from patches/gcc/6.2.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch)0
-rw-r--r--patches/gcc/6.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch (renamed from patches/gcc/6.2.0/380-gcc-plugin-POSIX-include-sys-select-h.patch)0
-rw-r--r--patches/gcc/6.3.0/810-arm-softfloat-libgcc.patch (renamed from patches/gcc/6.2.0/810-arm-softfloat-libgcc.patch)0
-rw-r--r--patches/gcc/6.3.0/830-arm_unbreak_armv4t.patch (renamed from patches/gcc/6.2.0/830-arm_unbreak_armv4t.patch)0
-rw-r--r--patches/gcc/6.3.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch (renamed from patches/gcc/6.2.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch)0
-rw-r--r--patches/gcc/6.3.0/860-cilk-wchar.patch (renamed from patches/gcc/6.2.0/860-cilk-wchar.patch)0
-rw-r--r--patches/gcc/6.3.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch (renamed from patches/gcc/6.2.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch)0
-rw-r--r--patches/gcc/6.3.0/871-xtensa-Fix-PR-target-78118.patch (renamed from patches/gcc/6.2.0/871-xtensa-Fix-PR-target-78118.patch)0
-rw-r--r--patches/gcc/6.3.0/872-xtensa-Fix-PR-target-78603.patch (renamed from patches/gcc/6.2.0/872-xtensa-Fix-PR-target-78603.patch)0
-rw-r--r--patches/gcc/6.3.0/890-fix-m68k-compile.patch (renamed from patches/gcc/6.2.0/890-fix-m68k-compile.patch)0
-rw-r--r--patches/gcc/6.3.0/891-fix-m68k-uclinux.patch (renamed from patches/gcc/6.2.0/891-fix-m68k-uclinux.patch)0
-rw-r--r--patches/gcc/6.3.0/892-libgcc-mkmap-symver-support-skip_underscore.patch (renamed from patches/gcc/6.2.0/892-libgcc-mkmap-symver-support-skip_underscore.patch)0
-rw-r--r--patches/gcc/6.3.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch (renamed from patches/gcc/6.2.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch)0
-rw-r--r--patches/gcc/6.3.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch (renamed from patches/gcc/6.2.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch)0
-rw-r--r--patches/gcc/6.3.0/895-bfin-define-REENTRANT.patch (renamed from patches/gcc/6.2.0/895-bfin-define-REENTRANT.patch)0
-rw-r--r--patches/gcc/6.3.0/910-nios2-bad-multilib-default.patch (renamed from patches/gcc/6.2.0/910-nios2-bad-multilib-default.patch)0
-rw-r--r--patches/gcc/6.3.0/930-libgcc-disable-split-stack-nothreads.patch (renamed from patches/gcc/6.2.0/930-libgcc-disable-split-stack-nothreads.patch)0
-rw-r--r--patches/gcc/6.3.0/940-uclinux-enable-threads.patch (renamed from patches/gcc/6.2.0/940-uclinux-enable-threads.patch)0
-rw-r--r--patches/gdb/7.12/100-musl_fix.patch28
-rw-r--r--patches/gdb/7.12/101-uclibc-no-gettimeofday-clobber.patch30
-rw-r--r--patches/gdb/7.12/111-xtensa-make-sure-ar_base-is-initialized.patch35
-rw-r--r--patches/gdb/7.12/112-WIP-end-of-prologue-detection-hack.patch31
-rw-r--r--patches/musl/1.0.4/0001-max_align_t.patch140
-rw-r--r--patches/musl/1.1.4/0001-max_align_t.patch153
-rw-r--r--patches/strace/4.10/007_fix_bexecve64_test.patch2
-rw-r--r--patches/strace/4.10/008_decode_mips_indirect_syscall.patch1
-rw-r--r--patches/strace/4.10/009-upstream-musl_includes.patch2
-rw-r--r--patches/strace/4.10/010-use-host-ioctl.patch142
-rw-r--r--patches/strace/4.11/010-use-host-ioctl.patch144
-rw-r--r--patches/strace/4.12/010-use-host-ioctl.patch145
-rw-r--r--patches/strace/4.13/010-use-host-ioctl.patch145
-rw-r--r--patches/strace/4.14/010-use-host-ioctl.patch145
-rw-r--r--patches/strace/4.15/010-use-host-ioctl.patch145
-rw-r--r--samples/arm-nano-eabi/crosstool.config24
-rw-r--r--samples/arm-nano-eabi/reported.by3
-rwxr-xr-xscripts/addToolVersion.sh10
-rw-r--r--scripts/build/arch/x86.sh4
-rw-r--r--scripts/build/binutils/binutils.sh20
-rw-r--r--scripts/build/cc/100-gcc.sh106
-rw-r--r--scripts/build/companion_libs/121-isl.sh18
-rw-r--r--scripts/build/companion_libs/320-libiconv.sh6
-rw-r--r--scripts/build/companion_libs/330-gettext.sh6
-rw-r--r--scripts/build/debug/200-duma.sh6
-rw-r--r--scripts/build/debug/300-gdb.sh66
-rw-r--r--scripts/build/debug/500-strace.sh18
-rw-r--r--scripts/build/libc/glibc.sh56
-rw-r--r--scripts/build/libc/musl.sh2
-rw-r--r--scripts/build/libc/newlib.sh99
-rw-r--r--scripts/build/libc/uClibc.sh4
-rw-r--r--scripts/crosstool-NG.sh.in54
-rw-r--r--scripts/functions46
89 files changed, 2456 insertions, 594 deletions
diff --git a/Makefile.in b/Makefile.in
index 16ab72a..4fb85bb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -69,6 +69,7 @@ export objdump := @OBJDUMP@
export readelf := @READELF@
export patch := @PATCH@
export gperf := @GPERF@
+export gperf_len_type := @GPERF_LEN_TYPE@
export CC := @CC@
export CPP := @CPP@
export CPPFLAGS := @CPPFLAGS@
diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in
index 91b5e9f..07d4a90 100644
--- a/config/binutils/binutils.in
+++ b/config/binutils/binutils.in
@@ -37,21 +37,21 @@ endif # BINUTILS_CUSTOM
if ! BINUTILS_CUSTOM
-config CC_BINUTILS_SHOW_LINARO
+config BINUTILS_SHOW_LINARO
bool
prompt "Show Linaro versions"
help
Linaro is maintaining some advanced/more stable/experimental versions
of binutils, especially for the ARM architecture.
-
+
Those versions have not been blessed by the binutils comunity (nor have they
been cursed either!), but they look to be pretty much stable, and even
more stable than the upstream versions. YMMV...
-
+
If you do not know what this Linaro stuff is, then simply say 'n' here,
and rest in peace. OTOH, if you know what you are doing, you will be
able to use and enjoy :-) the Linaro versions by saying 'y' here.
-
+
Linaro: http://www.linaro.org/
choice
@@ -60,6 +60,11 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config BINUTILS_V_2_27
+ bool
+ prompt "2.27"
+ select BINUTILS_2_27_or_later
+
config BINUTILS_V_2_26
bool
prompt "2.26"
@@ -74,19 +79,25 @@ config BINUTILS_LINARO_V_2_25
bool
prompt "linaro-2.25.0-2015.01-2"
select BINUTILS_2_25_or_later
- depends on CC_BINUTILS_SHOW_LINARO
+ depends on BINUTILS_SHOW_LINARO
config BINUTILS_LINARO_V_2_24
bool
prompt "linaro-2.24.0-2014.11-2"
select BINUTILS_2_24_or_later
- depends on CC_BINUTILS_SHOW_LINARO
+ depends on BINUTILS_SHOW_LINARO
config BINUTILS_V_2_24
bool
prompt "2.24"
select BINUTILS_2_24_or_later
+config BINUTILS_LINARO_V_2_23_2
+ bool
+ prompt "linaro-2.23.2-2013.10-4"
+ select BINUTILS_2_23_2_or_later
+ depends on BINUTILS_SHOW_LINARO
+
config BINUTILS_V_2_23_2
bool
prompt "2.23.2"
@@ -98,15 +109,21 @@ config BINUTILS_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "2.27" if BINUTILS_V_2_27
default "2.26" if BINUTILS_V_2_26
default "2.25.1" if BINUTILS_V_2_25_1
default "linaro-2.25.0-2015.01-2" if BINUTILS_LINARO_V_2_25
default "linaro-2.24.0-2014.11-2" if BINUTILS_LINARO_V_2_24
default "2.24" if BINUTILS_V_2_24
+ default "linaro-2.23.2-2013.10-4" if BINUTILS_LINARO_V_2_23_2
default "2.23.2" if BINUTILS_V_2_23_2
endif # ! BINUTILS_CUSTOM
+config BINUTILS_2_27_or_later
+ bool
+ select BINUTILS_2_26_or_later
+
config BINUTILS_2_26_or_later
bool
select BINUTILS_2_25_1_or_later
@@ -192,7 +209,7 @@ config BINUTILS_LINKER_LD_GOLD
help
Both the historical ld and the new gold linkers will be
installed, with ld being the default linker used.
-
+
See help for gold, above.
config BINUTILS_LINKER_GOLD_LD
@@ -205,7 +222,7 @@ config BINUTILS_LINKER_GOLD_LD
help
Both the historical ld and the new gold linkers will be
installed, with gold being the default linker used.
-
+
See help for gold, above.
endchoice # Enable linkers
@@ -242,7 +259,7 @@ config BINUTILS_LD_WRAPPER
depends on BINUTILS_LINKER_BOTH
help
Add an ld wrapper that calls to either gold or ld.
-
+
By default, the wrapper will call to the default wrapper,
but if you set the environment variable CTNG_LD_IS, you
can change which linker will get called:
@@ -270,7 +287,7 @@ config BINUTILS_EXTRA_CONFIG_ARRAY
default ""
help
Extra flags passed onto ./configure when configuring
-
+
You can enter multiple arguments here, and arguments can contain spaces
if they are properly quoted (or escaped, but prefer quotes). Eg.:
--with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space
diff --git a/config/cc/gcc.in b/config/cc/gcc.in
index 691355a..e0c4875 100644
--- a/config/cc/gcc.in
+++ b/config/cc/gcc.in
@@ -1,7 +1,7 @@
# Compiler options
#
## default y
-## select CC_SUPPORT_CXX
+## select CC_SUPPORT_CXX if !LIBC_none
## select CC_SUPPORT_FORTRAN
## select CC_SUPPORT_JAVA
## select CC_SUPPORT_ADA
@@ -71,9 +71,16 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
-config CC_GCC_V_6_2_0
+
+config CC_GCC_V_6_3_0
bool
- prompt "6.2.0"
+ prompt "6.3.0"
+ select CC_GCC_6
+
+config CC_GCC_V_linaro_6_2
+ bool
+ prompt "linaro-6.2-2016.11"
+ depends on CC_GCC_SHOW_LINARO
select CC_GCC_6
config CC_GCC_V_5_4_0
@@ -81,15 +88,15 @@ config CC_GCC_V_5_4_0
prompt "5.4.0"
select CC_GCC_5
-config CC_GCC_V_linaro_5_2
+config CC_GCC_V_linaro_5_3
bool
- prompt "linaro-5.2-2015.11-2"
+ prompt "linaro-5.3-2016.05"
depends on CC_GCC_SHOW_LINARO
select CC_GCC_5
config CC_GCC_V_linaro_4_9
bool
- prompt "linaro-4.9-2015.06"
+ prompt "linaro-4.9-2016.02"
depends on CC_GCC_SHOW_LINARO
select CC_GCC_4_9
@@ -287,10 +294,11 @@ config CC_GCC_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
- default "6.2.0" if CC_GCC_V_6_2_0
+ default "6.3.0" if CC_GCC_V_6_3_0
+ default "linaro-6.2-2016.11" if CC_GCC_V_linaro_6_2
default "5.4.0" if CC_GCC_V_5_4_0
- default "linaro-5.2-2015.11-2" if CC_GCC_V_linaro_5_2
- default "linaro-4.9-2015.06" if CC_GCC_V_linaro_4_9
+ default "linaro-5.3-2016.05" if CC_GCC_V_linaro_5_3
+ default "linaro-4.9-2016.02" if CC_GCC_V_linaro_4_9
default "4.9.4" if CC_GCC_V_4_9_4
default "linaro-4.8-2015.06" if CC_GCC_V_linaro_4_8
default "4.8.5" if CC_GCC_V_4_8_5
diff --git a/config/companion_libs.in b/config/companion_libs.in
index 67094cb..7d1d4f7 100644
--- a/config/companion_libs.in
+++ b/config/companion_libs.in
@@ -62,11 +62,15 @@ config COMPLIBS
bool
config LIBICONV
- bool
+ bool "Build local libiconv"
+ default y if CANADIAN || CROSS_NATIVE
select COMPLIBS
config GETTEXT
- bool
+ bool "Build local gettext"
+ default y if CANADIAN || CROSS_NATIVE
+ select LIBICONV_NEEDED
+ select NCURSES_NEEDED
select COMPLIBS
config GMP
diff --git a/config/companion_libs/cloog.in b/config/companion_libs/cloog.in
index dcac30d..d6e129d 100644
--- a/config/companion_libs/cloog.in
+++ b/config/companion_libs/cloog.in
@@ -1,31 +1,32 @@
# CLooG options
+# CLooG 0.18.4 requires ISL 0.12 or newer
+# CLooG 0.18.1/0.18.0 frequires ISL 0.12 or older
choice
bool
prompt "CLooG version"
-if ISL
-
# Don't remove next line
# CT_INSERT_VERSION_BELOW
config CLOOG_V_0_18_4
bool
prompt "0.18.4"
+ depends on ISL_V_0_12_or_later
select CLOOG_0_18_4_or_later
config CLOOG_V_0_18_1
bool
prompt "0.18.1"
+ depends on !ISL_V_0_14_or_later
select CLOOG_0_18_or_later
config CLOOG_V_0_18_0
bool
prompt "0.18.0"
+ depends on !ISL_V_0_14_or_later
select CLOOG_0_18_or_later
-endif # ISL
-
endchoice
config CLOOG_VERSION
diff --git a/config/companion_libs/expat.in b/config/companion_libs/expat.in
index 1dff4a7..3f2ebd2 100644
--- a/config/companion_libs/expat.in
+++ b/config/companion_libs/expat.in
@@ -6,9 +6,13 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
-config EXPAT_V_2_1_0
+config EXPAT_V_2_2_0
bool
- prompt "2.1.0"
+ prompt "2.2.0"
+
+config EXPAT_V_2_1_1
+ bool
+ prompt "2.1.1"
endchoice
@@ -16,4 +20,5 @@ config EXPAT_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
- default "2.1.0" if EXPAT_V_2_1_0
+ default "2.2.0" if EXPAT_V_2_2_0
+ default "2.1.1" if EXPAT_V_2_1_1
diff --git a/config/companion_libs/gmp.in b/config/companion_libs/gmp.in
index 52ffcdf..b92050d 100644
--- a/config/companion_libs/gmp.in
+++ b/config/companion_libs/gmp.in
@@ -6,6 +6,11 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config GMP_V_6_1_2
+ bool
+ prompt "6.1.2"
+ select GMP_5_0_2_or_later
+
config GMP_V_6_1_0
bool
prompt "6.1.0"
@@ -57,6 +62,7 @@ config GMP_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "6.1.2" if GMP_V_6_1_2
default "6.1.0" if GMP_V_6_1_0
default "6.0.0a" if GMP_V_6_0_0
default "5.1.3" if GMP_V_5_1_3
diff --git a/config/companion_libs/isl.in b/config/companion_libs/isl.in
index 1477212..f1af3a0 100644
--- a/config/companion_libs/isl.in
+++ b/config/companion_libs/isl.in
@@ -1,31 +1,71 @@
# ISL options
+# GCC 4.8 supports ISL 0.10 to 0.14
+# GCC 4.9 supports ISL 0.10 to 0.15
+# GCC 5 supports ISL 0.12 to 0.16
+# GCC 6 supports ISL 0.14 to 0.16
+# Starting with GCC 5, GCC's configure no longer checks the ISL version explicitly,
+# despite what the configure's message says ("checking for isl 0.15 or 0.16").
+# Instead, it verifies that certain interfaces are available, so it accepts 0.17.1
+# or 0.18 under that check. Include them as experimental just in case anyone needs
+# the bugfixes in these releases.
choice
bool
prompt "ISL version"
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config ISL_V_0_18
+ bool
+ prompt "0.18"
+ depends on EXPERIMENTAL # Not officially recommended by GCC
+ depends on CC_GCC_5_or_later
+ select ISL_V_0_16_or_later
+
+config ISL_V_0_17_1
+ bool
+ prompt "0.17.1"
+ depends on EXPERIMENTAL # Not officially recommended by GCC
+ depends on CC_GCC_5_or_later
+ select ISL_V_0_16_or_later
+
+config ISL_V_0_16_1
+ bool
+ prompt "0.16.1"
+ depends on CC_GCC_5_or_later
+ select ISL_V_0_16_or_later
+
+config ISL_V_0_15
+ bool
+ prompt "0.15"
+ select ISL_V_0_15_or_later
+
config ISL_V_0_14
bool
prompt "0.14"
- depends on CLOOG_0_18_4_or_later || CC_GCC_5_or_later
select ISL_V_0_14_or_later
config ISL_V_0_12_2
bool
prompt "0.12.2"
- depends on ! CLOOG_0_18_4_or_later || CC_GCC_5_or_later
+ depends on !CC_GCC_6_or_later
select ISL_V_0_12_or_later
config ISL_V_0_11_1
bool
prompt "0.11.1"
- depends on ! CLOOG_0_18_4_or_later
- depends on ! CC_GCC_5_or_later
+ depends on !CC_GCC_4_9_or_later
endchoice
+config ISL_V_0_16_or_later
+ bool
+ select ISL_V_0_15_or_later
+
+config ISL_V_0_15_or_later
+ bool
+ select ISL_V_0_14_or_later
+
config ISL_V_0_14_or_later
bool
select ISL_V_0_12_or_later
@@ -37,6 +77,10 @@ config ISL_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "0.18" if ISL_V_0_18
+ default "0.17.1" if ISL_V_0_17_1
+ default "0.16.1" if ISL_V_0_16_1
+ default "0.15" if ISL_V_0_15
default "0.14" if ISL_V_0_14
default "0.12.2" if ISL_V_0_12_2
default "0.11.1" if ISL_V_0_11_1
diff --git a/config/companion_libs/mpfr.in b/config/companion_libs/mpfr.in
index fef50b0..5957e23 100644
--- a/config/companion_libs/mpfr.in
+++ b/config/companion_libs/mpfr.in
@@ -6,6 +6,10 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config MPFR_V_3_1_5
+ bool
+ prompt "3.1.5"
+
config MPFR_V_3_1_3
bool
prompt "3.1.3"
@@ -44,6 +48,7 @@ config MPFR_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "3.1.5" if MPFR_V_3_1_5
default "3.1.3" if MPFR_V_3_1_3
default "3.1.2" if MPFR_V_3_1_2
default "3.1.0" if MPFR_V_3_1_0
diff --git a/config/debug/gdb.in b/config/debug/gdb.in
index 2b33d33..6ef0640 100644
--- a/config/debug/gdb.in
+++ b/config/debug/gdb.in
@@ -6,15 +6,13 @@ source "config/debug/gdb.in.cross"
source "config/debug/gdb.in.native"
source "config/debug/gdb.in.gdbserver"
-if GDB_CROSS || GDB_NATIVE || GDB_GDBSERVER
-
comment "gdb version"
config GDB_CUSTOM
bool
prompt "Custom gdb"
depends on EXPERIMENTAL
- select GDB_7_2_or_later
+ select GDB_7_12_or_later
help
The choosen gdb version shall be not downloaded. Instead use
a custom location to get the source.
@@ -48,6 +46,7 @@ if ! GDB_CUSTOM
config DEBUG_GDB_SHOW_LINARO
bool
prompt "Show Linaro versions"
+ depends on OBSOLETE
help
Linaro is maintaining some advanced/more stable/experimental versions
of gdb, especially for the ARM architecture.
@@ -68,6 +67,11 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config GDB_V_7_12
+ bool
+ prompt "7.12"
+ select GDB_7_12_or_later
+
config GDB_V_7_11
bool
prompt "7.11"
@@ -81,48 +85,71 @@ config GDB_V_7_10_1
config GDB_V_7_10
bool
prompt "7.10"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_9_1
bool
prompt "7.9.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_9
bool
prompt "7.9"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_linaro_7_8
bool
prompt "linaro-7.8-2014.09"
depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_8_2
bool
prompt "7.8.2"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_8_1
bool
prompt "7.8.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_8
bool
prompt "7.8"
+ depends on OBSOLETE
+ select GDB_7_2_or_later
+
+config GDB_V_linaro_7_7_1
+ bool
+ prompt "linaro-7.7.1-2014.06"
+ depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_7_1
bool
prompt "7.7.1"
+ depends on OBSOLETE
+ select GDB_7_2_or_later
+
+config GDB_V_linaro_7_7
+ bool
+ prompt "linaro-7.7-2014.05"
+ depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_7
bool
prompt "7.7"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_linaro_7_6
@@ -134,85 +161,97 @@ config GDB_V_linaro_7_6
config GDB_V_7_6_1
bool
prompt "7.6.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_linaro_7_5
bool
- prompt "linaro-7.5-2012.12-1"
+ prompt "linaro-7.5-2012.12"
depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_5_1
bool
prompt "7.5.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_linaro_7_4
bool
prompt "linaro-7.4-2012.06"
depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_4_1
bool
prompt "7.4.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_4
bool
prompt "7.4"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_linaro_7_3
bool
prompt "linaro-7.3-2011.12"
depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_3_1
bool
prompt "7.3.1"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_3a
bool
prompt "7.3a"
- select GDB_7_2_or_later
-
-config GDB_V_linaro_7_2
- bool
- prompt "linaro-7.2-2011.05-0"
- depends on DEBUG_GDB_SHOW_LINARO
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_2a
bool
prompt "7.2a"
+ depends on OBSOLETE
select GDB_7_2_or_later
config GDB_V_7_1a
bool
prompt "7.1a"
+ depends on OBSOLETE
select GDB_7_0_or_later
config GDB_V_7_0_1a
bool
prompt "7.0.1a"
+ depends on OBSOLETE
select GDB_7_0_or_later
config GDB_V_7_0a
bool
prompt "7.0a"
+ depends on OBSOLETE
select GDB_7_0_or_later
config GDB_V_6_8a
bool
+ depends on OBSOLETE
prompt "6.8a"
endchoice
endif # ! GDB_CUSTOM
+config GDB_7_12_or_later
+ bool
+ select GDB_7_2_or_later
+
config GDB_7_2_or_later
bool
select GDB_7_0_or_later
@@ -238,6 +277,7 @@ config GDB_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "7.12" if GDB_V_7_12
default "7.11" if GDB_V_7_11
default "7.10.1" if GDB_V_7_10_1
default "7.10" if GDB_V_7_10
@@ -247,11 +287,13 @@ config GDB_VERSION
default "linaro-7.8-2014.09" if GDB_V_linaro_7_8
default "7.8.1" if GDB_V_7_8_1
default "7.8" if GDB_V_7_8
+ default "linaro-7.7.1-2014.06-1" if GDB_V_linaro_7_7_1
default "7.7.1" if GDB_V_7_7_1
+ default "linaro-7.7-2014.05" if GDB_V_linaro_7_7
default "7.7" if GDB_V_7_7
default "linaro-7.6.1-2013.10" if GDB_V_linaro_7_6
default "7.6.1" if GDB_V_7_6_1
- default "linaro-7.5-2012.12-1" if GDB_V_linaro_7_5
+ default "linaro-7.5-2012.12" if GDB_V_linaro_7_5
default "7.5.1" if GDB_V_7_5_1
default "linaro-7.4-2012.06" if GDB_V_linaro_7_4
default "7.4.1" if GDB_V_7_4_1
@@ -259,7 +301,6 @@ config GDB_VERSION
default "linaro-7.3-2011.12" if GDB_V_linaro_7_3
default "7.3.1" if GDB_V_7_3_1
default "7.3a" if GDB_V_7_3a
- default "linaro-7.2-2011.05-0" if GDB_V_linaro_7_2_2011_05_0
default "7.2a" if GDB_V_7_2a
default "7.1a" if GDB_V_7_1a
default "7.0.1a" if GDB_V_7_0_1a
@@ -267,6 +308,3 @@ config GDB_VERSION
default "6.8a" if GDB_V_6_8a
endif # ! GDB_CUSTOM
-
-endif # GDB_CROSS || GDB_NATIVE || GDB_GDBSERVER
-
diff --git a/config/debug/gdb.in.native b/config/debug/gdb.in.native
index 915debd..634b13b 100644
--- a/config/debug/gdb.in.native
+++ b/config/debug/gdb.in.native
@@ -5,6 +5,7 @@ config GDB_NATIVE
prompt "Native gdb"
depends on ! BARE_METAL
depends on ! BACKEND
+ depends on CC_LANG_CXX || !GDB_7_12_or_later
select EXPAT_TARGET
select NCURSES_TARGET
help
diff --git a/config/debug/strace.in b/config/debug/strace.in
index 5566129..a225878 100644
--- a/config/debug/strace.in
+++ b/config/debug/strace.in
@@ -8,42 +8,78 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config STRACE_V_4_15
+ bool
+ prompt "4.15"
+ depends on CONFIGURE_has_xz
+
+config STRACE_V_4_14
+ bool
+ prompt "4.14"
+ depends on CONFIGURE_has_xz
+
+config STRACE_V_4_13
+ bool
+ prompt "4.13 (OBSOLETE)"
+ depends on OBSOLETE
+ depends on CONFIGURE_has_xz
+
+config STRACE_V_4_12
+ bool
+ prompt "4.12 (OBSOLETE)"
+ depends on OBSOLETE
+ depends on CONFIGURE_has_xz
+
+config STRACE_V_4_11
+ bool
+ prompt "4.11 (OBSOLETE)"
+ depends on OBSOLETE
+ depends on CONFIGURE_has_xz
+
config STRACE_V_4_10
bool
- prompt "4.10"
+ prompt "4.10 (OBSOLETE)"
+ depends on OBSOLETE
depends on CONFIGURE_has_xz
config STRACE_V_4_9
bool
- prompt "4.9"
+ prompt "4.9 (OBSOLETE)"
+ depends on OBSOLETE
depends on CONFIGURE_has_xz
config STRACE_V_4_8
bool
- prompt "4.8"
+ prompt "4.8 (OBSOLETE)"
+ depends on OBSOLETE
depends on CONFIGURE_has_xz
config STRACE_V_4_7
bool
- prompt "4.7"
+ prompt "4.7 (OBSOLETE)"
+ depends on OBSOLETE
depends on CONFIGURE_has_xz
config STRACE_V_4_6
bool
- prompt "4.6"
+ prompt "4.6 (OBSOLETE)"
+ depends on OBSOLETE
depends on CONFIGURE_has_xz
config STRACE_V_4_5_20
bool
- prompt "4.5.20"
+ prompt "4.5.20 (OBSOLETE)"
+ depends on OBSOLETE
config STRACE_V_4_5_19
bool
- prompt "4.5.19"
+ prompt "4.5.19 (OBSOLETE)"
+ depends on OBSOLETE
config STRACE_V_4_5_18
bool
- prompt "4.5.18"
+ prompt "4.5.18 (OBSOLETE)"
+ depends on OBSOLETE
endchoice
@@ -51,6 +87,11 @@ config STRACE_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "4.15" if STRACE_V_4_15
+ default "4.14" if STRACE_V_4_14
+ default "4.13" if STRACE_V_4_13
+ default "4.12" if STRACE_V_4_12
+ default "4.11" if STRACE_V_4_11
default "4.10" if STRACE_V_4_10
default "4.9" if STRACE_V_4_9
default "4.8" if STRACE_V_4_8
diff --git a/config/libc/mingw.in b/config/libc/mingw.in
index 45b6971..6c33d2f 100644
--- a/config/libc/mingw.in
+++ b/config/libc/mingw.in
@@ -16,29 +16,36 @@ choice
bool
prompt "Windows API version"
-config WINAPI_V_DEVEL
- bool
- prompt "devel"
- depends on EXPERIMENTAL
-
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config WINAPI_V_5_0_1
+ bool
+ prompt "5.0.1"
+
+config WINAPI_V_5_0_0
+ bool
+ prompt "5.0.0 (OBSOLETE)"
+ depends on OBSOLETE
+
config WINAPI_V_4_0_4
bool
prompt "4.0.4"
config WINAPI_V_4_0_2
bool
- prompt "4.0.2"
+ prompt "4.0.2 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_4_0_1
bool
- prompt "4.0.1"
+ prompt "4.0.1 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_4_0_0
bool
- prompt "4.0.0"
+ prompt "4.0.0 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_3_1_0
bool
@@ -46,20 +53,28 @@ config WINAPI_V_3_1_0
config WINAPI_V_3_0_0
bool
- prompt "3.0.0"
+ prompt "3.0.0 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_2_0_8
bool
- prompt "2.0.8"
+ prompt "2.0.8 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_2_0_7
bool
- prompt "2.0.7"
+ prompt "2.0.7 (OBSOLETE)"
+ depends on OBSOLETE
config WINAPI_V_select
bool
prompt "Other version"
+config WINAPI_V_DEVEL
+ bool
+ prompt "devel"
+ depends on EXPERIMENTAL
+
endchoice
config WINAPI_VERSION
@@ -68,6 +83,8 @@ config WINAPI_VERSION
default "devel" if WINAPI_V_DEVEL
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "5.0.1" if WINAPI_V_5_0_1
+ default "5.0.0" if WINAPI_V_5_0_0
default "4.0.4" if WINAPI_V_4_0_4
default "4.0.2" if WINAPI_V_4_0_2
default "4.0.1" if WINAPI_V_4_0_1
diff --git a/config/libc/musl.in b/config/libc/musl.in
index 3e0b5a1..5ea166f 100644
--- a/config/libc/musl.in
+++ b/config/libc/musl.in
@@ -53,17 +53,23 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
-config LIBC_MUSL_V_1_1
+config LIBC_MUSL_V_1_1_16
bool
- prompt "1.1.15 (Mainline)"
+ prompt "1.1.16"
depends on EXPERIMENTAL
+config LIBC_MUSL_V_1_1_15
+ bool
+ prompt "1.1.15 (OBSOLETE)"
+ depends on EXPERIMENTAL && OBSOLETE
+
endchoice
config LIBC_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
- default "1.1.15" if LIBC_MUSL_V_1_1
+ default "1.1.16" if LIBC_MUSL_V_1_1_16
+ default "1.1.15" if LIBC_MUSL_V_1_1_15
endif # ! LIBC_MUSL_CUSTOM
diff --git a/config/libc/newlib.in b/config/libc/newlib.in
index a201551..166130f 100644
--- a/config/libc/newlib.in
+++ b/config/libc/newlib.in
@@ -17,7 +17,7 @@ config LIBC_NEWLIB_CUSTOM
bool
prompt "Custom newlib"
depends on EXPERIMENTAL
- select LIBC_NEWLIB_2_3_or_later
+ select LIBC_NEWLIB_2_5_or_later
help
The choosen newlib version shall be not downloaded. Instead use
a custom location to get the source.
@@ -54,15 +54,15 @@ config CC_NEWLIB_SHOW_LINARO
help
Linaro is maintaining some advanced/more stable/experimental versions
of newlib, especially for the ARM architecture.
-
+
Those versions have not been blessed by the newlib comunity (nor have they
been cursed either!), but they look to be pretty much stable, and even
more stable than the upstream versions. YMMV...
-
+
If you do not know what this Linaro stuff is, then simply say 'n' here,
and rest in peace. OTOH, if you know what you are doing, you will be
able to use and enjoy :-) the Linaro versions by saying 'y' here.
-
+
Linaro: http://www.linaro.org/
choice
@@ -70,6 +70,15 @@ choice
prompt "newlib version"
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config LIBC_NEWLIB_V_2_5_0
+ bool
+ prompt "2.5.0"
+ select LIBC_NEWLIB_2_5
+
+config LIBC_NEWLIB_V_2_4_0
+ bool
+ prompt "2.4.0.20161025"
+ select LIBC_NEWLIB_2_4
config LIBC_NEWLIB_V_2_3_0
bool
@@ -123,6 +132,14 @@ endchoice
endif # ! LIBC_NEWLIB_CUSTOM
+config LIBC_NEWLIB_2_5
+ bool
+ select LIBC_NEWLIB_2_5_or_later
+
+config LIBC_NEWLIB_2_4
+ bool
+ select LIBC_NEWLIB_2_4_or_later
+
config LIBC_NEWLIB_2_3
bool
select LIBC_NEWLIB_2_3_or_later
@@ -139,6 +156,14 @@ config LIBC_NEWLIB_2_0
bool
select LIBC_NEWLIB_2_0_or_later
+config LIBC_NEWLIB_2_5_or_later
+ bool
+ select LIBC_NEWLIB_2_4_or_later
+
+config LIBC_NEWLIB_2_4_or_later
+ bool
+ select LIBC_NEWLIB_2_3_or_later
+
config LIBC_NEWLIB_2_3_or_later
bool
select LIBC_NEWLIB_2_2_or_later
@@ -162,6 +187,8 @@ config LIBC_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "2.5.0" if LIBC_NEWLIB_V_2_5_0
+ default "2.4.0.20161025" if LIBC_NEWLIB_V_2_4_0
default "2.3.0.20160226" if LIBC_NEWLIB_V_2_3_0
default "linaro-2.2.0-2015.01" if LIBC_NEWLIB_LINARO_V_2_2_0
default "2.2.0.20151023" if LIBC_NEWLIB_V_2_2_0
@@ -189,5 +216,5 @@ config LIBC_NEWLIB_TARGET_CFLAGS
gcc target libraries.
Note: Both TARGET_CFLAGS and LIBC_NEWLIB_TARGET_CFLAGS are used
to compile the libraries.
-
+
Leave blank if you don't know better.
diff --git a/config/libc/newlib.in.2 b/config/libc/newlib.in.2
index 48e5503..927cce8 100644
--- a/config/libc/newlib.in.2
+++ b/config/libc/newlib.in.2
@@ -26,6 +26,41 @@ config LIBC_NEWLIB_IO_LDBL
help
Enable support for IOs on long doubles.
+config LIBC_NEWLIB_IO_POS_ARGS
+ bool
+ prompt "Enable printf-family positional arg support"
+ help
+ Enable printf-family positional arg support.
+
+config LIBC_NEWLIB_FVWRITE_IN_STREAMIO
+ bool
+ prompt "Vector buffer mechanism to support stream IO buffering"
+ default y
+ help
+ NEWLIB implements the vector buffer mechanism to support stream IO
+ buffering required by C standard. This feature is possibly
+ unnecessary for embedded systems which won't change file buffering
+ with functions like `setbuf' or `setvbuf'. The buffering mechanism
+ still acts as default for STDIN/STDOUT/STDERR even if this option
+ is specified.
+
+config LIBC_NEWLIB_UNBUF_STREAM_OPT
+ bool
+ prompt "Optimize fprintf to unbuffered unix file"
+ default y
+ help
+ NEWLIB does optimization when `fprintf to write only unbuffered unix
+ file'. It creates a temorary buffer to do the optimization that
+ increases stack consumption by about `BUFSIZ' bytes. Disabling this option
+ disables the optimization and saves size of text and stack.
+
+config LIBC_NEWLIB_FSEEK_OPTIMIZATION
+ bool
+ prompt "Fseek optimisation"
+ default y
+ help
+ Disabling fseek optimisation can decrease code size.
+
config LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS
bool
prompt "Disable the syscalls supplied with newlib"
@@ -35,15 +70,82 @@ config LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS
_write... If you plan to port newlib to a new
platform/board, say Yes.
+config LIBC_NEWLIB_REGISTER_FINI
+ bool
+ prompt "Enable finalization function registration using atexit"
+ help
+ Enable finalization function registration using atexit.
+
+config LIBC_NEWLIB_ATEXIT_DYNAMIC_ALLOC
+ bool
+ prompt "Enable dynamic allocation of atexit entries"
+ default y
+ help
+ Enable dynamic allocation of atexit entries.
+
+config LIBC_NEWLIB_GLOBAL_ATEXIT
+ bool
+ prompt "Enable atexit data structure as global variable"
+ help
+ Enable atexit data structure as global variable. By doing so it is
+ move out of _reent structure, and can be garbage collected if atexit
+ is not referenced.
+
+config LIBC_NEWLIB_LITE_EXIT
+ bool
+ prompt "Enable lite exit"
+ help
+ Enable lite exit, a size-reduced implementation of exit that doesn't
+ invoke clean-up functions such as _fini or global destructors.
+
+config LIBC_NEWLIB_REENT_SMALL
+ bool
+ prompt "Enable small reentrant struct support"
+ help
+ Enable small reentrant struct support.
+
+config LIBC_NEWLIB_MULTITHREAD
+ bool
+ prompt "Enable support for multiple threads"
+ default y
+ help
+ Enable support for multiple threads.
+
+config LIBC_NEWLIB_EXTRA_SECTIONS
+ bool
+ prompt "Place each function & data element in their own section"
+ help
+ Place each function & data symbol in their own section. This allows
+ the linker to garbage collect unused symbols at link time.
+
+config LIBC_NEWLIB_WIDE_ORIENT
+ bool
+ prompt "Allow wide C99 stream orientation"
+ default y
+ help
+ C99 states that each stream has an orientation, wide or byte. This
+ feature is possibly unnecessary for embedded systems which only do
+ byte input/output operations on stream. Disabling this feature can
+ decrease code size.
+
config LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE
bool
prompt "Optimize newlib for size"
default y
help
Pass --enable-target-optspace to newlib configure.
-
+
This will compile newlib with -Os.
+config LIBC_NEWLIB_LTO
+ bool
+ prompt "Enable Link Time Optimization"
+ help
+ Builds the libraries with -flto to enable more aggressive link time
+ optimization. You will need to add -flto-partition=one to your
+ application's link line to keep the RETURN assembler macro together
+ with it's consumers.
+
config LIBC_NEWLIB_NANO_MALLOC
bool
prompt "Enable Nano Malloc"
diff --git a/config/libc/uClibc.in b/config/libc/uClibc.in
index c6b8576..43457c5 100644
--- a/config/libc/uClibc.in
+++ b/config/libc/uClibc.in
@@ -81,9 +81,15 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
+config LIBC_UCLIBC_NG_V_1_0_21
+ bool
+ prompt "1.0.21"
+ select LIBC_UCLIBC_NG_1_0_15_or_later
+
config LIBC_UCLIBC_NG_V_1_0_20
bool
prompt "1.0.20"
+ depends on OBSOLETE
select LIBC_UCLIBC_NG_1_0_15_or_later
config LIBC_UCLIBC_V_0_9_33_2
@@ -97,6 +103,7 @@ config LIBC_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
+ default "1.0.21" if LIBC_UCLIBC_NG_V_1_0_21
default "1.0.20" if LIBC_UCLIBC_NG_V_1_0_20
default "0.9.33.2" if LIBC_UCLIBC_V_0_9_33_2
diff --git a/config/toolchain.in b/config/toolchain.in
index ca74ee7..5a5f929 100644
--- a/config/toolchain.in
+++ b/config/toolchain.in
@@ -4,12 +4,13 @@ comment "General toolchain options"
config FORCE_SYSROOT
bool
- default y if !OBSOLETE
+ default y if !OBSOLETE && !BARE_METAL
select USE_SYSROOT
config USE_SYSROOT
bool
prompt "Use sysroot'ed toolchain"
+ depends on !BARE_METAL
default y
help
Use the 'shinny new' sysroot feature of gcc: libraries split between
@@ -308,6 +309,7 @@ comment "Misc options"
config TOOLCHAIN_ENABLE_NLS
bool
prompt "Enable nls"
+ select GETTEXT_NEEDED
help
Say 'Y' here to enable native language support (nls).
diff --git a/configure.ac b/configure.ac
index 492d315..76f0d30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,9 +134,9 @@ AS_IF([test -z "$CC"],
AC_PROG_CPP
#---------------------------------------------------------------------
-# Check to see if gcc can static link
-AC_MSG_CHECKING([if gcc can static link])
-echo "int main() {}" | gcc -static -o /dev/null -xc - > /dev/null 2>&1
+# Check to see if the compiler can link statically
+AC_MSG_CHECKING([if $CC can static link])
+echo "int main() {}" | ${CC} -static -o /dev/null -xc - > /dev/null 2>&1
static_test=$?
AS_IF([test $static_test -eq 0],
[static_link=y
@@ -305,6 +305,22 @@ AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
AC_SUBST([automake], [$ac_cv_path_automake])
+#----------------------------------------
+# Gperf 3.1 started generating functions with size_t rather than unsigned int
+AC_MSG_CHECKING([for the type used in gperf declarations])
+echo "#include <string.h>" > conftest.gperf.c
+echo "const char * in_word_set(const char *, GPERF_LEN_TYPE);" >> conftest.gperf.c
+echo foo,bar | ${GPERF} -L ANSI-C >> conftest.gperf.c
+AS_IF([${CC} -c -o /dev/null conftest.gperf.c -DGPERF_LEN_TYPE='size_t' >/dev/null 2>&1],
+ [AC_MSG_RESULT([size_t])
+ GPERF_LEN_TYPE='size_t'],
+ [${CC} -c -o /dev/null conftest.gperf.c -DGPERF_LEN_TYPE='unsigned int' >/dev/null 2>&1],
+ [AC_MSG_RESULT([unsigned int])
+ GPERF_LEN_TYPE='unsigned int'],
+ [AC_MSG_ERROR([unable to determine gperf len type])])
+rm -f conftest.gperf.c
+AC_SUBST([GPERF_LEN_TYPE])
+
#--------------------------------------------------------------------
# Boring again... But still a bit of work to do...
#--------------------------------------------------------------------
diff --git a/ct-ng.in b/ct-ng.in
index 6149d1b..51b1ff6 100644
--- a/ct-ng.in
+++ b/ct-ng.in
@@ -10,7 +10,7 @@ MAKEFLAGS += --no-print-directory --no-builtin-rules
.NOTPARALLEL:
# This is where ct-ng is:
-export CT_NG:=$(lastword $(MAKEFILE_LIST))
+export CT_NG:=$(abspath $(lastword $(MAKEFILE_LIST)))
# and this is where we're working in:
export CT_TOP_DIR:=$(shell pwd)
diff --git a/kconfig/Makefile b/kconfig/Makefile
index 9f30566..ee838aa 100644
--- a/kconfig/Makefile
+++ b/kconfig/Makefile
@@ -6,7 +6,8 @@ all: conf mconf nconf
@true # Just be silent, you fscking son of a fscking beach...
# Build flags
-CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
+CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\"" \
+ -DGPERF_LEN_TYPE="$(gperf_len_type)"
LDFLAGS = $(INTL_LIBS)
# Compiler flags to use gettext
diff --git a/kconfig/zconf.gperf b/kconfig/zconf.gperf
index ac498f0..434483b 100644
--- a/kconfig/zconf.gperf
+++ b/kconfig/zconf.gperf
@@ -9,7 +9,7 @@
struct kconf_id;
-static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
+static const struct kconf_id *kconf_id_lookup(register const char *str, register GPERF_LEN_TYPE len);
%%
mainmenu, T_MAINMENU, TF_COMMAND
diff --git a/patches/binutils/2.27/120-sh-conf.patch b/patches/binutils/2.27/120-sh-conf.patch
new file mode 100644
index 0000000..c12a023
--- /dev/null
+++ b/patches/binutils/2.27/120-sh-conf.patch
@@ -0,0 +1,33 @@
+r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
+
+Likewise, binutils has no idea about any of these new targets either, so we
+fix that up too.. now we're able to actually build a real toolchain for
+sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
+inept targets than that one, really. Go look, I promise).
+
+diff --git a/configure b/configure
+index 87677bc..2d916f1 100755
+--- a/configure
++++ b/configure
+@@ -3812,7 +3812,7 @@ case "${target}" in
+ or1k*-*-*)
+ noconfigdirs="$noconfigdirs gdb"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${target}" in
+ sh*-*-elf)
+ ;;
+diff --git a/configure.ac b/configure.ac
+index 8fe0eca..b10a99f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1140,7 +1140,7 @@ case "${target}" in
+ or1k*-*-*)
+ noconfigdirs="$noconfigdirs gdb"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${target}" in
+ sh*-*-elf)
+ ;;
diff --git a/patches/binutils/2.27/300-001_ld_makefile_patch.patch b/patches/binutils/2.27/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..2a1320c
--- /dev/null
+++ b/patches/binutils/2.27/300-001_ld_makefile_patch.patch
@@ -0,0 +1,26 @@
+diff --git a/ld/Makefile.am b/ld/Makefile.am
+index 9575f1f..84df0bf 100644
+--- 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@
+diff --git a/ld/Makefile.in b/ld/Makefile.in
+index 9f56ca1..272860f 100644
+--- 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
diff --git a/patches/binutils/2.27/300-012_check_ldrunpath_length.patch b/patches/binutils/2.27/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..f1f31af
--- /dev/null
+++ b/patches/binutils/2.27/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,22 @@
+diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
+index 137446f..bb8391a 100644
+--- a/ld/emultempl/elf32.em
++++ b/ld/emultempl/elf32.em
+@@ -1195,6 +1195,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;
+@@ -1458,6 +1460,8 @@ gld${EMULATION_NAME}_before_allocation (void)
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (*rpath == '\0'))
++ rpath = NULL;
+
+ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
diff --git a/patches/binutils/2.27/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch b/patches/binutils/2.27/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch
new file mode 100644
index 0000000..2956385
--- /dev/null
+++ b/patches/binutils/2.27/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch
@@ -0,0 +1,11 @@
+--- binutils-2.27/gold/gold-threads.cc.orig 2016-12-26 16:44:23.691075600 +1100
++++ binutils-2.27/gold/gold-threads.cc 2016-12-26 16:46:21.071855200 +1100
+@@ -101,7 +101,7 @@
+ int err = pthread_mutexattr_init(&attr);
+ if (err != 0)
+ gold_fatal(_("pthead_mutexattr_init failed: %s"), strerror(err));
+-#ifdef PTHREAD_MUTEX_ADAPTIVE_NP
++#if defined(PTHREAD_MUTEX_ADAPTIVE_NP) && !defined(_WIN32)
+ err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+ if (err != 0)
+ gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err));
diff --git a/patches/binutils/2.27/330-Dont-link-to-libfl-as-its-unnecessary.patch b/patches/binutils/2.27/330-Dont-link-to-libfl-as-its-unnecessary.patch
new file mode 100644
index 0000000..c52af05
--- /dev/null
+++ b/patches/binutils/2.27/330-Dont-link-to-libfl-as-its-unnecessary.patch
@@ -0,0 +1,108 @@
+diff --git a/binutils/configure b/binutils/configure
+index 6e1f21e..78bf4ae 100755
+--- a/binutils/configure
++++ b/binutils/configure
+@@ -12106,6 +12106,7 @@
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -12267,6 +12268,8 @@
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr ca"
+ # If we haven't got the data from the intl directory,
+diff --git a/binutils/configure.ac b/binutils/configure.ac
+index defe781..8fd236a 100644
+--- a/binutils/configure.ac
++++ b/binutils/configure.ac
+@@ -87,7 +87,10 @@
+ fi
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr ca"
+ ZW_GNU_GETTEXT_SISTER_DIR
+diff --git a/gas/configure b/gas/configure
+index f959e95..9bb4043 100755
+--- a/gas/configure
++++ b/gas/configure
+@@ -12819,6 +12819,7 @@ fi
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -12980,6 +12981,8 @@ esac
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="fr tr es rw id ru fi ja zh_CN"
+ # If we haven't got the data from the intl directory,
+diff --git a/gas/configure.ac b/gas/configure.ac
+index 07f825d..c552b7e 100644
+--- a/gas/configure.ac
++++ b/gas/configure.ac
+@@ -734,7 +734,10 @@ AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.])
+ AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="fr tr es rw id ru fi ja zh_CN"
+ ZW_GNU_GETTEXT_SISTER_DIR
+diff --git a/ld/configure b/ld/configure
+index a446283..1a6bf81 100755
+--- a/ld/configure
++++ b/ld/configure
+@@ -16087,6 +16087,7 @@ fi
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -16248,6 +16249,8 @@ esac
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+diff --git a/ld/configure.ac b/ld/configure.ac
+index 188172d..45eec53 100644
+--- a/ld/configure.ac
++++ b/ld/configure.ac
+@@ -186,7 +186,10 @@ AM_PO_SUBDIRS
+ AC_EXEEXT
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ AM_MAINTAINER_MODE
+ AM_CONDITIONAL(GENINSRC_NEVER, false)
diff --git a/patches/binutils/2.27/340-Darwin-gold-binary-cc-include-string-not-cstring.patch b/patches/binutils/2.27/340-Darwin-gold-binary-cc-include-string-not-cstring.patch
new file mode 100644
index 0000000..e4f235b
--- /dev/null
+++ b/patches/binutils/2.27/340-Darwin-gold-binary-cc-include-string-not-cstring.patch
@@ -0,0 +1,13 @@
+diff --git a/gold/binary.cc b/gold/binary.cc
+index 52df81a..03a8f20 100644
+--- a/gold/binary.cc
++++ b/gold/binary.cc
+@@ -23,7 +23,7 @@
+ #include "gold.h"
+
+ #include <cerrno>
+-#include <cstring>
++#include <string>
+
+ #include "elfcpp.h"
+ #include "stringpool.h"
diff --git a/patches/binutils/2.27/350-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch b/patches/binutils/2.27/350-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch
new file mode 100644
index 0000000..6168b31
--- /dev/null
+++ b/patches/binutils/2.27/350-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch
@@ -0,0 +1,77 @@
+From c39479f4ab4d372b518957871e1f205a03e7c3d6 Mon Sep 17 00:00:00 2001
+From: Andrew Hsieh <andrewhsieh@google.com>
+Date: Wed, 18 Mar 2015 10:57:24 +0800
+Subject: [PATCH] Fix darwin build
+
+1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4
+ doesn't support ended initializer list
+2. wcsncasecmp doesn't exist in MacSDK10.6.x
+
+Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
+---
+ binutils-2.25/bfd/peXXigen.c | 22 ++++++++++++++++++++++
+ binutils-2.25/gold/gold-threads.cc | 15 ++++++++++++---
+ 2 files changed, 34 insertions(+), 3 deletions(-)
+
+diff --git binutils-2.25.orig/bfd/peXXigen.c binutils-2.25/bfd/peXXigen.c
+index 13e39e4..7a98306 100644
+--- binutils-2.25.orig/bfd/peXXigen.c
++++ binutils-2.25/bfd/peXXigen.c
+@@ -3522,6 +3522,28 @@ u16_mbtouc (wchar_t * puc, const unsigned short * s, unsigned int n)
+ }
+ #endif /* HAVE_WCHAR_H and not Cygwin/Mingw */
+
++#if defined __APPLE__ && __DARWIN_C_LEVEL < 200809L
++/* wcsncasecmp isn't always defined in Mac SDK */
++static int
++wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
++{
++ wchar_t c1, c2;
++
++ if (n == 0)
++ return (0);
++ for (; *s1; s1++, s2++)
++ {
++ c1 = towlower(*s1);
++ c2 = towlower(*s2);
++ if (c1 != c2)
++ return ((int)c1 - c2);
++ if (--n == 0)
++ return (0);
++ }
++ return (-*s2);
++}
++#endif
++
+ /* Perform a comparison of two entries. */
+ static signed int
+ rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
+diff --git binutils-2.25.orig/gold/gold-threads.cc binutils-2.25/gold/gold-threads.cc
+index ff5a8ac..45140e0 100644
+--- binutils-2.25.orig/gold/gold-threads.cc
++++ binutils-2.25/gold/gold-threads.cc
+@@ -284,9 +284,18 @@ Condvar::~Condvar()
+ class Once_initialize
+ {
+ public:
+- Once_initialize()
+- : once_(PTHREAD_ONCE_INIT)
+- { }
++ Once_initialize()
++#if !defined(__APPLE__)
++ : once_(PTHREAD_ONCE_INIT)
++ { }
++#else
++// In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support
++// extended initializer list as above */
++ {
++ pthread_once_t once_2 = PTHREAD_ONCE_INIT;
++ once_ = once_2;
++ }
++#endif
+
+ // Return a pointer to the pthread_once_t variable.
+ pthread_once_t*
+--
+2.1.3
+
diff --git a/patches/binutils/2.27/500-sysroot.patch b/patches/binutils/2.27/500-sysroot.patch
new file mode 100644
index 0000000..4cb9bc7
--- /dev/null
+++ b/patches/binutils/2.27/500-sysroot.patch
@@ -0,0 +1,37 @@
+Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
+
+Always try to prepend the sysroot prefix to absolute filenames first.
+
+http://bugs.gentoo.org/275666
+http://sourceware.org/bugzilla/show_bug.cgi?id=10340
+
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -336,18 +336,25 @@
+ directory first. */
+ if (!entry->flags.maybe_archive)
+ {
+- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
++ /* For absolute pathnames, try to always open the file in the
++ sysroot first. If this fails, try to open the file at the
++ given location. */
++ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
++ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
++ && ld_sysroot)
+ {
+ char *name = concat (ld_sysroot, entry->filename,
+ (const char *) NULL);
+ if (ldfile_try_open_bfd (name, entry))
+ {
+ entry->filename = name;
++ entry->flags.sysrooted = TRUE;
+ return TRUE;
+ }
+ free (name);
+ }
+- else if (ldfile_try_open_bfd (entry->filename, entry))
++
++ if (ldfile_try_open_bfd (entry->filename, entry))
+ return TRUE;
+
+ if (IS_ABSOLUTE_PATH (entry->filename))
diff --git a/patches/binutils/2.27/600-poison-system-directories.patch b/patches/binutils/2.27/600-poison-system-directories.patch
new file mode 100644
index 0000000..ff235e3
--- /dev/null
+++ b/patches/binutils/2.27/600-poison-system-directories.patch
@@ -0,0 +1,285 @@
+Patch adapted to binutils 2.23.2 and extended to use
+BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
+
+[Gustavo: adapt to binutils 2.25]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+
+Patch originally created by Mark Hatle, forward-ported to
+binutils 2.21 by Scott Garman.
+
+purpose: warn for uses of system directories when cross linking
+
+Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
+
+2008-07-02 Joseph Myers <joseph@codesourcery.com>
+
+ ld/
+ * ld.h (args_type): Add error_poison_system_directories.
+ * ld.texinfo (--error-poison-system-directories): Document.
+ * ldfile.c (ldfile_add_library_path): Check
+ command_line.error_poison_system_directories.
+ * ldmain.c (main): Initialize
+ command_line.error_poison_system_directories.
+ * lexsup.c (enum option_values): Add
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
+ (ld_options): Add --error-poison-system-directories.
+ (parse_args): Handle new option.
+
+2007-06-13 Joseph Myers <joseph@codesourcery.com>
+
+ ld/
+ * config.in: Regenerate.
+ * ld.h (args_type): Add poison_system_directories.
+ * ld.texinfo (--no-poison-system-directories): Document.
+ * ldfile.c (ldfile_add_library_path): Check
+ command_line.poison_system_directories.
+ * ldmain.c (main): Initialize
+ command_line.poison_system_directories.
+ * lexsup.c (enum option_values): Add
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES.
+ (ld_options): Add --no-poison-system-directories.
+ (parse_args): Handle new option.
+
+2007-04-20 Joseph Myers <joseph@codesourcery.com>
+
+ Merge from Sourcery G++ binutils 2.17:
+
+ 2007-03-20 Joseph Myers <joseph@codesourcery.com>
+ Based on patch by Mark Hatle <mark.hatle@windriver.com>.
+ ld/
+ * configure.ac (--enable-poison-system-directories): New option.
+ * configure, config.in: Regenerate.
+ * ldfile.c (ldfile_add_library_path): If
+ ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
+ /usr/lib, /usr/local/lib or /usr/X11R6/lib.
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+
+diff --git a/ld/config.in b/ld/config.in
+index 276fb77..35c58eb 100644
+--- a/ld/config.in
++++ b/ld/config.in
+@@ -17,6 +17,9 @@
+ language is requested. */
+ #undef ENABLE_NLS
+
++/* Define to warn for use of native system library directories */
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++
+ /* Additional extension a shared object might have. */
+ #undef EXTRA_SHLIB_EXTENSION
+
+diff --git a/ld/configure b/ld/configure
+index a446283..d1f9504 100755
+--- a/ld/configure
++++ b/ld/configure
+@@ -788,6 +788,7 @@ with_lib_path
+ enable_targets
+ enable_64_bit_bfd
+ with_sysroot
++enable_poison_system_directories
+ enable_gold
+ enable_got
+ enable_compressed_debug_sections
+@@ -1445,6 +1446,8 @@ Optional Features:
+ --disable-largefile omit support for large files
+ --enable-targets alternative target configurations
+ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
++ --enable-poison-system-directories
++ warn for use of native system library directories
+ --enable-gold[=ARG] build gold [ARG={default,yes,no}]
+ --enable-got=<type> GOT handling scheme (target, single, negative,
+ multigot)
+@@ -15498,7 +15501,18 @@ else
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
+
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
+
+ # Check whether --enable-got was given.
+ if test "${enable_got+set}" = set; then :
+diff --git a/ld/configure.ac b/ld/configure.ac
+index 188172d..2cd8443 100644
+--- a/ld/configure.ac
++++ b/ld/configure.ac
+@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
+ AC_SUBST(TARGET_SYSTEM_ROOT)
+ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system library directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system library directories])
++fi
++
+ dnl Use --enable-gold to decide if this linker should be the default.
+ dnl "install_as_default" is set to false if gold is the default linker.
+ dnl "installed_linker" is the installed BFD linker name.
+diff --git a/ld/ld.h b/ld/ld.h
+index d84ec4e..3476b26 100644
+--- a/ld/ld.h
++++ b/ld/ld.h
+@@ -169,6 +169,14 @@ typedef struct {
+ /* If set, display the target memory usage (per memory region). */
+ bfd_boolean print_memory_usage;
+
++ /* If TRUE (the default) warn for uses of system directories when
++ cross linking. */
++ bfd_boolean poison_system_directories;
++
++ /* If TRUE (default FALSE) give an error for uses of system
++ directories when cross linking instead of a warning. */
++ bfd_boolean error_poison_system_directories;
++
+ /* Big or little endian as set on command line. */
+ enum endian_enum endian;
+
+diff --git a/ld/ld.texinfo b/ld/ld.texinfo
+index 1dd7492..fb1438e 100644
+--- a/ld/ld.texinfo
++++ b/ld/ld.texinfo
+@@ -2357,6 +2357,18 @@ string identifying the original linked file does not change.
+
+ Passing @code{none} for @var{style} disables the setting from any
+ @code{--build-id} options earlier on the command line.
++
++@kindex --no-poison-system-directories
++@item --no-poison-system-directories
++Do not warn for @option{-L} options using system directories such as
++@file{/usr/lib} when cross linking. This option is intended for use
++in chroot environments when such directories contain the correct
++libraries for the target system rather than the host.
++
++@kindex --error-poison-system-directories
++@item --error-poison-system-directories
++Give an error instead of a warning for @option{-L} options using
++system directories when cross linking.
+ @end table
+
+ @c man end
+diff --git a/ld/ldfile.c b/ld/ldfile.c
+index 96f9ecc..af231c0 100644
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -114,6 +114,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
+ new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
+ else
+ new_dirs->name = xstrdup (name);
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (command_line.poison_system_directories
++ && ((!strncmp (name, "/lib", 4))
++ || (!strncmp (name, "/usr/lib", 8))
++ || (!strncmp (name, "/usr/local/lib", 14))
++ || (!strncmp (name, "/usr/X11R6/lib", 14))))
++ {
++ if (command_line.error_poison_system_directories)
++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
++ "cross-compilation\n"), name);
++ else
++ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
++ "cross-compilation\n"), name);
++ }
++#endif
++
+ }
+
+ /* Try to open a BFD for a lang_input_statement. */
+diff --git a/ld/ldlex.h b/ld/ldlex.h
+index 6f11e7b..0ca3110 100644
+--- a/ld/ldlex.h
++++ b/ld/ldlex.h
+@@ -144,6 +144,8 @@ enum option_values
+ OPTION_PRINT_MEMORY_USAGE,
+ OPTION_REQUIRE_DEFINED_SYMBOL,
+ OPTION_ORPHAN_HANDLING,
++ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
+ };
+
+ /* The initial parser states. */
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index bb0b9cc..a23c56c 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -257,6 +257,8 @@ main (int argc, char **argv)
+ command_line.warn_mismatch = TRUE;
+ command_line.warn_search_mismatch = TRUE;
+ command_line.check_section_addresses = -1;
++ command_line.poison_system_directories = TRUE;
++ command_line.error_poison_system_directories = FALSE;
+
+ /* We initialize DEMANGLING based on the environment variable
+ COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
+diff --git a/ld/lexsup.c b/ld/lexsup.c
+index 4cad209..be7d584 100644
+--- a/ld/lexsup.c
++++ b/ld/lexsup.c
+@@ -530,6 +530,14 @@ static const struct ld_option ld_options[] =
+ { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
+ '\0', N_("=MODE"), N_("Control how orphan sections are handled."),
+ TWO_DASHES },
++ { {"no-poison-system-directories", no_argument, NULL,
++ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
++ '\0', NULL, N_("Do not warn for -L options using system directories"),
++ TWO_DASHES },
++ { {"error-poison-system-directories", no_argument, NULL,
++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
++ '\0', NULL, N_("Give an error for -L options using system directories"),
++ TWO_DASHES },
+ };
+
+ #define OPTION_COUNT ARRAY_SIZE (ld_options)
+@@ -542,6 +550,7 @@ parse_args (unsigned argc, char **argv)
+ int ingroup = 0;
+ char *default_dirlist = NULL;
+ char *shortopts;
++ char *BR_paranoid_env;
+ struct option *longopts;
+ struct option *really_longopts;
+ int last_optind;
+@@ -1516,6 +1525,14 @@ parse_args (unsigned argc, char **argv)
+ }
+ break;
+
++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
++ command_line.poison_system_directories = FALSE;
++ break;
++
++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
++ command_line.error_poison_system_directories = TRUE;
++ break;
++
+ case OPTION_PUSH_STATE:
+ input_flags.pushed = xmemdup (&input_flags,
+ sizeof (input_flags),
+@@ -1559,6 +1576,10 @@ parse_args (unsigned argc, char **argv)
+ command_line.soname = NULL;
+ }
+
++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
++ command_line.error_poison_system_directories = TRUE;
++
+ while (ingroup)
+ {
+ lang_leave_group ();
diff --git a/patches/binutils/2.27/999-xtensa-reverse-shift-count.patch b/patches/binutils/2.27/999-xtensa-reverse-shift-count.patch
new file mode 100644
index 0000000..f8bb9c1
--- /dev/null
+++ b/patches/binutils/2.27/999-xtensa-reverse-shift-count.patch
@@ -0,0 +1,33 @@
+From 78fb7e37eb8bb08ae537d6c487996ff17c810332 Mon Sep 17 00:00:00 2001
+From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+Date: Mon, 26 Sep 2016 12:42:11 -0400
+Subject: [PATCH] tc-xtensa.c: fixup xg_reverse_shift_count typo
+
+gas/ChangeLog:
+
+2016-09-26 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
+ * config/tc-xtensa.c (xg_reverse_shift_count): Pass cnt_arg instead of
+ cnt_argp to concat.
+---
+ gas/ChangeLog | 5 +++++
+ gas/config/tc-xtensa.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+[[ ChangeLog skipped, fails to apply on 2.27 ]]
+diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
+index d062044..ca261ae 100644
+--- a/gas/config/tc-xtensa.c
++++ b/gas/config/tc-xtensa.c
+@@ -2228,7 +2228,7 @@ xg_reverse_shift_count (char **cnt_argp)
+ cnt_arg = *cnt_argp;
+
+ /* replace the argument with "31-(argument)" */
+- new_arg = concat ("31-(", cnt_argp, ")", (char *) NULL);
++ new_arg = concat ("31-(", cnt_arg, ")", (char *) NULL);
+
+ free (cnt_arg);
+ *cnt_argp = new_arg;
+--
+2.9.3
+
diff --git a/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch b/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch
new file mode 100644
index 0000000..525592e
--- /dev/null
+++ b/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch
@@ -0,0 +1,14 @@
+--- gcc-4.9.4/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800
++++ gcc-4.9.4/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800
+@@ -36,6 +36,11 @@
+ for arg
+ do
+ case $arg in
++ -framework)
++ # libtool handles this option. It should not be prefixed with
++ # -Xcompiler, as that would split it from the argument that
++ # follows.
++ ;;
+ -f*|--*)
+ # Libtool does not ascribe any special meaning options
+ # that begin with -f or with a double-dash. So, it will
diff --git a/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch b/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch
new file mode 100644
index 0000000..525592e
--- /dev/null
+++ b/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch
@@ -0,0 +1,14 @@
+--- gcc-4.9.4/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800
++++ gcc-4.9.4/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800
+@@ -36,6 +36,11 @@
+ for arg
+ do
+ case $arg in
++ -framework)
++ # libtool handles this option. It should not be prefixed with
++ # -Xcompiler, as that would split it from the argument that
++ # follows.
++ ;;
+ -f*|--*)
+ # Libtool does not ascribe any special meaning options
+ # that begin with -f or with a double-dash. So, it will
diff --git a/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch b/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch
new file mode 100644
index 0000000..0f4912a
--- /dev/null
+++ b/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch
@@ -0,0 +1,14 @@
+--- gcc-5.4.0/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800
++++ gcc-5.4.0/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800
+@@ -36,6 +36,11 @@
+ for arg
+ do
+ case $arg in
++ -framework)
++ # libtool handles this option. It should not be prefixed with
++ # -Xcompiler, as that would split it from the argument that
++ # follows.
++ ;;
+ -f*|--*|-static-lib*|-shared-lib*|-B*)
+ # Libtool does not ascribe any special meaning options
+ # that begin with -f or with a double-dash. So, it will
diff --git a/patches/gcc/6.2.0/100-uclibc-conf.patch b/patches/gcc/6.3.0/100-uclibc-conf.patch
index 73d1f0d..73d1f0d 100644
--- a/patches/gcc/6.2.0/100-uclibc-conf.patch
+++ b/patches/gcc/6.3.0/100-uclibc-conf.patch
diff --git a/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch b/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch
new file mode 100644
index 0000000..bce09eb
--- /dev/null
+++ b/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch
@@ -0,0 +1,14 @@
+--- gcc-6.2.0/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800
++++ gcc-6.2.0/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800
+@@ -36,6 +36,11 @@
+ for arg
+ do
+ case $arg in
++ -framework)
++ # libtool handles this option. It should not be prefixed with
++ # -Xcompiler, as that would split it from the argument that
++ # follows.
++ ;;
+ -f*|--*|-static-lib*|-shared-lib*|-B*)
+ # Libtool does not ascribe any special meaning options
+ # that begin with -f or with a double-dash. So, it will
diff --git a/patches/gcc/6.2.0/301-missing-execinfo_h.patch b/patches/gcc/6.3.0/301-missing-execinfo_h.patch
index 2d0e7ba..2d0e7ba 100644
--- a/patches/gcc/6.2.0/301-missing-execinfo_h.patch
+++ b/patches/gcc/6.3.0/301-missing-execinfo_h.patch
diff --git a/patches/gcc/6.2.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch b/patches/gcc/6.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
index d8986d5..d8986d5 100644
--- a/patches/gcc/6.2.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
+++ b/patches/gcc/6.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
diff --git a/patches/gcc/6.2.0/380-gcc-plugin-POSIX-include-sys-select-h.patch b/patches/gcc/6.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
index 12ef48e..12ef48e 100644
--- a/patches/gcc/6.2.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
+++ b/patches/gcc/6.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
diff --git a/patches/gcc/6.2.0/810-arm-softfloat-libgcc.patch b/patches/gcc/6.3.0/810-arm-softfloat-libgcc.patch
index 5efa7fd..5efa7fd 100644
--- a/patches/gcc/6.2.0/810-arm-softfloat-libgcc.patch
+++ b/patches/gcc/6.3.0/810-arm-softfloat-libgcc.patch
diff --git a/patches/gcc/6.2.0/830-arm_unbreak_armv4t.patch b/patches/gcc/6.3.0/830-arm_unbreak_armv4t.patch
index b730059..b730059 100644
--- a/patches/gcc/6.2.0/830-arm_unbreak_armv4t.patch
+++ b/patches/gcc/6.3.0/830-arm_unbreak_armv4t.patch
diff --git a/patches/gcc/6.2.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch b/patches/gcc/6.3.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch
index af9fb1d..af9fb1d 100644
--- a/patches/gcc/6.2.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch
+++ b/patches/gcc/6.3.0/831-ARM-PR-target-70473-Reduce-size-of-Cortex-A8-automat.patch
diff --git a/patches/gcc/6.2.0/860-cilk-wchar.patch b/patches/gcc/6.3.0/860-cilk-wchar.patch
index 1d9916f..1d9916f 100644
--- a/patches/gcc/6.2.0/860-cilk-wchar.patch
+++ b/patches/gcc/6.3.0/860-cilk-wchar.patch
diff --git a/patches/gcc/6.2.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch b/patches/gcc/6.3.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch
index 6e0ce6e..6e0ce6e 100644
--- a/patches/gcc/6.2.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch
+++ b/patches/gcc/6.3.0/870-xtensa-don-t-use-unwind-dw2-fde-dip-with-elf-targets.patch
diff --git a/patches/gcc/6.2.0/871-xtensa-Fix-PR-target-78118.patch b/patches/gcc/6.3.0/871-xtensa-Fix-PR-target-78118.patch
index c6ae103..c6ae103 100644
--- a/patches/gcc/6.2.0/871-xtensa-Fix-PR-target-78118.patch
+++ b/patches/gcc/6.3.0/871-xtensa-Fix-PR-target-78118.patch
diff --git a/patches/gcc/6.2.0/872-xtensa-Fix-PR-target-78603.patch b/patches/gcc/6.3.0/872-xtensa-Fix-PR-target-78603.patch
index 669097c..669097c 100644
--- a/patches/gcc/6.2.0/872-xtensa-Fix-PR-target-78603.patch
+++ b/patches/gcc/6.3.0/872-xtensa-Fix-PR-target-78603.patch
diff --git a/patches/gcc/6.2.0/890-fix-m68k-compile.patch b/patches/gcc/6.3.0/890-fix-m68k-compile.patch
index 6e63de0..6e63de0 100644
--- a/patches/gcc/6.2.0/890-fix-m68k-compile.patch
+++ b/patches/gcc/6.3.0/890-fix-m68k-compile.patch
diff --git a/patches/gcc/6.2.0/891-fix-m68k-uclinux.patch b/patches/gcc/6.3.0/891-fix-m68k-uclinux.patch
index 4e186bd..4e186bd 100644
--- a/patches/gcc/6.2.0/891-fix-m68k-uclinux.patch
+++ b/patches/gcc/6.3.0/891-fix-m68k-uclinux.patch
diff --git a/patches/gcc/6.2.0/892-libgcc-mkmap-symver-support-skip_underscore.patch b/patches/gcc/6.3.0/892-libgcc-mkmap-symver-support-skip_underscore.patch
index 73ee6c5..73ee6c5 100644
--- a/patches/gcc/6.2.0/892-libgcc-mkmap-symver-support-skip_underscore.patch
+++ b/patches/gcc/6.3.0/892-libgcc-mkmap-symver-support-skip_underscore.patch
diff --git a/patches/gcc/6.2.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch b/patches/gcc/6.3.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch
index 454295d..454295d 100644
--- a/patches/gcc/6.2.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch
+++ b/patches/gcc/6.3.0/893-libgcc-config-bfin-use-the-generic-linker-version-in.patch
diff --git a/patches/gcc/6.2.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch b/patches/gcc/6.3.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch
index ce49de7..ce49de7 100644
--- a/patches/gcc/6.2.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch
+++ b/patches/gcc/6.3.0/894-libgcc-fix-DWARF-compilation-with-FDPIC-targets.patch
diff --git a/patches/gcc/6.2.0/895-bfin-define-REENTRANT.patch b/patches/gcc/6.3.0/895-bfin-define-REENTRANT.patch
index e2828a5..e2828a5 100644
--- a/patches/gcc/6.2.0/895-bfin-define-REENTRANT.patch
+++ b/patches/gcc/6.3.0/895-bfin-define-REENTRANT.patch
diff --git a/patches/gcc/6.2.0/910-nios2-bad-multilib-default.patch b/patches/gcc/6.3.0/910-nios2-bad-multilib-default.patch
index 61989e5..61989e5 100644
--- a/patches/gcc/6.2.0/910-nios2-bad-multilib-default.patch
+++ b/patches/gcc/6.3.0/910-nios2-bad-multilib-default.patch
diff --git a/patches/gcc/6.2.0/930-libgcc-disable-split-stack-nothreads.patch b/patches/gcc/6.3.0/930-libgcc-disable-split-stack-nothreads.patch
index 07f9a73..07f9a73 100644
--- a/patches/gcc/6.2.0/930-libgcc-disable-split-stack-nothreads.patch
+++ b/patches/gcc/6.3.0/930-libgcc-disable-split-stack-nothreads.patch
diff --git a/patches/gcc/6.2.0/940-uclinux-enable-threads.patch b/patches/gcc/6.3.0/940-uclinux-enable-threads.patch
index 490a55b..490a55b 100644
--- a/patches/gcc/6.2.0/940-uclinux-enable-threads.patch
+++ b/patches/gcc/6.3.0/940-uclinux-enable-threads.patch
diff --git a/patches/gdb/7.12/100-musl_fix.patch b/patches/gdb/7.12/100-musl_fix.patch
new file mode 100644
index 0000000..c0c1e0a
--- /dev/null
+++ b/patches/gdb/7.12/100-musl_fix.patch
@@ -0,0 +1,28 @@
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
+@@ -17,6 +17,7 @@
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
++#include "stopcode.h"
+ #include "defs.h"
+ #include "inferior.h"
+ #include "infrun.h"
+@@ -73,6 +74,10 @@
+ #define SPUFS_MAGIC 0x23c9b64e
+ #endif
+
++#ifndef __SIGRTMIN
++#define __SIGRTMIN SIGRTMIN
++#endif
++
+ /* This comment documents high-level logic of this file.
+
+ Waiting for events in sync mode
+--- /dev/null
++++ b/gdb/stopcode.h
+@@ -0,0 +1,4 @@
++#ifndef W_STOPCODE
++#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
++#endif
++
diff --git a/patches/gdb/7.12/101-uclibc-no-gettimeofday-clobber.patch b/patches/gdb/7.12/101-uclibc-no-gettimeofday-clobber.patch
new file mode 100644
index 0000000..cd7a4c6
--- /dev/null
+++ b/patches/gdb/7.12/101-uclibc-no-gettimeofday-clobber.patch
@@ -0,0 +1,30 @@
+Improve gnulib in gdb's guess work, gettimeofday() works in uClibcm promise.
+
+This patch helps building x86_64-unknown-linux-uclibc toolchains, the final
+gdb-native step otherwise fails when linking the libinproctrace.so
+
+Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
+Signed-off-by: Alexey Neyman <stilor@att.net>
+
+diff -urpN gdb-7.12.orig/gdb/gnulib/configure gdb-7.12/gdb/gnulib/configure
+--- gdb-7.12.orig/gdb/gnulib/configure 2017-01-13 13:42:11.773027566 -0800
++++ gdb-7.12/gdb/gnulib/configure 2017-01-13 13:44:32.518082618 -0800
+@@ -13522,6 +13522,7 @@ else
+ case "$host_os" in
+ # Guess all is fine on glibc systems.
+ *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++ *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+ esac
+diff -urpN gdb-7.12.orig/gdb/gnulib/import/m4/gettimeofday.m4 gdb-7.12/gdb/gnulib/import/m4/gettimeofday.m4
+--- gdb-7.12.orig/gdb/gnulib/import/m4/gettimeofday.m4 2017-01-13 13:42:11.777027595 -0800
++++ gdb-7.12/gdb/gnulib/import/m4/gettimeofday.m4 2017-01-13 13:43:55.781797640 -0800
+@@ -111,6 +111,7 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
+ case "$host_os" in
+ # Guess all is fine on glibc systems.
+ *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++ *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+ esac
diff --git a/patches/gdb/7.12/111-xtensa-make-sure-ar_base-is-initialized.patch b/patches/gdb/7.12/111-xtensa-make-sure-ar_base-is-initialized.patch
new file mode 100644
index 0000000..982bd7f
--- /dev/null
+++ b/patches/gdb/7.12/111-xtensa-make-sure-ar_base-is-initialized.patch
@@ -0,0 +1,35 @@
+From 208ea73d38c9c16cf983b6419f58050dbadcb6a9 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 7 Jun 2015 22:43:49 +0300
+Subject: [PATCH 2/2] xtensa: make sure ar_base is initialized
+
+ar_base is uninitialized for cores w/o windowed registers as their
+regmap doesn't have register 0x0100.
+Check that ar_base is initialized and if not initialize it with a0_base.
+
+gdb/
+ * xtensa-tdep.c (xtensa_derive_tdep): Make sure ar_base is
+ initialized.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ gdb/xtensa-tdep.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
+index 55e7d98..41f5ec1 100644
+--- a/gdb/xtensa-tdep.c
++++ b/gdb/xtensa-tdep.c
+@@ -3175,6 +3175,9 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
+ tdep->num_regs = n;
+ }
+
++ if (tdep->ar_base == -1)
++ tdep->ar_base = tdep->a0_base;
++
+ /* Number of pseudo registers. */
+ tdep->num_pseudo_regs = n - tdep->num_regs;
+
+--
+1.8.1.4
+
diff --git a/patches/gdb/7.12/112-WIP-end-of-prologue-detection-hack.patch b/patches/gdb/7.12/112-WIP-end-of-prologue-detection-hack.patch
new file mode 100644
index 0000000..506a57c
--- /dev/null
+++ b/patches/gdb/7.12/112-WIP-end-of-prologue-detection-hack.patch
@@ -0,0 +1,31 @@
+From 7f8eacbb468575fb67db7fd1155a3aedaa91911b Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 7 Jun 2015 23:15:39 +0300
+Subject: [PATCH] WIP: *end of prologue* detection hack
+
+see
+ http://www.esp8266.com/viewtopic.php?p=18461#p18461
+ http://www.esp8266.com/viewtopic.php?p=19026#p19026
+ http://www.esp8266.com/viewtopic.php?p=19683#p19683
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ gdb/xtensa-tdep.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
+index 41f5ec1..6a7dba7 100644
+--- a/gdb/xtensa-tdep.c
++++ b/gdb/xtensa-tdep.c
+@@ -2410,7 +2410,7 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
+ /* Find out, if we have an information about the prologue from DWARF. */
+ prologue_sal = find_pc_line (start, 0);
+ if (prologue_sal.line != 0) /* Found debug info. */
+- body_pc = prologue_sal.end;
++ body_pc = prologue_sal.end + 40;
+
+ /* If we are going to analyze the prologue in general without knowing about
+ the current PC, make the best assumtion for the end of the prologue. */
+--
+1.8.1.4
+
diff --git a/patches/musl/1.0.4/0001-max_align_t.patch b/patches/musl/1.0.4/0001-max_align_t.patch
deleted file mode 100644
index 766f667..0000000
--- a/patches/musl/1.0.4/0001-max_align_t.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-From 321f4fa9067185aa6bb47403dfba46e8cfe917d3 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Wed, 20 Aug 2014 21:20:14 +0000
-Subject: add max_align_t definition for C11 and C++11
-
-unfortunately this needs to be able to vary by arch, because of a huge
-mess GCC made: the GCC definition, which became the ABI, depends on
-quirks in GCC's definition of __alignof__, which does not match the
-formal alignment of the type.
-
-GCC's __alignof__ unexpectedly exposes the an implementation detail,
-its "preferred alignment" for the type, rather than the formal/ABI
-alignment of the type, which it only actually uses in structures. on
-most archs the two values are the same, but on some (at least i386)
-the preferred alignment is greater than the ABI alignment.
-
-I considered using _Alignas(8) unconditionally, but on at least one
-arch (or1k), the alignment of max_align_t with GCC's definition is
-only 4 (even the "preferred alignment" for these types is only 4).
-
-[bryanhundven@gmail.com: remove the or1k hunk]
-[yann.morin.1998@free.fr: add the commit log]
-diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
-index bd23a6a..3482874 100644
---- a/arch/arm/bits/alltypes.h.in
-+++ b/arch/arm/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
-index efd2c07..8a62c80 100644
---- a/arch/i386/bits/alltypes.h.in
-+++ b/arch/i386/bits/alltypes.h.in
-@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
- TYPEDEF long double double_t;
- #endif
-
-+TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long time_t;
- TYPEDEF long suseconds_t;
-
-diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
-index 6bd7942..27006b0 100644
---- a/arch/microblaze/bits/alltypes.h.in
-+++ b/arch/microblaze/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
-index 6bd7942..27006b0 100644
---- a/arch/mips/bits/alltypes.h.in
-+++ b/arch/mips/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
-index e9d8dd8..040157e 100644
---- a/arch/powerpc/bits/alltypes.h.in
-+++ b/arch/powerpc/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
-index e9d8dd8..040157e 100644
---- a/arch/sh/bits/alltypes.h.in
-+++ b/arch/sh/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
-index b077fc9..c98a3d7 100644
---- a/arch/x32/bits/alltypes.h.in
-+++ b/arch/x32/bits/alltypes.h.in
-@@ -18,6 +18,8 @@ TYPEDEF float float_t;
- TYPEDEF double double_t;
- #endif
-
-+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long long time_t;
- TYPEDEF long long suseconds_t;
-
-diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
-index 277e944..c4898c7 100644
---- a/arch/x86_64/bits/alltypes.h.in
-+++ b/arch/x86_64/bits/alltypes.h.in
-@@ -18,6 +18,8 @@ TYPEDEF float float_t;
- TYPEDEF double double_t;
- #endif
-
-+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long time_t;
- TYPEDEF long suseconds_t;
-
-diff --git a/include/stddef.h b/include/stddef.h
-index 0a32919..bd75385 100644
---- a/include/stddef.h
-+++ b/include/stddef.h
-@@ -10,6 +10,9 @@
- #define __NEED_ptrdiff_t
- #define __NEED_size_t
- #define __NEED_wchar_t
-+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
-+#define __NEED_max_align_t
-+#endif
-
- #include <bits/alltypes.h>
-
diff --git a/patches/musl/1.1.4/0001-max_align_t.patch b/patches/musl/1.1.4/0001-max_align_t.patch
deleted file mode 100644
index 6423337..0000000
--- a/patches/musl/1.1.4/0001-max_align_t.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From 321f4fa9067185aa6bb47403dfba46e8cfe917d3 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Wed, 20 Aug 2014 21:20:14 +0000
-Subject: add max_align_t definition for C11 and C++11
-
-unfortunately this needs to be able to vary by arch, because of a huge
-mess GCC made: the GCC definition, which became the ABI, depends on
-quirks in GCC's definition of __alignof__, which does not match the
-formal alignment of the type.
-
-GCC's __alignof__ unexpectedly exposes the an implementation detail,
-its "preferred alignment" for the type, rather than the formal/ABI
-alignment of the type, which it only actually uses in structures. on
-most archs the two values are the same, but on some (at least i386)
-the preferred alignment is greater than the ABI alignment.
-
-I considered using _Alignas(8) unconditionally, but on at least one
-arch (or1k), the alignment of max_align_t with GCC's definition is
-only 4 (even the "preferred alignment" for these types is only 4).
----
-diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
-index 0d750cc..183c4c4 100644
---- a/arch/arm/bits/alltypes.h.in
-+++ b/arch/arm/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
-index 502c882..8ba8f6f 100644
---- a/arch/i386/bits/alltypes.h.in
-+++ b/arch/i386/bits/alltypes.h.in
-@@ -27,6 +27,8 @@ TYPEDEF long double float_t;
- TYPEDEF long double double_t;
- #endif
-
-+TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long time_t;
- TYPEDEF long suseconds_t;
-
-diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in
-index 4657d14..a03e1b8 100644
---- a/arch/microblaze/bits/alltypes.h.in
-+++ b/arch/microblaze/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
-index 4657d14..a03e1b8 100644
---- a/arch/mips/bits/alltypes.h.in
-+++ b/arch/mips/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/or1k/bits/alltypes.h.in b/arch/or1k/bits/alltypes.h.in
-index 0d750cc..183c4c4 100644
---- a/arch/or1k/bits/alltypes.h.in
-+++ b/arch/or1k/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in
-index 378124c..ee7f137 100644
---- a/arch/powerpc/bits/alltypes.h.in
-+++ b/arch/powerpc/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in
-index 378124c..ee7f137 100644
---- a/arch/sh/bits/alltypes.h.in
-+++ b/arch/sh/bits/alltypes.h.in
-@@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
- 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;
-
-diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
-index 8930efa..8e396c9 100644
---- a/arch/x32/bits/alltypes.h.in
-+++ b/arch/x32/bits/alltypes.h.in
-@@ -18,6 +18,8 @@ TYPEDEF float float_t;
- TYPEDEF double double_t;
- #endif
-
-+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long long time_t;
- TYPEDEF long long suseconds_t;
-
-diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in
-index 34b7d6a..7b4f3e7 100644
---- a/arch/x86_64/bits/alltypes.h.in
-+++ b/arch/x86_64/bits/alltypes.h.in
-@@ -18,6 +18,8 @@ TYPEDEF float float_t;
- TYPEDEF double double_t;
- #endif
-
-+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-+
- TYPEDEF long time_t;
- TYPEDEF long suseconds_t;
-
-diff --git a/include/stddef.h b/include/stddef.h
-index 0a32919..bd75385 100644
---- a/include/stddef.h
-+++ b/include/stddef.h
-@@ -10,6 +10,9 @@
- #define __NEED_ptrdiff_t
- #define __NEED_size_t
- #define __NEED_wchar_t
-+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
-+#define __NEED_max_align_t
-+#endif
-
- #include <bits/alltypes.h>
-
---
-cgit v0.9.0.3-65-g4555
diff --git a/patches/strace/4.10/007_fix_bexecve64_test.patch b/patches/strace/4.10/007_fix_bexecve64_test.patch
index 09cd8ad..6dc9b46 100644
--- a/patches/strace/4.10/007_fix_bexecve64_test.patch
+++ b/patches/strace/4.10/007_fix_bexecve64_test.patch
@@ -1,3 +1,5 @@
+commit b704e8fbb4d9cf90ac56f3c889de5b779c444db4
+(loosely based on)
--- a/tests/bexecve.test
+++ b/tests/bexecve.test
@@ -24,13 +24,14 @@
diff --git a/patches/strace/4.10/008_decode_mips_indirect_syscall.patch b/patches/strace/4.10/008_decode_mips_indirect_syscall.patch
index de0004c..d2d7217 100644
--- a/patches/strace/4.10/008_decode_mips_indirect_syscall.patch
+++ b/patches/strace/4.10/008_decode_mips_indirect_syscall.patch
@@ -1,3 +1,4 @@
+commit f34b97f89dd3893ef3652a6899487771402fc13c
Index: strace-4.10/linux/mips/syscallent-o32.h
===================================================================
--- strace-4.10.orig/linux/mips/syscallent-o32.h
diff --git a/patches/strace/4.10/009-upstream-musl_includes.patch b/patches/strace/4.10/009-upstream-musl_includes.patch
index a35d7fd..c68f8d8 100644
--- a/patches/strace/4.10/009-upstream-musl_includes.patch
+++ b/patches/strace/4.10/009-upstream-musl_includes.patch
@@ -1,3 +1,5 @@
+commit 3460dc486d333231998de0f19918204aacee9ae3
+commit d34e00b293942b1012ddc49ed3ab379a32337611
--- a/evdev.c
+++ b/evdev.c
@@ -28,6 +28,8 @@
diff --git a/patches/strace/4.10/010-use-host-ioctl.patch b/patches/strace/4.10/010-use-host-ioctl.patch
new file mode 100644
index 0000000..e9c34d3
--- /dev/null
+++ b/patches/strace/4.10/010-use-host-ioctl.patch
@@ -0,0 +1,142 @@
+diff -urpN strace-4.10.orig/ioctl_iocdef.c strace-4.10/ioctl_iocdef.c
+--- strace-4.10.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.10/ioctl_iocdef.c 2017-01-14 15:05:49.505335680 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.10.orig/ioctlsort.c strace-4.10/ioctlsort.c
+--- strace-4.10.orig/ioctlsort.c 2015-02-15 18:35:58.000000000 -0800
++++ strace-4.10/ioctlsort.c 2017-01-14 15:20:30.597371979 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.10.orig/Makefile.am strace-4.10/Makefile.am
+--- strace-4.10.orig/Makefile.am 2015-03-05 18:19:01.000000000 -0800
++++ strace-4.10/Makefile.am 2017-01-14 15:07:28.978244260 -0800
+@@ -159,6 +159,7 @@ EXTRA_DIST = \
+ debian/strace64.manpages \
+ debian/watch \
+ errnoent.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/syscallent.h \
+@@ -416,15 +417,24 @@ ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFL
+ ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
+ ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
+ BUILT_SOURCES += $(ioctlent_h)
+-CLEANFILES = $(ioctlent_h)
++CLEANFILES = $(ioctlent_h) ioctl_iocdef.h
+
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+diff -urpN strace-4.10.orig/Makefile.in strace-4.10/Makefile.in
+--- strace-4.10.orig/Makefile.in 2015-03-06 07:16:46.000000000 -0800
++++ strace-4.10/Makefile.in 2017-01-14 15:23:06.718794409 -0800
+@@ -687,6 +687,7 @@ EXTRA_DIST = \
+ debian/strace64.manpages \
+ debian/watch \
+ errnoent.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/syscallent.h \
+@@ -921,7 +922,7 @@ ioctlsort_CFLAGS = $(AM_CFLAGS) $(CFLAGS
+ ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
+ ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
+ ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
+-CLEANFILES = $(ioctlent_h)
++CLEANFILES = $(ioctlent_h) ioctl_iocdef.h
+ @MAINTAINER_MODE_TRUE@gen_changelog_start_date = 2009-07-08 20:00
+ all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+@@ -3414,13 +3415,22 @@ news-check: NEWS
+ exit 1; \
+ fi
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/patches/strace/4.11/010-use-host-ioctl.patch b/patches/strace/4.11/010-use-host-ioctl.patch
new file mode 100644
index 0000000..5155200
--- /dev/null
+++ b/patches/strace/4.11/010-use-host-ioctl.patch
@@ -0,0 +1,144 @@
+diff -urpN strace-4.11.orig/ioctl_iocdef.c strace-4.11/ioctl_iocdef.c
+--- strace-4.11.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.11/ioctl_iocdef.c 2017-01-14 15:31:16.925139193 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.11.orig/ioctlsort.c strace-4.11/ioctlsort.c
+--- strace-4.11.orig/ioctlsort.c 2015-03-28 15:37:30.000000000 -0700
++++ strace-4.11/ioctlsort.c 2017-01-14 15:32:13.373831957 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.11.orig/Makefile.am strace-4.11/Makefile.am
+--- strace-4.11.orig/Makefile.am 2015-12-17 09:56:48.000000000 -0800
++++ strace-4.11/Makefile.am 2017-01-14 15:33:39.186837242 -0800
+@@ -239,6 +239,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -666,17 +667,26 @@ ioctlent_h = $(patsubst $(srcdir)/$(OS)/
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+ cat $^ > $@
+
+ BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+-CLEANFILES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
++CLEANFILES = $(ioctlent_h) ioctl_iocdef.h native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+
+ # defines mpers_source_files
+diff -urpN strace-4.11.orig/Makefile.in strace-4.11/Makefile.in
+--- strace-4.11.orig/Makefile.in 2015-12-21 15:24:05.000000000 -0800
++++ strace-4.11/Makefile.in 2017-01-14 15:34:34.803440359 -0800
+@@ -848,6 +848,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -1243,7 +1244,7 @@ ioctlent_h = $(patsubst $(srcdir)/$(OS)/
+ BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h .version \
+ $(am__append_7) $(am__append_11)
+-CLEANFILES = $(ioctlent_h) native_printer_decls.h \
++CLEANFILES = $(ioctlent_h) ioctl_iocdef.h native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h \
+ $(am__append_8) $(am__append_12)
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+@@ -4829,13 +4830,22 @@ news-check: NEWS
+ exit 1; \
+ fi
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/patches/strace/4.12/010-use-host-ioctl.patch b/patches/strace/4.12/010-use-host-ioctl.patch
new file mode 100644
index 0000000..bd5a40e
--- /dev/null
+++ b/patches/strace/4.12/010-use-host-ioctl.patch
@@ -0,0 +1,145 @@
+diff -urpN strace-4.12.orig/ioctl_iocdef.c strace-4.12/ioctl_iocdef.c
+--- strace-4.12.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.12/ioctl_iocdef.c 2017-01-14 15:35:21.055924401 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.12.orig/ioctlsort.c strace-4.12/ioctlsort.c
+--- strace-4.12.orig/ioctlsort.c 2015-03-28 15:37:30.000000000 -0700
++++ strace-4.12/ioctlsort.c 2017-01-14 15:35:21.055924401 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.12.orig/Makefile.am strace-4.12/Makefile.am
+--- strace-4.12.orig/Makefile.am 2016-05-28 03:29:30.000000000 -0700
++++ strace-4.12/Makefile.am 2017-01-14 15:36:46.916796883 -0800
+@@ -274,6 +274,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -712,10 +713,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+@@ -723,7 +733,7 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/i
+
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) ioctl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+
+diff -urpN strace-4.12.orig/Makefile.in strace-4.12/Makefile.in
+--- strace-4.12.orig/Makefile.in 2016-05-31 04:35:57.000000000 -0700
++++ strace-4.12/Makefile.in 2017-01-14 15:37:33.353259891 -0800
+@@ -952,6 +952,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -1351,7 +1352,7 @@ ioctl_redefs_h = $(filter-out ioctl_rede
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h .version \
+ $(am__append_7) $(am__append_11)
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) octl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h \
+ sys_func.h $(am__append_8) $(am__append_12)
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+@@ -5506,13 +5507,22 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ rm -f $<-t
+ mv $@-t $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/patches/strace/4.13/010-use-host-ioctl.patch b/patches/strace/4.13/010-use-host-ioctl.patch
new file mode 100644
index 0000000..40ebbf3
--- /dev/null
+++ b/patches/strace/4.13/010-use-host-ioctl.patch
@@ -0,0 +1,145 @@
+diff -urpN strace-4.13.orig/ioctl_iocdef.c strace-4.13/ioctl_iocdef.c
+--- strace-4.13.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.13/ioctl_iocdef.c 2017-01-14 15:50:14.368196376 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.13.orig/ioctlsort.c strace-4.13/ioctlsort.c
+--- strace-4.13.orig/ioctlsort.c 2015-03-28 15:37:30.000000000 -0700
++++ strace-4.13/ioctlsort.c 2017-01-14 15:50:14.368196376 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.13.orig/Makefile.am strace-4.13/Makefile.am
+--- strace-4.13.orig/Makefile.am 2016-07-22 12:28:06.000000000 -0700
++++ strace-4.13/Makefile.am 2017-01-14 15:50:14.368196376 -0800
+@@ -283,6 +283,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -721,10 +722,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+@@ -732,7 +742,7 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/i
+
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) ioctl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+
+diff -urpN strace-4.13.orig/Makefile.in strace-4.13/Makefile.in
+--- strace-4.13.orig/Makefile.in 2016-07-26 09:17:18.000000000 -0700
++++ strace-4.13/Makefile.in 2017-01-14 15:50:14.368196376 -0800
+@@ -978,6 +978,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -1377,7 +1378,7 @@ ioctl_redefs_h = $(filter-out ioctl_rede
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h .version \
+ $(am__append_7) $(am__append_11)
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) octl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h \
+ sys_func.h $(am__append_8) $(am__append_12)
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+@@ -5730,13 +5731,22 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ rm -f $<-t
+ mv $@-t $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/patches/strace/4.14/010-use-host-ioctl.patch b/patches/strace/4.14/010-use-host-ioctl.patch
new file mode 100644
index 0000000..2c7671f
--- /dev/null
+++ b/patches/strace/4.14/010-use-host-ioctl.patch
@@ -0,0 +1,145 @@
+diff -urpN strace-4.14.orig/ioctl_iocdef.c strace-4.14/ioctl_iocdef.c
+--- strace-4.14.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.14/ioctl_iocdef.c 2017-01-14 15:50:38.748425119 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.14.orig/ioctlsort.c strace-4.14/ioctlsort.c
+--- strace-4.14.orig/ioctlsort.c 2015-03-28 15:37:30.000000000 -0700
++++ strace-4.14/ioctlsort.c 2017-01-14 15:50:38.748425119 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.14.orig/Makefile.am strace-4.14/Makefile.am
+--- strace-4.14.orig/Makefile.am 2016-09-05 12:52:57.000000000 -0700
++++ strace-4.14/Makefile.am 2017-01-14 15:50:38.748425119 -0800
+@@ -289,6 +289,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -739,10 +740,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+@@ -750,7 +760,7 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/i
+
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) ioctl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+
+diff -urpN strace-4.14.orig/Makefile.in strace-4.14/Makefile.in
+--- strace-4.14.orig/Makefile.in 2016-10-04 12:13:20.000000000 -0700
++++ strace-4.14/Makefile.in 2017-01-14 15:50:38.752425155 -0800
+@@ -995,6 +995,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align32.h \
+@@ -1406,7 +1407,7 @@ ioctl_redefs_h = $(filter-out ioctl_rede
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h .version \
+ $(am__append_7) $(am__append_11)
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) octl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h \
+ sys_func.h $(am__append_8) $(am__append_12)
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+@@ -5896,13 +5897,22 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ rm -f $<-t
+ mv $@-t $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/patches/strace/4.15/010-use-host-ioctl.patch b/patches/strace/4.15/010-use-host-ioctl.patch
new file mode 100644
index 0000000..71d380a
--- /dev/null
+++ b/patches/strace/4.15/010-use-host-ioctl.patch
@@ -0,0 +1,145 @@
+diff -urpN strace-4.15.orig/ioctl_iocdef.c strace-4.15/ioctl_iocdef.c
+--- strace-4.15.orig/ioctl_iocdef.c 1969-12-31 16:00:00.000000000 -0800
++++ strace-4.15/ioctl_iocdef.c 2017-01-14 15:50:56.388590804 -0800
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2017 Alexey Neyman <stilor@att.net>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++/*
++ * This file is *PREPROCESSED*, not *COMPILED* for host and the result
++ * is included into ioctlsort (which is compiled for build). Since some
++ * of these values are used in structure initializers, they cannot be
++ * defined as 'const unsigned int' - instead, they have to be macros.
++ * Hence, the result of preprocessing will be run through sed to change
++ * 'DEFINE' into '#define'
++ */
++#include <linux/ioctl.h>
++
++DEFINE HOST_IOC_NONE _IOC_NONE
++DEFINE HOST_IOC_READ _IOC_READ
++DEFINE HOST_IOC_WRITE _IOC_WRITE
++
++DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
++DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT
+diff -urpN strace-4.15.orig/ioctlsort.c strace-4.15/ioctlsort.c
+--- strace-4.15.orig/ioctlsort.c 2015-03-28 15:37:30.000000000 -0700
++++ strace-4.15/ioctlsort.c 2017-01-14 15:50:56.388590804 -0800
+@@ -33,7 +33,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <linux/ioctl.h>
++
++#include "ioctl_iocdef.h"
+
+ struct ioctlent {
+ const char *info;
+diff -urpN strace-4.15.orig/Makefile.am strace-4.15/Makefile.am
+--- strace-4.15.orig/Makefile.am 2016-12-07 07:53:13.000000000 -0800
++++ strace-4.15/Makefile.am 2017-01-14 15:50:56.392590842 -0800
+@@ -298,6 +298,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align16.h \
+@@ -815,10 +816,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
+@@ -826,7 +836,7 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/i
+
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) ioctl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+
+diff -urpN strace-4.15.orig/Makefile.in strace-4.15/Makefile.in
+--- strace-4.15.orig/Makefile.in 2016-12-14 01:17:46.000000000 -0800
++++ strace-4.15/Makefile.in 2017-01-14 15:50:56.392590842 -0800
+@@ -1036,6 +1036,7 @@ EXTRA_DIST = \
+ debian/watch \
+ errnoent.sh \
+ generate_sen.sh \
++ ioctl_iocdef.c \
+ ioctlsort.c \
+ linux/32/ioctls_inc.h \
+ linux/32/ioctls_inc_align16.h \
+@@ -1514,7 +1515,7 @@ ioctl_redefs_h = $(filter-out ioctl_rede
+ BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) native_printer_decls.h \
+ native_printer_defs.h printers.h sen.h sys_func.h .version \
+ $(am__append_7) $(am__append_11)
+-CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
++CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) octl_iocdef.h $(mpers_preproc_files) \
+ native_printer_decls.h native_printer_defs.h printers.h sen.h \
+ sys_func.h $(am__append_8) $(am__append_12)
+ DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+@@ -6177,13 +6178,22 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+ rm -f $<-t
+ mv $@-t $@
+
++# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
++# ioctlsort *for build*, hence this magic.
++ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
++ $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
++
++ioctl_iocdef.h: ioctl_iocdef.i
++ sed -n 's/^DEFINE HOST/#define /p' $< > $@
++
+ ioctlent%.h: ioctlsort%
+ ./$< > $@
+
+ ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
+ $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
+
+-ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
++ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
+ $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
+
+ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
diff --git a/samples/arm-nano-eabi/crosstool.config b/samples/arm-nano-eabi/crosstool.config
new file mode 100644
index 0000000..abb856d
--- /dev/null
+++ b/samples/arm-nano-eabi/crosstool.config
@@ -0,0 +1,24 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_FLOAT_SW=y
+CT_ARCH_arm=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="nano"
+CT_LIBC_NEWLIB_IO_C99FMT=y
+CT_LIBC_NEWLIB_IO_LL=y
+# CT_LIBC_NEWLIB_FVWRITE_IN_STREAMIO is not set
+# CT_LIBC_NEWLIB_UNBUF_STREAM_OPT is not set
+# CT_LIBC_NEWLIB_FSEEK_OPTIMIZATION is not set
+CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS=y
+# CT_LIBC_NEWLIB_ATEXIT_DYNAMIC_ALLOC is not set
+CT_LIBC_NEWLIB_GLOBAL_ATEXIT=y
+CT_LIBC_NEWLIB_LITE_EXIT=y
+CT_LIBC_NEWLIB_REENT_SMALL=y
+# CT_LIBC_NEWLIB_MULTITHREAD is not set
+CT_LIBC_NEWLIB_EXTRA_SECTIONS=y
+# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
+CT_LIBC_NEWLIB_LTO=y
+CT_LIBC_NEWLIB_NANO_MALLOC=y
+CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
+CT_CC_LANG_CXX=y
diff --git a/samples/arm-nano-eabi/reported.by b/samples/arm-nano-eabi/reported.by
new file mode 100644
index 0000000..f6f49a9
--- /dev/null
+++ b/samples/arm-nano-eabi/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alastair D'Silva"
+reporter_url="http://alastair.d-silva.org/"
+reporter_comment="Based on arm-unknown-eabi"
diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh
index 1976743..1ac9517 100755
--- a/scripts/addToolVersion.sh
+++ b/scripts/addToolVersion.sh
@@ -18,7 +18,7 @@ doHelp() {
'tool' in one of:
gcc, binutils, glibc, uClibc, uClibc-ng, newlib, linux, gdb,
duma, strace, ltrace, libelf, gmp, mpfr, isl, cloog, mpc,
- mingw-w64, expat, ncurses
+ mingw-w64, expat, ncurses, musl
Valid options for all tools:
--stable, -s, +x (default)
@@ -122,7 +122,9 @@ addToolVersion() {
ver_M=$(getVersionField "${version}" . 1)
ver_m=$(getVersionField "${version}" . 2)
ver_p=$(getVersionField "${version}" . 3)
- if [ ${ver_M} -eq 2 -a ${ver_m} -eq 26 ]; then
+ if [ ${ver_M} -eq 2 -a ${ver_m} -eq 27 ]; then
+ SedExpr1="${SedExpr1}\n select BINUTILS_2_27_or_later"
+ elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 26 ]; then
SedExpr1="${SedExpr1}\n select BINUTILS_2_26_or_later"
elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 25 -a ${ver_p} -eq 1 ]; then
SedExpr1="${SedExpr1}\n select BINUTILS_2_25_1_or_later"
@@ -149,13 +151,14 @@ addToolVersion() {
ver_M=$(getVersionField "${version}" . 1)
ver_m=$(getVersionField "${version}" . 2)
ver_p=$(getVersionField "${version}" . 3)
- if [ ${ver_M} -eq 0 -a ${ver_m} -eq 9 -a ${ver_p} -eq 33 ]; then
+ if [ ${ver_M} -eq 1 -a ${ver_m} -eq 0 -a ${ver_p} -eq 15 ]; then
SedExpr1="${SedExpr1}\n select LIBC_UCLIBC_NG_1_0_15_or_later"
fi
;;
gdb)
# gdb-7.0 and above have special handling
ver_M=$(getVersionField "${version}" . 1)
+ ver_m=$(getVersionField "${version}" . 2)
if [ ${ver_M} -ge 7 ]; then
if [ ${ver_m} -ge 2 ]; then
SedExpr1="${SedExpr1}\n select GDB_7_2_or_later"
@@ -192,6 +195,7 @@ while [ $# -gt 0 ]; do
--uClibc-ng)EXP=; OBS=; cat=LIBC_UCLIBC_NG; tool=uClibc; tool_prefix=libc; dot2suffix=;;
--newlib) EXP=; OBS=; cat=LIBC_NEWLIB; tool=newlib; tool_prefix=libc; dot2suffix=;;
--mingw-w64)EXP=; OBS=; cat=WINAPI; tool=mingw; tool_prefix=libc; dot2suffix=;;
+ --musl) EXP=; OBS=; cat=LIBC_MUSL; tool=musl; tool_prefix=libc; dot2suffix=;;
--linux) EXP=; OBS=; cat=KERNEL; tool=linux; tool_prefix=kernel; dot2suffix=;;
--gdb) EXP=; OBS=; cat=GDB; tool=gdb; tool_prefix=debug; dot2suffix=;;
--duma) EXP=; OBS=; cat=DUMA; tool=duma; tool_prefix=debug; dot2suffix=;;
diff --git a/scripts/build/arch/x86.sh b/scripts/build/arch/x86.sh
index 2c8a226..3a7a2ce 100644
--- a/scripts/build/arch/x86.sh
+++ b/scripts/build/arch/x86.sh
@@ -166,7 +166,7 @@ CT_DoArchUClibcHeaderDir() {
# If it is non-default multilib, add a suffix with architecture (reported by gcc)
# to the headers installation path.
if [ -n "${cflags}" ]; then
- eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} )
+ eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} )
fi
}
@@ -177,6 +177,6 @@ CT_DoArchMUSLHeaderDir() {
# If it is non-default multilib, add a suffix with architecture (reported by gcc)
# to the headers installation path.
if [ -n "${cflags}" ]; then
- eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} )
+ eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} )
fi
}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 0e285b6..17ea138 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -8,16 +8,16 @@ do_binutils_get() {
CT_GetCustom "binutils" "${CT_BINUTILS_CUSTOM_VERSION}" \
"${CT_BINUTILS_CUSTOM_LOCATION}"
else
- if echo ${CT_BINUTILS_VERSION} |grep -q linaro; then
- YYMM=`echo ${CT_BINUTILS_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
- CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
- https://releases.linaro.org/${YYMM}/components/toolchain/binutils-linaro \
- http://cbuild.validation.linaro.org/snapshots
- else
- CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
- {http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
- ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots}
- fi
+ case "${CT_BINUTILS_VERSION}" in
+ linaro-*)
+ CT_GetLinaro "binutils" "${CT_BINUTILS_VERSION}"
+ ;;
+ *)
+ CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
+ {http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
+ ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots}
+ ;;
+ esac
fi
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh
index 164fb9b..0bf4aed 100644
--- a/scripts/build/cc/100-gcc.sh
+++ b/scripts/build/cc/100-gcc.sh
@@ -11,30 +11,18 @@ do_gcc_get() {
CT_GetCustom "gcc" "${CT_CC_GCC_CUSTOM_VERSION}" \
"${CT_CC_GCC_CUSTOM_LOCATION}"
else
- # Account for the Linaro versioning
- linaro_version="$( echo "${CT_CC_GCC_VERSION}" \
- |sed -r -e 's/^linaro-//;' \
- )"
- linaro_series="$( echo "${linaro_version}" \
- |sed -r -e 's/-.*//;' \
- )"
-
- # The official gcc hosts put gcc under a gcc/release/ directory,
- # whereas the mirrors put it in the gcc/ directory.
- # Also, Split out linaro mirrors, so that downloads happen faster.
- if [ x"${linaro_version}" = x"${CT_CC_GCC_VERSION}" ]; then
- CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \
- ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION}
- else
- YYMM=`echo ${CT_CC_GCC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
- CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \
- "https://releases.linaro.org/components/toolchain/gcc-linaro/${linaro_version}" \
- "https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series}" \
- "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \
- http://cbuild.validation.linaro.org/snapshots
- fi
-
+ case "${CT_CC_GCC_VERSION}" in
+ linaro-*)
+ CT_GetLinaro "gcc" "${CT_CC_GCC_VERSION}"
+ ;;
+ *)
+ # The official gcc hosts put gcc under a gcc/release/ directory,
+ # whereas the mirrors put it in the gcc/ directory.
+ CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \
+ {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \
+ ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION}
+ ;;
+ esac
fi # ! custom location
# Starting with GCC 4.3, ecj is used for Java, and will only be
# built if the configure script finds ecj.jar at the top of the
@@ -180,7 +168,7 @@ cc_gcc_multilib_housekeeping() {
"directly; will use build-compiler for housekeeping."
# Since we cannot run the desired compiler, substitute build-CC with the assumption
# that the host-CC is configured in the same way.
- cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-gcc"
+ cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}"
fi
# sed: prepend dashes or do nothing if default is empty string
@@ -409,8 +397,12 @@ do_gcc_core_backend() {
;;
esac
- CT_DoLog DEBUG "Copying headers to install area of core C compiler"
- CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include"
+ # This is only needed when building libstdc++ in a canadian environment with
+ # this function being used for final step (i.e., when building for bare metal).
+ if [ "${build_step}" = "gcc_build" ]; then
+ CT_DoLog DEBUG "Copying headers to install area of core C compiler"
+ CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include"
+ fi
for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
eval tmp="\${CT_ARCH_WITH_${tmp}}"
@@ -478,14 +470,13 @@ do_gcc_core_backend() {
host_libstdcxx_flags+=("-static-libgcc")
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
host_libstdcxx_flags+=("-lm")
- elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
- # When companion libraries are build static (eg !shared),
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- core_LDFLAGS+=("-lstdc++")
- core_LDFLAGS+=("-lm")
fi
+ # When companion libraries are build static (eg !shared),
+ # the libstdc++ is not pulled automatically, although it
+ # is needed. Shoe-horn it in our LDFLAGS
+ # Ditto libm on some Fedora boxen
+ core_LDFLAGS+=("-lstdc++")
+ core_LDFLAGS+=("-lm")
fi
if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
@@ -561,7 +552,11 @@ do_gcc_core_backend() {
;; # ARCH is mips
esac
- [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls")
+ if [ "${CT_TOOLCHAIN_ENABLE_NLS}" = "y" ]; then
+ extra_config+=("--with-libintl-prefix=${complibs}")
+ else
+ extra_config+=("--disable-nls")
+ fi
if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then
extra_config+=("--with-system-zlib")
@@ -658,7 +653,7 @@ do_gcc_core_backend() {
if [ "${CT_BARE_METAL},${CT_CANADIAN}" = "y,y" ]; then
repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \
CXX_FOR_BUILD=${CT_BUILD}-g++ \
- GCC_FOR_TARGET=${CT_TARGET}-gcc"
+ GCC_FOR_TARGET=${CT_TARGET}-${CT_CC}"
else
repair_cc=""
fi
@@ -723,16 +718,16 @@ do_gcc_core_backend() {
CT_DoExecLog ALL make install-{pdf,html}-gcc
fi
- # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
+ # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-${CT_CC} to always be able
# to call the C compiler with the same, somewhat canonical name.
# check whether compiler has an extension
- file="$( ls -1 "${prefix}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
+ file="$( ls -1 "${prefix}/bin/${CT_TARGET}-${CT_CC}."* 2>/dev/null || true )"
[ -z "${file}" ] || ext=".${file##*.}"
- if [ -f "${prefix}/bin/${CT_TARGET}-gcc${ext}" ]; then
- CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
+ if [ -f "${prefix}/bin/${CT_TARGET}-${CT_CC}${ext}" ]; then
+ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-${CT_CC}${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
fi
- cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \
+ cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-${CT_CC}" \
host="${host}"
}
@@ -985,14 +980,13 @@ do_gcc_backend() {
host_libstdcxx_flags+=("-static-libgcc")
host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
host_libstdcxx_flags+=("-lm")
- elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
- # When companion libraries are build static (eg !shared),
- # the libstdc++ is not pulled automatically, although it
- # is needed. Shoe-horn it in our LDFLAGS
- # Ditto libm on some Fedora boxen
- final_LDFLAGS+=("-lstdc++")
- final_LDFLAGS+=("-lm")
fi
+ # When companion libraries are build static (eg !shared),
+ # the libstdc++ is not pulled automatically, although it
+ # is needed. Shoe-horn it in our LDFLAGS
+ # Ditto libm on some Fedora boxen
+ final_LDFLAGS+=("-lstdc++")
+ final_LDFLAGS+=("-lm")
fi
if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
@@ -1086,7 +1080,11 @@ do_gcc_backend() {
;; # ARCH is mips
esac
- [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls")
+ if [ "${CT_TOOLCHAIN_ENABLE_NLS}" = "y" ]; then
+ extra_config+=("--with-libintl-prefix=${complibs}")
+ else
+ extra_config+=("--disable-nls")
+ fi
if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then
extra_config+=("--with-system-zlib")
@@ -1162,15 +1160,15 @@ do_gcc_backend() {
CT_DoExecLog ALL make install-{pdf,html}-gcc
fi
- # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
+ # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-${CT_CC} to always be able
# to call the C compiler with the same, somewhat canonical name.
# check whether compiler has an extension
- file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
+ file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}."* 2>/dev/null || true )"
[ -z "${file}" ] || ext=".${file##*.}"
- if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc${ext}" ]; then
- CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
+ if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}${ext}" ]; then
+ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-${CT_CC}${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
fi
- cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \
+ cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-${CT_CC}" \
host="${host}"
}
diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh
index 823dbd5..8cc6dc2 100644
--- a/scripts/build/companion_libs/121-isl.sh
+++ b/scripts/build/companion_libs/121-isl.sh
@@ -29,8 +29,6 @@ do_isl_extract() {
# - install in build-tools prefix
do_isl_for_build() {
local -a isl_opts
- local isl_cflags
- local isl_cxxflags
case "${CT_TOOLCHAIN_TYPE}" in
native|cross) return 0;;
@@ -39,13 +37,10 @@ do_isl_for_build() {
CT_DoStep INFO "Installing ISL for build"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}"
- isl_cflags="${CT_CFLAGS_FOR_BUILD}"
- isl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
-
isl_opts+=( "host=${CT_BUILD}" )
isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
- isl_opts+=( "cflags=${isl_cflags}" )
- isl_opts+=( "cxxflags=${isl_cxxflags}" )
+ isl_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+ isl_opts+=( "cxxflags=${CT_CFLAGS_FOR_BUILD}" )
isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
do_isl_backend "${isl_opts[@]}"
@@ -56,19 +51,14 @@ do_isl_for_build() {
# Build ISL for running on host
do_isl_for_host() {
local -a isl_opts
- local isl_cflags
- local isl_cxxflags
CT_DoStep INFO "Installing ISL for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}"
- isl_cflags="${CT_CFLAGS_FOR_HOST}"
- isl_cxxflags="${CT_CFLAGS_FOR_HOST}"
-
isl_opts+=( "host=${CT_HOST}" )
isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
- isl_opts+=( "cflags=${isl_cflags}" )
- isl_opts+=( "cxxflags=${isl_cxxflags}" )
+ isl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ isl_opts+=( "cxxflags=${CT_CFLAGS_FOR_HOST}" )
isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
do_isl_backend "${isl_opts[@]}"
diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh
index 55da586..3f3ce24 100644
--- a/scripts/build/companion_libs/320-libiconv.sh
+++ b/scripts/build/companion_libs/320-libiconv.sh
@@ -22,10 +22,8 @@ do_libiconv_extract() {
do_libiconv_for_build() {
local -a libiconv_opts
- case "$CT_BUILD" in
- *darwin*|*linux*)
- return 0
- ;;
+ case "${CT_TOOLCHAIN_TYPE}" in
+ native|cross) return 0;;
esac
CT_DoStep INFO "Installing libiconv for build"
diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh
index 07ea02b..88384f8 100644
--- a/scripts/build/companion_libs/330-gettext.sh
+++ b/scripts/build/companion_libs/330-gettext.sh
@@ -22,10 +22,8 @@ do_gettext_extract() {
do_gettext_for_build() {
local -a gettext_opts
- case "$CT_BUILD" in
- *linux*)
- return 0
- ;;
+ case "${CT_TOOLCHAIN_TYPE}" in
+ native|cross) return 0;;
esac
CT_DoStep INFO "Installing gettext for build"
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index 0e5291c..7196fcf 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -40,9 +40,9 @@ do_debug_duma_build() {
libs="${libs# }"
CT_DoLog EXTRA "Building libraries '${libs}'"
CT_DoExecLog ALL \
- make HOSTCC="${CT_BUILD}-gcc" \
- CC="${CT_TARGET}-gcc" \
- CXX="${CT_TARGET}-gcc" \
+ make HOSTCC="${CT_BUILD}-gcc" \
+ CC="${CT_TARGET}-${CT_CC}" \
+ CXX="${CT_TARGET}-g++" \
RANLIB="${CT_TARGET}-ranlib" \
DUMA_CPP="${DUMA_CPP}" \
${libs}
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index ba13591..fe7787b 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -10,26 +10,17 @@ do_debug_gdb_get() {
CT_GetCustom "gdb" "${CT_GDB_CUSTOM_VERSION}" \
"${CT_GDB_CUSTOM_LOCATION}"
else
- # Account for the Linaro versioning
- linaro_version="$( echo "${CT_GDB_VERSION}" \
- |sed -r -e 's/^linaro-//;' \
- )"
- linaro_series="$( echo "${linaro_version}" \
- |sed -r -e 's/-.*//;' \
- )"
-
- if [ x"${linaro_version}" = x"${CT_GDB_VERSION}" ]; then
- CT_GetFile "gdb-${CT_GDB_VERSION}" \
- http://mirrors.kernel.org/sourceware/gdb \
- {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \
- ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases
- else
- YYMM=`echo ${CT_GDB_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
- CT_GetFile "gdb-${CT_GDB_VERSION}" \
- "http://launchpad.net/gdb-linaro/${linaro_series}/${linaro_version}/+download" \
- https://releases.linaro.org/${YYMM}/components/toolchain/gdb-linaro \
- http://cbuild.validation.linaro.org/snapshots
- fi
+ case "${CT_GDB_VERSION}" in
+ linaro-*)
+ CT_GetLinaro "gdb" "${CT_GDB_VERSION}"
+ ;;
+ *)
+ CT_GetFile "gdb-${CT_GDB_VERSION}" \
+ http://mirrors.kernel.org/sourceware/gdb \
+ {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \
+ ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases
+ ;;
+ esac
fi
}
@@ -99,18 +90,30 @@ do_debug_gdb_build() {
cross_extra_config+=("--disable-nls")
fi
+ CPP_for_gdb="${CT_HOST}-cpp ${CT_CFLAGS_FOR_HOST}"
CC_for_gdb="${CT_HOST}-gcc ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
+ CXX_for_gdb="${CT_HOST}-g++ ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
LD_for_gdb="${CT_HOST}-ld ${CT_LDFLAGS_FOR_HOST}"
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
CC_for_gdb+=" -static"
+ CXX_for_gdb+=" -static"
LD_for_gdb+=" -static"
fi
+ case "${CT_HOST}" in
+ *darwin*)
+ # FIXME: Really, we should be testing for host compiler being clang.
+ CC_for_gdb+=" -Qunused-arguments"
+ CXX_for_gdb+=" -Qunused-arguments"
+ ;;
+ esac
# Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there
# are multiple consecutive spaces: sub-configure scripts replace them with a
# single space and then complain that $CC value changed from that in
# the master directory.
+ CPP_for_gdb=`echo $CPP_for_gdb`
CC_for_gdb=`echo $CC_for_gdb`
+ CXX_for_gdb=`echo $CXX_for_gdb`
LD_for_gdb=`echo $LD_for_gdb`
# Disable binutils options when building from the binutils-gdb repo.
@@ -121,7 +124,9 @@ do_debug_gdb_build() {
CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
CT_DoExecLog CFG \
+ CPP="${CPP_for_gdb}" \
CC="${CC_for_gdb}" \
+ CXX="${CXX_for_gdb}" \
LD="${LD_for_gdb}" \
"${gdb_src_dir}/configure" \
--build=${CT_BUILD} \
@@ -168,7 +173,6 @@ do_debug_gdb_build() {
if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
- local -a gdb_native_CFLAGS
CT_DoStep INFO "Installing native gdb"
@@ -211,12 +215,14 @@ do_debug_gdb_build() {
[ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && \
native_extra_config+=("--disable-nls")
+ CPP_for_gdb="${CT_TARGET}-cpp"
+ CC_for_gdb="${CT_TARGET}-${CT_CC}"
+ CXX_for_gdb="${CT_TARGET}-g++"
+ LD_for_gdb="${CT_TARGET}-ld"
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
- CC_for_gdb="${CT_TARGET}-gcc -static"
- LD_for_gdb="${CT_TARGET}-ld -static"
- else
- CC_for_gdb="${CT_TARGET}-gcc"
- LD_for_gdb="${CT_TARGET}-ld"
+ CC_for_gdb+=" -static"
+ CXX_for_gdb+=" -static"
+ LD_for_gdb+=" -static"
fi
export ac_cv_func_strncmp_works=yes
@@ -229,9 +235,10 @@ do_debug_gdb_build() {
CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
CT_DoExecLog CFG \
+ CPP="${CPP_for_gdb}" \
CC="${CC_for_gdb}" \
+ CXX="${CXX_for_gdb}" \
LD="${LD_for_gdb}" \
- CFLAGS="${gdb_native_CFLAGS[*]}" \
"${gdb_src_dir}/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
@@ -249,7 +256,7 @@ do_debug_gdb_build() {
"${native_extra_config[@]}"
CT_DoLog EXTRA "Building native gdb"
- CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
+ CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing native gdb"
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
@@ -264,6 +271,7 @@ do_debug_gdb_build() {
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
local -a gdbserver_extra_config
+ local gdbserver_LDFLAGS
CT_DoStep INFO "Installing gdbserver"
CT_DoLog EXTRA "Configuring gdbserver"
@@ -297,7 +305,7 @@ do_debug_gdb_build() {
gdbserver_extra_config+=("--disable-gas")
CT_DoExecLog CFG \
- CC="${CT_TARGET}-gcc" \
+ CC="${CT_TARGET}-${CT_CC}" \
CPP="${CT_TARGET}-cpp" \
LD="${CT_TARGET}-ld" \
LDFLAGS="${gdbserver_LDFLAGS}" \
diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh
index 0d33ca0..2d8c7df 100644
--- a/scripts/build/debug/500-strace.sh
+++ b/scripts/build/debug/500-strace.sh
@@ -14,17 +14,17 @@ do_debug_strace_extract() {
do_debug_strace_build() {
CT_DoStep INFO "Installing strace"
- mkdir -p "${CT_BUILD_DIR}/build-strace"
- CT_Pushd "${CT_BUILD_DIR}/build-strace"
+
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-strace"
CT_DoLog EXTRA "Configuring strace"
- CT_DoExecLog CFG \
- CC="${CT_TARGET}-gcc" \
- CPP="${CT_TARGET}-cpp" \
- LD="${LD_TARGET}-ld" \
- "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
+ CT_DoExecLog CFG \
+ CC="${CT_TARGET}-${CT_CC}" \
+ CPP="${CT_TARGET}-cpp" \
+ LD="${CT_TARGET}-ld" \
+ "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host=${CT_TARGET} \
--prefix=/usr
CT_DoLog EXTRA "Building strace"
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 2db69cb..bce4cb8 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -11,17 +11,16 @@ do_libc_get() {
CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
else
- if echo ${CT_LIBC_VERSION} |grep -q linaro; then
- # Linaro glibc releases come from regular downloads...
- YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
- CT_GetFile "glibc-${CT_LIBC_VERSION}" \
- https://releases.linaro.org/${YYMM}/components/toolchain/glibc-linaro \
- http://cbuild.validation.linaro.org/snapshots
- else
- CT_GetFile "glibc-${CT_LIBC_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/glibc \
- ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
- fi
+ case "${CT_LIBC_VERSION}" in
+ linaro-*)
+ CT_GetLinaro "glibc" "${CT_LIBC_VERSION}"
+ ;;
+ *)
+ CT_GetFile "glibc-${CT_LIBC_VERSION}" \
+ {http,ftp,https}://ftp.gnu.org/gnu/glibc \
+ ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
+ ;;
+ esac
fi
return 0
@@ -96,6 +95,7 @@ do_libc_backend() {
# multi_* : as defined in CT_IterateMultilibs : (varies) :
do_libc_backend_once() {
local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count
+ local build_cflags build_cppflags build_ldflags
local startfiles_dir
local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
local -a extra_config
@@ -252,7 +252,7 @@ do_libc_backend_once() {
# but they are not passed by configure. Thus, pass everything in CC instead.
CT_DoExecLog CFG \
BUILD_CC=${CT_BUILD}-gcc \
- CC="${CT_TARGET}-gcc ${glibc_cflags}" \
+ CC="${CT_TARGET}-${CT_CC} ${glibc_cflags}" \
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
"${CONFIG_SHELL}" \
@@ -277,23 +277,21 @@ do_libc_backend_once() {
;;
esac
- CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}"
- CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}"
- extra_make_args+=( "BUILD_CFLAGS=${CT_CFLAGS_FOR_BUILD}" "BUILD_LDFLAGS=${CT_LDFLAGS_FOR_BUILD}" )
+ build_cflags="${CT_CFLAGS_FOR_BUILD}"
+ build_cppflags=
+ build_ldflags="${CT_LDFLAGS_FOR_BUILD}"
case "$CT_BUILD" in
- *mingw*|*cygwin*|*msys*)
- # When installing headers on Cygwin, MSYS2 and MinGW-w64 sunrpc needs
+ *mingw*|*cygwin*|*msys*|*darwin*)
+ # When installing headers on Cygwin, Darwin, MSYS2 and MinGW-w64 sunrpc needs
# gettext for building cross-rpcgen.
- extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" )
- extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -Wl,-Bstatic -lintl -liconv -Wl,-Bdynamic" )
- ;;
- *darwin*)
- # .. and the same goes for Darwin.
- extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" )
- extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -lintl" )
+ build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/"
+ build_ldflags="${build_ldflags} -lintl -liconv"
;;
esac
+ extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" )
+ extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" )
+ extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" )
if [ "${libc_mode}" = "startfiles" -a ! -r "${multi_root}/.libc_headers_installed" ]; then
CT_DoLog EXTRA "Installing C library headers"
@@ -364,11 +362,11 @@ do_libc_backend_once() {
# However, since we will never actually execute its code,
# it doesn't matter what it contains. So, treating '/dev/null'
# as a C source file, we produce a dummy 'libc.so' in one step
- CT_DoExecLog ALL "${CT_TARGET}-gcc" ${multi_flags} \
- -nostdlib \
- -nostartfiles \
- -shared \
- -x c /dev/null \
+ CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" ${multi_flags} \
+ -nostdlib \
+ -nostartfiles \
+ -shared \
+ -x c /dev/null \
-o "${startfiles_dir}/libc.so"
fi # threads == nptl
fi # libc_mode = startfiles
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index acd14c2..3eb0357 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -126,7 +126,7 @@ do_libc_backend_once() {
obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o
CT_DoLog EXTRA "Installing C library start files"
CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}"
- CT_DoExecLog ALL ${CT_TARGET}-gcc -nostdlib \
+ CT_DoExecLog ALL ${CT_TARGET}-${CT_CC} -nostdlib \
-nostartfiles -shared -x c /dev/null -o "${multi_root}${multilib_dir}/libc.so"
fi
if [ "${libc_mode}" = "final" ]; then
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 6ae579b..0c0c2aa 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -5,10 +5,6 @@
# Edited by Martin Lund <mgl@doredevelopment.dk>
#
-LIBC_NEWLIB_AVR_HDRS_URI="http://www.atmel.com/Images"
-LIBC_NEWLIB_AVR_HDRS_BASE="avr-headers-3.2.3.970"
-LIBC_NEWLIB_AVR_HDRS_EXT=".zip"
-
do_libc_get() {
local libc_src="{http://mirrors.kernel.org/sourceware/newlib,
ftp://sourceware.org/pub/newlib}"
@@ -17,15 +13,18 @@ do_libc_get() {
CT_GetCustom "newlib" "${CT_LIBC_NEWLIB_CUSTOM_VERSION}" \
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
else # ! custom location
- if echo ${CT_LIBC_VERSION} |grep -q linaro; then
- YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
- CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \
- https://releases.linaro.org/${YYMM}/components/toolchain/newlib-linaro \
- http://cbuild.validation.linaro.org/snapshots
- else
- CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \
- http://mirrors.kernel.org/sources.redhat.com/newlib
- fi
+ case "${CT_LIBC_VERSION}" in
+ linaro-*)
+ CT_GetLinaro "newlib" "${CT_LIBC_VERSION}"
+ ;;
+ *)
+ # kernel.org mirror is outdated, keep last as a fallback
+ CT_GetFile "newlib-${CT_LIBC_VERSION}" \
+ ftp://sourceware.org/pub/newlib \
+ http://mirrors.kernel.org/sourceware/newlib \
+ http://mirrors.kernel.org/sources.redhat.com/newlib
+ ;;
+ esac
fi # ! custom location
}
@@ -66,16 +65,6 @@ do_libc() {
extra_config+=("--disable-multilib")
fi
- if [ "${CT_LIBC_NEWLIB_IO_C99FMT}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-io-c99-formats" )
- else
- newlib_opts+=( "--disable-newlib-io-c99-formats" )
- fi
- if [ "${CT_LIBC_NEWLIB_IO_LL}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-io-long-long" )
- else
- newlib_opts+=( "--disable-newlib-io-long-long" )
- fi
if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then
newlib_opts+=( "--enable-newlib-io-float" )
if [ "${CT_LIBC_NEWLIB_IO_LDBL}" = "y" ]; then
@@ -87,19 +76,47 @@ do_libc() {
newlib_opts+=( "--disable-newlib-io-float" )
newlib_opts+=( "--disable-newlib-io-long-double" )
fi
+
if [ "${CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS}" = "y" ]; then
newlib_opts+=( "--disable-newlib-supplied-syscalls" )
else
newlib_opts+=( "--enable-newlib-supplied-syscalls" )
fi
- if [ "${CT_LIBC_NEWLIB_NANO_MALLOC}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-nano-malloc" )
- fi
- if [ "${CT_LIBC_NEWLIB_NANO_FORMATTED_IO}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-nano-formatted-io" )
- fi
- [ "${CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE}" = "y" ] && newlib_opts+=("--enable-target-optspace")
+ yn_args="IO_POS_ARGS:newlib-io-pos-args
+IO_C99FMT:newlib-io-c99-formats
+IO_LL:newlib-io-long-long
+NEWLIB_REGISTER_FINI:newlib-register-fini
+NANO_MALLOC:newlib-nano-malloc
+NANO_FORMATTED_IO:newlib-nano-formatted-io
+ATEXIT_DYNAMIC_ALLOC:atexit-dynamic-alloc
+GLOBAL_ATEXIT:newlib-global-atexit
+LITE_EXIT:lite-exit
+REENT_SMALL:reent-small
+MULTITHREAD:multithread
+WIDE_ORIENT:newlib-wide-orient
+UNBUF_STREAM_OPT:unbuf-stream-opt
+ENABLE_TARGET_OPTSPACE:target-optspace
+ "
+
+ for ynarg in $yn_args; do
+ var="CT_LIBC_NEWLIB_${ynarg%:*}"
+ eval var=\$${var}
+ argument=${ynarg#*:}
+
+
+ if [ "${var}" = "y" ]; then
+ newlib_opts+=( "--enable-$argument" )
+ else
+ newlib_opts+=( "--disable-$argument" )
+ fi
+ done
+
+ [ "${CT_LIBC_NEWLIB_EXTRA_SECTIONS}" = "y" ] && \
+ CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
+
+ [ "${CT_LIBC_NEWLIB_LTO}" = "y" ] && \
+ CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -flto"
cflags_for_target="${CT_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}"
@@ -108,23 +125,23 @@ do_libc() {
# build : not used
# host : the machine building newlib
# target : the machine newlib runs on
- CT_DoExecLog CFG \
- CC_FOR_BUILD="${CT_BUILD}-gcc" \
- CFLAGS_FOR_TARGET="${cflags_for_target}" \
- AR=${CT_TARGET}-ar \
- RANLIB=${CT_TARGET}-ranlib \
- "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
- --host=${CT_BUILD} \
- --target=${CT_TARGET} \
- --prefix=${CT_PREFIX_DIR} \
- "${newlib_opts[@]}" \
+ CT_DoExecLog CFG \
+ CC_FOR_BUILD="${CT_BUILD}-gcc" \
+ CFLAGS_FOR_TARGET="${cflags_for_target}" \
+ AR_FOR_TARGET="`which ${CT_TARGET}-gcc-ar`" \
+ RANLIB_FOR_TARGET="`which ${CT_TARGET}-gcc-ranlib`" \
+ "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
+ --host=${CT_BUILD} \
+ --target=${CT_TARGET} \
+ --prefix=${CT_PREFIX_DIR} \
+ "${newlib_opts[@]}" \
"${CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY[@]}"
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
+ CT_DoExecLog ALL make install
if [ "${CT_BUILD_MANUALS}" = "y" ]; then
local -a doc_dir="${CT_BUILD_DIR}/build-libc/${CT_TARGET}"
diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh
index 96d4b51..d86ae1a 100644
--- a/scripts/build/libc/uClibc.sh
+++ b/scripts/build/libc/uClibc.sh
@@ -197,7 +197,7 @@ do_libc_backend_once() {
# libm.so is needed for ppc, as libgcc is linked against libm.so
# No problem to create it for other archs.
CT_DoLog EXTRA "Building dummy shared libs"
- CT_DoExecLog ALL "${CT_TARGET}-gcc" -nostdlib -nostartfiles \
+ CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -nostdlib -nostartfiles \
-shared ${multi_flags} -x c /dev/null -o libdummy.so
CT_DoLog EXTRA "Installing start files"
@@ -470,7 +470,7 @@ do_libc_ldso_fixup() {
multilib_dir="/lib/${multi_os_dir}"
CT_SanitizeVarDir multilib_dir
- CT_DoExecLog ALL "${CT_TARGET}-gcc" -o test-ldso ../test-ldso.c ${multi_flags}
+ CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -o test-ldso ../test-ldso.c ${multi_flags}
if [ -r "test-ldso.gdb" ]; then
binary="test-ldso.gdb"
else
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index bbefb1f..ba36bc8 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -469,30 +469,68 @@ if [ -z "${CT_RESTART}" ]; then
# - fall back to searching user's PATH
# Of course, neither cross-native nor canadian can run on BUILD,
# so don't add those PATHs in this case...
+ # For native and simple cross, build==host, combine the extra CFLAGS/LDFLAGS
+ # supplied for both (so that it doesn't matter where the user supplied them).
case "${CT_TOOLCHAIN_TYPE}" in
- cross) export PATH="${CT_PREFIX_DIR}/bin:${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}";;
- canadian) export PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}";;
- *) ;;
+ cross|native)
+ export PATH="${CT_PREFIX_DIR}/bin:${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}"
+ bh_cflags="${CT_EXTRA_CFLAGS_FOR_BUILD} ${CT_EXTRA_CFLAGS_FOR_HOST}"
+ bh_ldflags="${CT_EXTRA_LDFLAGS_FOR_BUILD} ${CT_EXTRA_LDFLAGS_FOR_HOST}"
+ CT_EXTRA_CFLAGS_FOR_BUILD="${bh_cflags}"
+ CT_EXTRA_CFLAGS_FOR_HOST="${bh_cflags}"
+ CT_EXTRA_LDFLAGS_FOR_BUILD="${bh_ldflags}"
+ CT_EXTRA_LDFLAGS_FOR_HOST="${bh_ldflags}"
+ ;;
+ canadian|cross-native)
+ export PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}"
+ # build!=host in this case
+ ;;
+ *)
+ ;;
esac
# Help build gcc
# Explicitly optimise, else the lines below will overide the
# package's default optimisation flags
- CT_CFLAGS_FOR_BUILD="-O2 -g"
+ CT_CFLAGS_FOR_BUILD="-O2 -g -I${CT_BUILDTOOLS_PREFIX_DIR}/include"
CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}"
- CT_LDFLAGS_FOR_BUILD=
+ CT_LDFLAGS_FOR_BUILD="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib"
CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}"
+ case "${CT_BUILD}" in
+ *darwin*)
+ # Two issues while building on MacOS. Really, we should be checking for
+ # clang instead.
+ # - gettext static library fails to link unless CoreFoundation framework
+ # is included
+ # - ranlib on MacOS does not include common symbols into the symbol index
+ # for a static library, and hence linker fails to pull in the right
+ # archive members; hence, avoid common symbols. Alternative is to
+ # have ranlib wrapper in buildtools/bin supply -c option.
+ CT_CFLAGS_FOR_BUILD+=" -fno-common"
+ CT_LDFLAGS_FOR_BUILD+=" -framework CoreFoundation"
+ ;;
+ esac
+
+ CT_DoLog DEBUG "CFLAGS for build compiler: '${CT_CFLAGS_FOR_BUILD}'"
+ CT_DoLog DEBUG "LDFLAGS for build compiler: '${CT_LDFLAGS_FOR_BUILD}'"
+
# Help host gcc
# Explicitly optimise, else the lines below will overide the
# package's default optimisation flags
CT_CFLAGS_FOR_HOST="-O2 -g"
[ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
+ CT_CFLAGS_FOR_HOST+=" -I${CT_HOST_COMPLIBS_DIR}/include"
CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}"
- CT_LDFLAGS_FOR_HOST=
+ CT_LDFLAGS_FOR_HOST="-L${CT_HOST_COMPLIBS_DIR}/lib"
CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}"
- CT_CFLAGS_FOR_HOST+=" -I${CT_HOST_COMPLIBS_DIR}/include"
- CT_LDFLAGS_FOR_HOST+=" -L${CT_HOST_COMPLIBS_DIR}/lib"
+ case "${CT_HOST}" in
+ *darwin*)
+ # Same as above, for host
+ CT_CFLAGS_FOR_HOST+=" -fno-common"
+ CT_LDFLAGS_FOR_HOST+=" -framework CoreFoundation"
+ ;;
+ esac
CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'"
CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'"
diff --git a/scripts/functions b/scripts/functions
index f687504..cbef48b 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -798,6 +798,40 @@ CT_GetFile() {
return 1
}
+# Get a component from Linaro archives.
+# Usage: CT_GetLinaro <component> <version>
+CT_GetLinaro() {
+ local comp="$1"
+ local version="$2"
+ local linaro_version
+ local yyyymm_p
+ local yymm
+ local base
+
+ case "${version}" in
+ linaro-*)
+ linaro_version="${version#linaro-}"
+ ;;
+ *)
+ CT_Abort "Version ${version} is not a Linaro package"
+ ;;
+ esac
+
+ # Recent releases reside in top of the directory tree; older releases
+ # are moved into the archive. Subdirectories are named differently
+ # in archive!
+ # In archive, some URLs also contain base component version
+ # (e.g. "gcc-linaro/4.9") while some do not (e.g. just "newlib-linaro").
+ base="${linaro_version%%-*}"
+ # Strip base version, first two digits of the year and optional patchlevel
+ yymm="${linaro_version#*-??}"
+ yymm="${yymm%-*}"
+ CT_GetFile "${comp}-${version}" \
+ "https://releases.linaro.org/components/toolchain/${comp}-linaro/${linaro_version}" \
+ "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro/${base}" \
+ "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro"
+}
+
# Checkout from CVS, and build the associated tarball
# The tarball will be called ${basename}.tar.bz2
# Prerequisite: either the server does not require password,
@@ -1587,7 +1621,7 @@ CT_IterateMultilibs() {
# If gcc is not configured for multilib, it still prints a single line
# for the default settings
- multilibs=( $("${CT_TARGET}-gcc" -print-multi-lib 2>/dev/null) )
+ multilibs=( $("${CT_TARGET}-${CT_CC}" -print-multi-lib 2>/dev/null) )
CT_DoExecLog ALL rm -rf "sysroot-check"
for multilib in "${multilibs[@]}"; do
# GCC makes the distinction between:
@@ -1623,8 +1657,8 @@ CT_IterateMultilibs() {
# multi_os_dir_gcc.
multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
- multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
- multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
+ multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} )
+ multi_root=$( "${CT_TARGET}-${CT_CC}" -print-sysroot ${multi_flags} )
root_suffix="${multi_root#${CT_SYSROOT_DIR}}"
CT_DoExecLog ALL mkdir -p "sysroot-check${root_suffix}"
if [ -e "sysroot-check${root_suffix}/seen" ]; then
@@ -1643,10 +1677,10 @@ CT_IterateMultilibs() {
for multilib in "${multilibs[@]}"; do
multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
- multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
+ multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} )
multi_os_dir_gcc="${multi_os_dir}"
- multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
- multi_target=$( "${CT_TARGET}-gcc" -print-multiarch ${multi_flags} )
+ multi_root=$( "${CT_TARGET}-${CT_CC}" -print-sysroot ${multi_flags} )
+ multi_target=$( "${CT_TARGET}-${CT_CC}" -print-multiarch ${multi_flags} )
root_suffix="${multi_root#${CT_SYSROOT_DIR}}"
# If GCC did not report the target tuple (i.e. this configuration is not