summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1.inc124
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0002-c99-snprintf.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0003-gcc-poison-system-directories.patch192
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0004-gcc-poison-dir-extend.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0005-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0006-64-bit-multilib-hack.patch85
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0007-optional-libstdc.patch125
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0008-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0009-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0010-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch96
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0011-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0012-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0013-MIPS64-Default-to-N64-ABI.patch57
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0014-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch234
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0015-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0016-Disable-sdt.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0017-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0018-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0019-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0020-Avoid-using-libdir-from-.la-which-usually-points-to-.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0021-export-CPP.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0022-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0023-Ensure-target-gcc-headers-can-be-included.patch98
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0024-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0025-Don-t-search-host-directory-during-relink-if-inst_pr.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0026-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0027-aarch64-Add-support-for-musl-ldso.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0028-libcc1-fix-libcc1-s-install-path-and-rpath.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0029-handle-sysroot-support-for-nativesdk-gcc.patch213
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0030-Search-target-sysroot-gcc-version-specific-dirs-with.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0031-Fix-various-_FOR_BUILD-and-related-variables.patch137
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0032-nios2-Define-MUSL_DYNAMIC_LINKER.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0033-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch125
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0035-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0036-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch86
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0037-sync-gcc-stddef.h-with-musl.patch91
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0038-fix-segmentation-fault-in-precompiled-header-generat.patch60
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.1/0039-Fix-for-testsuite-failure.patch258
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_8.1.bb5
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_8.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_8.1.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_8.1.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_8.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_8.1.bb7
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_8.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-source_8.1.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc_8.1.bb10
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial_8.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgcc_8.1.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgfortran_8.1.bb3
52 files changed, 3320 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-8.1.inc b/meta/recipes-devtools/gcc/gcc-8.1.inc
new file mode 100644
index 0000000000..ecc1ceff99
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1.inc
@@ -0,0 +1,124 @@
+require gcc-common.inc
+
+# Third digit in PV should be incremented after a minor release
+
+PV = "8.1.0"
+
+# BINV should be incremented to a revision after a minor gcc release
+
+BINV = "8.1.0"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-8.1:${FILE_DIRNAME}/gcc-8.1/backport:"
+
+DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native"
+
+LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
+
+LIC_FILES_CHKSUM = "\
+ file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+ file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
+"
+
+#RELEASE = "8.0.1-RC-20180427"
+BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
+#SRCREV = "f7cf798b73fd1a07098f9a490deec1e2a36e0bed"
+#BASEURI ?= "git://github.com/gcc-mirror/gcc;branch=gcc-6-branch;protocol=git"
+#BASEURI ?= "http://mirrors.concertpass.com/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
+
+SRC_URI = "\
+ ${BASEURI} \
+ file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
+ file://0002-c99-snprintf.patch \
+ file://0003-gcc-poison-system-directories.patch \
+ file://0004-gcc-poison-dir-extend.patch \
+ file://0005-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
+ file://0006-64-bit-multilib-hack.patch \
+ file://0007-optional-libstdc.patch \
+ file://0008-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
+ file://0009-COLLECT_GCC_OPTIONS.patch \
+ file://0010-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
+ file://0011-fortran-cross-compile-hack.patch \
+ file://0012-cpp-honor-sysroot.patch \
+ file://0013-MIPS64-Default-to-N64-ABI.patch \
+ file://0014-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
+ file://0015-gcc-Fix-argument-list-too-long-error.patch \
+ file://0016-Disable-sdt.patch \
+ file://0017-libtool.patch \
+ file://0018-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
+ file://0019-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
+ file://0020-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
+ file://0021-export-CPP.patch \
+ file://0022-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch \
+ file://0023-Ensure-target-gcc-headers-can-be-included.patch \
+ file://0024-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch \
+ file://0025-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
+ file://0026-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
+ file://0027-aarch64-Add-support-for-musl-ldso.patch \
+ file://0028-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
+ file://0029-handle-sysroot-support-for-nativesdk-gcc.patch \
+ file://0030-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
+ file://0031-Fix-various-_FOR_BUILD-and-related-variables.patch \
+ file://0032-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
+ file://0033-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
+ file://0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
+ file://0035-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
+ file://0036-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
+ file://0037-sync-gcc-stddef.h-with-musl.patch \
+ file://0038-fix-segmentation-fault-in-precompiled-header-generat.patch \
+ file://0039-Fix-for-testsuite-failure.patch \
+ ${BACKPORTS} \
+"
+BACKPORTS = "\
+"
+SRC_URI[md5sum] = "65f7c65818dc540b3437605026d329fc"
+SRC_URI[sha256sum] = "1d1866f992626e61349a1ccd0b8d5253816222cdc13390dcfaa74b093aa2b153"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
+#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+LTO = "--enable-lto"
+
+EXTRA_OECONF_BASE = "\
+ ${LTO} \
+ --enable-libssp \
+ --enable-libitm \
+ --disable-bootstrap \
+ --disable-libmudflap \
+ --with-system-zlib \
+ ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
+ --enable-linker-build-id \
+ --with-ppl=no \
+ --with-cloog=no \
+ --enable-checking=release \
+ --enable-cheaders=c_global \
+ --without-isl \
+"
+
+EXTRA_OECONF_INITIAL = "\
+ --disable-libmudflap \
+ --disable-libgomp \
+ --disable-libitm \
+ --disable-libquadmath \
+ --with-system-zlib \
+ --disable-lto \
+ --disable-plugin \
+ --enable-decimal-float=no \
+ --without-isl \
+ gcc_cv_libc_provides_ssp=yes \
+"
+
+EXTRA_OECONF_PATHS = "\
+ --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
+ --with-sysroot=/not/exist \
+ --with-build-sysroot=${STAGING_DIR_TARGET} \
+"
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-8.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..423fe28e11
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,42 @@
+From b752fb2b6d6f6da68da5386b96abf0d74cd4bbe6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 08:37:11 +0400
+Subject: [PATCH 01/39] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+---
+ configure | 2 +-
+ configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index 69c99e99cca..517fb70192e 100755
+--- a/configure
++++ b/configure
+@@ -7511,7 +7511,7 @@ fi
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
+diff --git a/configure.ac b/configure.ac
+index a1edc369a27..f8c254f1fac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3100,7 +3100,7 @@ fi
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
+--
+2.17.0
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0002-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-8.1/0002-c99-snprintf.patch
new file mode 100644
index 0000000000..aa123b41a1
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1/0002-c99-snprintf.patch
@@ -0,0 +1,28 @@
+From 5fbfcf247ed6dd01263639daf0c9c3a291e2fd3a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 08:49:03 +0400
+Subject: [PATCH 02/39] c99-snprintf
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/include/c_std/cstdio | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
+index 1b9571eaa8d..ad816be4fd1 100644
+--- a/libstdc++-v3/include/c_std/cstdio
++++ b/libstdc++-v3/include/c_std/cstdio
+@@ -144,7 +144,7 @@ namespace std
+ using ::vsprintf;
+ } // namespace std
+
+-#if _GLIBCXX_USE_C99_STDIO
++#if _GLIBCXX_USE_C99_STDIO || defined(__UCLIBC__)
+
+ #undef snprintf
+ #undef vfscanf
+--
+2.17.0
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0003-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-8.1/0003-gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..1839d4c7b8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1/0003-gcc-poison-system-directories.patch
@@ -0,0 +1,192 @@
+From 48c670d2678e0323d88eb72205e039f393cabe05 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 08:59:00 +0400
+Subject: [PATCH 03/39] gcc: poison-system-directories
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+---
+ gcc/common.opt | 4 ++++
+ gcc/config.in | 6 ++++++
+ gcc/configure | 16 ++++++++++++++++
+ gcc/configure.ac | 10 ++++++++++
+ gcc/doc/invoke.texi | 9 +++++++++
+ gcc/gcc.c | 2 ++
+ gcc/incpath.c | 19 +++++++++++++++++++
+ 7 files changed, 66 insertions(+)
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+index d6ef85928f3..7b29efe3882 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -679,6 +679,10 @@ Wreturn-local-addr
+ Common Var(warn_return_local_addr) Init(1) Warning
+ Warn about returning a pointer/reference to a local or temporary variable.
+
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wshadow
+ Common Var(warn_shadow) Warning
+ Warn when one variable shadows another. Same as -Wshadow=global.
+diff --git a/gcc/config.in b/gcc/config.in
+index 5bccb408016..1c784a8276b 100644
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -194,6 +194,12 @@
+ #endif
+
+
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+ This is quite expensive. */
+diff --git a/gcc/configure b/gcc/configure
+index 5c345ce0fd7..cafd05fd150 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -953,6 +953,7 @@ with_system_zlib
+ enable_maintainer_mode
+ enable_link_mutex
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_host_shared
+ enable_libquadmath_support
+@@ -1696,6 +1697,8 @@ Optional Features:
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+ --enable-host-shared build host code as shared libraries
+ --disable-libquadmath-support
+@@ -29715,6 +29718,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ 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
++
+ # Substitute configuration variables
+
+
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 65dbf1f2f80..dd5b38195ce 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -6341,6 +6341,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
+ [specify that runtime libraries should be
+ installed in a compiler-specific directory])])
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system header 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 header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 255149fcfb8..cb71b60fe3c 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -303,6 +303,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
+ -Wparentheses -Wno-pedantic-ms-format @gol
+ -Wplacement-new -Wplacement-new=@var{n} @gol
++-Wno-poison-system-directories @gol
+ -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
+ -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
+ -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
+@@ -5712,6 +5713,14 @@ made up of data only and thus requires no special treatment. But, for
+ most targets, it is made up of code and thus requires the stack to be
+ made executable in order for the program to work properly.
+
++@item -Wno-poison-system-directories
++@opindex Wno-poison-system-directories
++Do not warn for @option{-I} or @option{-L} options using system
++directories such as @file{/usr/include} when cross compiling. This
++option is intended for use in chroot environments when such
++directories contain the correct headers and libraries for the target
++system rather than the host.
++
+ @item -Wfloat-equal
+ @opindex Wfloat-equal
+ @opindex Wno-float-equal
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index a716f708259..02b3cd39fc2 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1037,6 +1037,8 @@ proper position among the other output files. */
+ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
++ %{Wno-poison-system-directories:--no-poison-system-directories} \
++ %{Werror=poison-system-directories:--error-poison-system-directories} \
+ %{static|no-pie|static-pie:} %{L*} %(mfwrap) %(link_libgcc) " \
+ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
+ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index b11c6a57939..e3b7a21966f 100644
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -26,6 +26,7 @@
+ #include "intl.h"
+ #include "incpath.h"
+ #include "cppdefault.h"
++#include "diagnostic-core.h"
+
+ /* Microsoft Windows does not natively support inodes.
+ VMS has non-numeric inodes. */
+@@ -393,6 +394,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
+ }
+ fprintf (stderr, _("End of search list.\n"));
+ }
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (flag_poison_system_directories)
++ {
++ struct cpp_dir *p;
++
++ for (p = heads[INC_QUOTE]; p; p = p->next)
++ {
++ if ((!strncmp (p->name, "/usr/include", 12))
++ || (!strncmp (p->name, "/usr/local/include", 18))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ warning (OPT_Wpoison_system_directories,
++ "include location \"%s\" is unsafe for "
++ "cross-compilation",
++ p->name);
++ }
++ }
++#endif
+ }
+
+ /* Use given -I paths for #include "..." but not #include <...>, and
+--
+2.17.0
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0004-gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-8.1/0004-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..1072d5b18f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1/0004-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
+From 97370eadcd10da5da529dfb734df56993ce24644 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 09:00:34 +0400
+Subject: [PATCH 04/39] gcc-poison-dir-extend
+
+Add /sw/include and /opt/include based on the original
+zecke-no-host-includes.patch patch. The original patch checked for
+/usr/include, /sw/include and /opt/include and then triggered a failure and
+aborted.
+
+Instead, we add the two missing items to the current scan. If the user
+wants this to be a failure, they can add "-Werror=poison-system-directories".
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/incpath.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index e3b7a21966f..9a457e02dd3 100644
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -404,7 +404,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18))
++ || (!strncmp (p->name, "/sw/include", 11))
++ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+--
+2.17.0
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0005-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-8.1/0005-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000000..8b1b9769a4
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.1/0005-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
+From ae3fe6e5e50937de6e4223ca90810187372a8cf5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 09:08:31 +0400
+Subject: [PATCH 05/39] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
+
+Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
+
+This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
+
+Other changes I had to do include:
+
+- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
+
+- passing the right CFLAGS to configure scripts as exported environment variables
+
+I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
+
+Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
+
+Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+---
+ configure | 32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+diff --git a/configure b/configure
+index 517fb70192e..acd2b97df40 100755
+--- a/configure
++++ b/configure
+@@ -6772,6 +6772,38 @@ fi
+
+
+
++# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
++# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
++# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
++# We want to ensure that TARGET libraries (which we know are built with
++# gcc) are built with "-O2 -g", so include those options when setting
++# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
++if test "x$CFLAGS_FOR_TARGET" = x; then
++ CFLAGS_FOR_TARGET=$CFLAGS
++ case " $CFLAGS " in
++ *" -O2 "*) ;;
++ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
++ esac
++ case " $CFLAGS " in
++ *" -g "* | *" -g3 "*) ;;
++ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
++ esac
++fi
++
++
++if test "x$CXXFLAGS_FOR_TARGET" = x; then
++ CXXFLAGS_FOR_TARGET=$CXXFLAGS
++ case " $CXXFLAGS " in
++ *" -O2 "*) ;;
++ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
++ esac
++ case " $CXXFLAGS " in
++ *" -g "* | *" -g3 "*) ;;
++ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
++ esac
++fi
++
++
+ # Handle --with-headers=XXX. If the value is not "yes", the contents of
+ # the named directory are copied to $(tooldir)/sys-include.
+ if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
+--
+2.17.0
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.1/0006-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-8.1/0006-64-bit-multilib-hack.patch
new file mode 100644
index 0000000000..0dce95c890
--- /dev/null
+++ b/