Yocto 2.5

Move OpenBMC to Yocto 2.5(sumo)

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4.inc
deleted file mode 100644
index 42eabef..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4.inc
+++ /dev/null
@@ -1,145 +0,0 @@
-require gcc-common.inc
-
-# Third digit in PV should be incremented after a minor release
-
-PV = "6.4.0"
-
-# BINV should be incremented to a revision after a minor gcc release
-
-BINV = "6.4.0"
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-6.4:${FILE_DIRNAME}/gcc-6.4/backport:"
-
-DEPENDS =+ "mpfr gmp libmpc zlib"
-NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-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 \
-"
-
-
-BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
-#SRCREV = "bd9a826d5448db11d29d2ec5884e7e679066f140"
-#BASEURI ?= "git://github.com/gcc-mirror/gcc;branch=gcc-6-branch;protocol=git"
-#BASEURI ?= "ftp://sourceware.org/pub/gcc/snapshots/6.2.0-RC-20160815/gcc-6.2.0-RC-20160815.tar.bz2"
-
-SRC_URI = "\
-           ${BASEURI} \
-           file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
-           file://0008-missing-execinfo_h.patch \
-           file://0009-c99-snprintf.patch \
-           file://0010-gcc-poison-system-directories.patch \
-           file://0011-gcc-poison-dir-extend.patch \
-           file://0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
-           file://0013-64-bit-multilib-hack.patch \
-           file://0014-optional-libstdc.patch \
-           file://0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
-           file://0016-COLLECT_GCC_OPTIONS.patch \
-           file://0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
-           file://0018-fortran-cross-compile-hack.patch \
-           file://0019-cpp-honor-sysroot.patch \
-           file://0020-MIPS64-Default-to-N64-ABI.patch \
-           file://0021-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
-           file://0022-gcc-Fix-argument-list-too-long-error.patch \
-           file://0023-Disable-sdt.patch \
-           file://0024-libtool.patch \
-           file://0025-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
-           file://0026-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
-           file://0027-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
-           file://0028-export-CPP.patch \
-           file://0029-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
-           file://0030-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch \
-           file://0031-Ensure-target-gcc-headers-can-be-included.patch \
-           file://0032-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch \
-           file://0033-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
-           file://0034-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
-           file://0035-aarch64-Add-support-for-musl-ldso.patch \
-           file://0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
-           file://0037-handle-sysroot-support-for-nativesdk-gcc.patch \
-           file://0038-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
-           file://0039-Fix-various-_FOR_BUILD-and-related-variables.patch \
-           file://0040-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
-           file://0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
-           file://0042-gcc-libcpp-support-ffile-prefix-map-old-new.patch \
-           file://0043-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \
-           file://0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch \
-           file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
-           file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
-           file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
-           file://0048-sync-gcc-stddef.h-with-musl.patch \
-           file://0054_all_nopie-all-flags.patch \
-           file://0055-unwind_h-glibc26.patch \
-           ${BACKPORTS} \
-"
-BACKPORTS = "\
-           file://CVE-2016-6131.patch \
-           file://0057-ARM-PR-82445-suppress-32-bit-aligned-ldrd-strd-peeph.patch \
-           file://0001-enable-FL_LPAE-flag-for-armv7ve-cores.patch \
-           file://0001-i386-Move-struct-ix86_frame-to-machine_function.patch \
-           file://0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch \
-           file://0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch \
-           file://0004-x86-Add-mindirect-branch.patch \
-           file://0005-x86-Add-mfunction-return.patch \
-           file://0006-x86-Add-mindirect-branch-register.patch \
-           file://0007-x86-Add-V-register-operand-modifier.patch \
-           file://0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch \
-           file://0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch \
-           file://0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch \
-           file://0011-i386-Update-mfunction-return-for-return-with-pop.patch \
-           file://0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch \
-           file://0013-gcc-sanitizers.patch \
-"
-
-SRC_URI[md5sum] = "11ba51a0cfb8471927f387c8895fe232"
-SRC_URI[sha256sum] = "850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4"
-
-S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
-#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
-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} \
-    --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/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
deleted file mode 100644
index 415f091..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 92ed30da16b7487b334f739be177eb39885ab772 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/46] 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 35f231e..bfadc33 100755
---- a/configure
-+++ b/configure
-@@ -7550,7 +7550,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 74bf58a..197d61b 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3149,7 +3149,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.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0008-missing-execinfo_h.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0008-missing-execinfo_h.patch
deleted file mode 100644
index 01e7c95..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0008-missing-execinfo_h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 6dde3da24ef4b9b357bca670d8551cab3fdda843 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 08:48:10 +0400
-Subject: [PATCH 08/46] missing-execinfo_h
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- boehm-gc/include/gc.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
-index 6b38f2d..fca98ff 100644
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
--     && !defined(__ia64__)
-+     && !defined(__ia64__) && !defined(__UCLIBC__)
- #   ifndef GC_HAVE_BUILTIN_BACKTRACE
- #     define GC_HAVE_BUILTIN_BACKTRACE
- #   endif
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0009-c99-snprintf.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0009-c99-snprintf.patch
deleted file mode 100644
index d62341a..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0009-c99-snprintf.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b794f1f1c1c7c06f3f0d78cf76c4fb90c2ab8dfb 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 09/46] 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 a4119ba..8396f43 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.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0010-gcc-poison-system-directories.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0010-gcc-poison-system-directories.patch
deleted file mode 100644
index ac4cf44..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0010-gcc-poison-system-directories.patch
+++ /dev/null
@@ -1,192 +0,0 @@
-From d76250323dad69212c958e4857a98d99ab51a39e 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 10/46] 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 67048db..733185c 100644
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -659,6 +659,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 local variable shadows another.
-diff --git a/gcc/config.in b/gcc/config.in
-index 115cb61..105b30f 100644
---- a/gcc/config.in
-+++ b/gcc/config.in
-@@ -187,6 +187,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 1c6e340..8f83152 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -942,6 +942,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
-@@ -1681,6 +1682,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
-@@ -28908,6 +28911,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 6c1dcd9..0fccaef 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -5861,6 +5861,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 821f8fd..8bb49e7 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -284,6 +284,7 @@ Objective-C and Objective-C++ Dialects}.
- -Wparentheses -Wno-pedantic-ms-format @gol
- -Wplacement-new -Wplacement-new=@var{n} @gol
- -Wpointer-arith  -Wno-pointer-to-int-cast @gol
-+-Wno-poison-system-directories @gol
- -Wno-pragmas -Wredundant-decls  -Wno-return-local-addr @gol
- -Wreturn-type  -Wsequence-point  -Wshadow  -Wno-shadow-ivar @gol
- -Wshift-overflow -Wshift-overflow=@var{n} @gol
-@@ -4723,6 +4724,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 1af5920..4cfef7f 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1017,6 +1017,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:} %{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 ea40f4a..856da41 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.  */
-@@ -381,6 +382,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[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.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0011-gcc-poison-dir-extend.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0011-gcc-poison-dir-extend.patch
deleted file mode 100644
index a1736ae..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0011-gcc-poison-dir-extend.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From a1c24b59def393e43cd50b6768604a212c788ed3 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 11/46] 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 856da41..d2fc82c 100644
---- a/gcc/incpath.c
-+++ b/gcc/incpath.c
-@@ -392,7 +392,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.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
deleted file mode 100644
index 939b070..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0012-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 00ef5f0f2a8d3b33aeb1e55c0d23439f4dd495af 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 12/46] 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 bfadc33..755d382 100755
---- a/configure
-+++ b/configure
-@@ -6819,6 +6819,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.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0013-64-bit-multilib-hack.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0013-64-bit-multilib-hack.patch
deleted file mode 100644
index e31cde4..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0013-64-bit-multilib-hack.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 7fc7a070ac53a55950a1eac76f02877d4106b4b3 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:10:06 +0400
-Subject: [PATCH 13/46] 64-bit multilib hack.
-
-GCC has internal multilib handling code but it assumes a very specific rigid directory
-layout. The build system implementation of multilib layout is very generic and allows
-complete customisation of the library directories.
-
-This patch is a partial solution to allow any custom directories to be passed into gcc
-and handled correctly. It forces gcc to use the base_libdir (which is the current
-directory, "."). We need to do this for each multilib that is configured as we don't
-know which compiler options may be being passed into the compiler. Since we have a compiler
-per mulitlib at this point that isn't an issue.
-
-The one problem is the target compiler is only going to work for the default multlilib at
-this point. Ideally we'd figure out which multilibs were being enabled with which paths
-and be able to patch these entries with a complete set of correct paths but this we
-don't have such code at this point. This is something the target gcc recipe should do
-and override these platform defaults in its build config.
-
-RP 15/8/11
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/config/i386/t-linux64   |  6 ++----
- gcc/config/mips/t-linux64   | 10 +++-------
- gcc/config/rs6000/t-linux64 |  5 ++---
- 3 files changed, 7 insertions(+), 14 deletions(-)
-
-diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
-index c0cc8a3..365a5d6 100644
---- a/gcc/config/i386/t-linux64
-+++ b/gcc/config/i386/t-linux64
-@@ -32,7 +32,5 @@
- #
- comma=,
- MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
--MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
--MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
--MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
--MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
-+MULTILIB_DIRNAMES = . .
-+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
-diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
-index 16c8adf..b932ace 100644
---- a/gcc/config/mips/t-linux64
-+++ b/gcc/config/mips/t-linux64
-@@ -17,10 +17,6 @@
- # <http://www.gnu.org/licenses/>.
- 
- MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
--MULTILIB_DIRNAMES = n32 32 64
--MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
--MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
--MULTILIB_OSDIRNAMES = \
--	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
--	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
--	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
-+MULTILIB_DIRNAMES = . . .
-+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
-+
-diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
-index fa7550b..9b5d9ef 100644
---- a/gcc/config/rs6000/t-linux64
-+++ b/gcc/config/rs6000/t-linux64
-@@ -26,10 +26,9 @@
- # MULTILIB_OSDIRNAMES according to what is found on the target.
- 
- MULTILIB_OPTIONS    := m64/m32
--MULTILIB_DIRNAMES   := 64 32
-+MULTILIB_DIRNAMES   := . .
- MULTILIB_EXTRA_OPTS := 
--MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
--MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
-+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
- 
- rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
- 	$(COMPILE) $<
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0014-optional-libstdc.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0014-optional-libstdc.patch
deleted file mode 100644
index 44b0cc7..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0014-optional-libstdc.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 36275f7981bdaf919bbc9b51a7c7fae1e192adb3 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:12:56 +0400
-Subject: [PATCH 14/46] optional libstdc
-
-gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
-will not run correctly since by default the linker will try to link against libstdc++
-which shouldn't exist yet. We need an option to disable -lstdc++
-option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
-driver. This patch adds such an option which only disables the -lstdc++.
-
-A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
-do this officially, the likely answer is don't build libstdc++ separately.
-
-RP 29/6/10
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [embedded specific]
----
- gcc/c-family/c.opt  |  4 ++++
- gcc/cp/g++spec.c    |  1 +
- gcc/doc/invoke.texi | 32 +++++++++++++++++++++++++++++++-
- gcc/gcc.c           |  1 +
- 4 files changed, 37 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
-index 4f86876..660da6c 100644
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1647,6 +1647,10 @@ nostdinc++
- C++ ObjC++
- Do not search standard system include directories for C++.
- 
-+nostdlib++
-+Driver
-+Do not link standard C++ runtime library
-+
- o
- C ObjC C++ ObjC++ Joined Separate
- ; Documented in common.opt
-diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
-index 03cbde0..3642540 100644
---- a/gcc/cp/g++spec.c
-+++ b/gcc/cp/g++spec.c
-@@ -137,6 +137,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
-       switch (decoded_options[i].opt_index)
- 	{
- 	case OPT_nostdlib:
-+	case OPT_nostdlib__:
- 	case OPT_nodefaultlibs:
- 	  library = -1;
- 	  break;
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 8bb49e7..84d68aa 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -207,6 +207,9 @@ in the following sections.
- -fno-weak  -nostdinc++ @gol
- -fvisibility-inlines-hidden @gol
- -fvisibility-ms-compat @gol
-+-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
-+-fvtv-counts -fvtv-debug @gol
-+-nostdlib++ @gol
- -fext-numeric-literals @gol
- -Wabi=@var{n}  -Wabi-tag  -Wconversion-null  -Wctor-dtor-privacy @gol
- -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
-@@ -470,7 +473,7 @@ Objective-C and Objective-C++ Dialects}.
- -s  -static -static-libgcc -static-libstdc++ @gol
- -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
- -static-libmpx -static-libmpxwrappers @gol
---shared -shared-libgcc  -symbolic @gol
-+-shared -shared-libgcc  -symbolic -nostdlib++ @gol
- -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
- -u @var{symbol} -z @var{keyword}}
- 
-@@ -10601,6 +10604,33 @@ library subroutines.
- constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
- GNU Compiler Collection (GCC) Internals}.)
- 
-+@item -nostdlib++
-+@opindex nostdlib++
-+Do not use the standard system C++ runtime libraries when linking.
-+Only the libraries you specify will be passed to the linker.
-+
-+@cindex @option{-lgcc}, use with @option{-nostdlib}
-+@cindex @option{-nostdlib} and unresolved references
-+@cindex unresolved references and @option{-nostdlib}
-+@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
-+@cindex @option{-nodefaultlibs} and unresolved references
-+@cindex unresolved references and @option{-nodefaultlibs}
-+One of the standard libraries bypassed by @option{-nostdlib} and
-+@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
-+which GCC uses to overcome shortcomings of particular machines, or special
-+needs for some languages.
-+(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
-+Collection (GCC) Internals},
-+for more discussion of @file{libgcc.a}.)
-+In most cases, you need @file{libgcc.a} even when you want to avoid
-+other standard libraries.  In other words, when you specify @option{-nostdlib}
-+or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
-+This ensures that you have no unresolved references to internal GCC
-+library subroutines.
-+(An example of such an internal subroutine is @code{__main}, used to ensure C++
-+constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
-+GNU Compiler Collection (GCC) Internals}.)
-+
- @item -pie
- @opindex pie
- Produce a position independent executable on targets that support it.
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 4cfef7f..da0b482 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1028,6 +1028,7 @@ proper position among the other output files.  */
-     %(mflib) " STACK_SPLIT_SPEC "\
-     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
-     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
-+    %{!nostdlib++:}\
-     %{!nostdlib:%{!nostartfiles:%E}} %{T*}  \n%(post_link) }}}}}}"
- #endif
- 
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
deleted file mode 100644
index 6fc7346..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0015-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 9346f6042d8f7f85a75ca2af15f3b8d234985165 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:14:20 +0400
-Subject: [PATCH 15/46] gcc: disable MASK_RELAX_PIC_CALLS bit
-
-The new feature added after 4.3.3
-"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
-will cause cc1plus eat up all the system memory when build webkit-gtk.
-The function mips_get_pic_call_symbol keeps on recursively calling itself.
-Disable this feature to walk aside the bug.
-
-Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [configuration]
----
- gcc/configure    | 7 -------
- gcc/configure.ac | 7 -------
- 2 files changed, 14 deletions(-)
-
-diff --git a/gcc/configure b/gcc/configure
-index 8f83152..5e72f17 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -27018,13 +27018,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
-         rm -f conftest.*
-       fi
-     fi
--    if test $gcc_cv_as_ld_jalr_reloc = yes; then
--      if test x$target_cpu_default = x; then
--        target_cpu_default=MASK_RELAX_PIC_CALLS
--      else
--        target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
--      fi
--    fi
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
- $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
- 
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 0fccaef..dd8f6fa 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -4522,13 +4522,6 @@ x:
-         rm -f conftest.*
-       fi
-     fi
--    if test $gcc_cv_as_ld_jalr_reloc = yes; then
--      if test x$target_cpu_default = x; then
--        target_cpu_default=MASK_RELAX_PIC_CALLS
--      else
--        target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
--      fi
--    fi
-     AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
- 
-     AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0016-COLLECT_GCC_OPTIONS.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0016-COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index c154864..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0016-COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 1033bc2d4efc5c301bb822b607a673f5b10cc69f Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:16:28 +0400
-Subject: [PATCH 16/46] COLLECT_GCC_OPTIONS
-
-This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
-invoke collect2.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/gcc.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index da0b482..7ca129f 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -4591,6 +4591,15 @@ set_collect_gcc_options (void)
- 		sizeof ("COLLECT_GCC_OPTIONS=") - 1);
- 
-   first_time = TRUE;
-+#ifdef HAVE_LD_SYSROOT
-+  if (target_system_root_changed && target_system_root)
-+    {
-+      obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
-+      obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
-+      obstack_grow (&collect_obstack, "'", 1);
-+      first_time = FALSE;
-+    }
-+#endif
-   for (i = 0; (int) i < n_switches; i++)
-     {
-       const char *const *args;
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
deleted file mode 100644
index 0dbabd9..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0017-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 67123a306880af997a99ae514677c2da4973bd1a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:17:25 +0400
-Subject: [PATCH 17/46] Use the defaults.h in ${B} instead of ${S}, and t-oe in
- ${B}
-
-Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
-the source can be shared between gcc-cross-initial,
-gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
-
-While compiling gcc-crosssdk-initial-x86_64 on some host, there is
-occasionally failure that test the existance of default.h doesn't
-work, the reason is tm_include_list='** defaults.h' rather than
-tm_include_list='** ./defaults.h'
-
-So we add the test condition for this situation.
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- gcc/Makefile.in  | 2 +-
- gcc/configure    | 4 ++--
- gcc/configure.ac | 4 ++--
- gcc/mkconfig.sh  | 4 ++--
- 4 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 6c5adc0..9a1d466 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -517,7 +517,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
- TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
- 
- xmake_file=@xmake_file@
--tmake_file=@tmake_file@
-+tmake_file=@tmake_file@ ./t-oe
- TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
- TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
- TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
-diff --git a/gcc/configure b/gcc/configure
-index 5e72f17..389b6d5 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -12130,8 +12130,8 @@ for f in $tm_file; do
-        tm_include_list="${tm_include_list} $f"
-        ;;
-     defaults.h )
--       tm_file_list="${tm_file_list} \$(srcdir)/$f"
--       tm_include_list="${tm_include_list} $f"
-+       tm_file_list="${tm_file_list} ./$f"
-+       tm_include_list="${tm_include_list} ./$f"
-        ;;
-     * )
-        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index dd8f6fa..91ac800 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -1883,8 +1883,8 @@ for f in $tm_file; do
-        tm_include_list="${tm_include_list} $f"
-        ;;
-     defaults.h )
--       tm_file_list="${tm_file_list} \$(srcdir)/$f"
--       tm_include_list="${tm_include_list} $f"
-+       tm_file_list="${tm_file_list} ./$f"
-+       tm_include_list="${tm_include_list} ./$f"
-        ;;
-     * )
-        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
-diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
-index 67dfac6..b73e08d 100644
---- a/gcc/mkconfig.sh
-+++ b/gcc/mkconfig.sh
-@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
-     if [ $# -ge 1 ]; then
- 	echo '#ifdef IN_GCC' >> ${output}T
- 	for file in "$@"; do
--	    if test x"$file" = x"defaults.h"; then
-+	    if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
- 		postpone_defaults_h="yes"
- 	    else
- 		echo "# include \"$file\"" >> ${output}T
-@@ -109,7 +109,7 @@ esac
- 
- # If we postponed including defaults.h, add the #include now.
- if test x"$postpone_defaults_h" = x"yes"; then
--    echo "# include \"defaults.h\"" >> ${output}T
-+    echo "# include \"./defaults.h\"" >> ${output}T
- fi
- 
- # Add multiple inclusion protection guard, part two.
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0018-fortran-cross-compile-hack.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0018-fortran-cross-compile-hack.patch
deleted file mode 100644
index b43d89e..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0018-fortran-cross-compile-hack.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From e360dc3e0f1e0b9b001ef722fcf66f8120a03dbc Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:20:01 +0400
-Subject: [PATCH 18/46] fortran cross-compile hack.
-
-* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
-used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
-directory.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [embedded specific]
----
- libgfortran/configure    | 2 +-
- libgfortran/configure.ac | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libgfortran/configure b/libgfortran/configure
-index f746f6f..b4f3278 100755
---- a/libgfortran/configure
-+++ b/libgfortran/configure
-@@ -12734,7 +12734,7 @@ esac
- 
- # We need gfortran to compile parts of the library
- #AC_PROG_FC(gfortran)
--FC="$GFORTRAN"
-+#FC="$GFORTRAN"
- ac_ext=${ac_fc_srcext-f}
- ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
- ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
-index 8f377bb..67710b5 100644
---- a/libgfortran/configure.ac
-+++ b/libgfortran/configure.ac
-@@ -240,7 +240,7 @@ AC_SUBST(enable_static)
- 
- # We need gfortran to compile parts of the library
- #AC_PROG_FC(gfortran)
--FC="$GFORTRAN"
-+#FC="$GFORTRAN"
- AC_PROG_FC(gfortran)
- 
- # extra LD Flags which are required for targets
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0019-cpp-honor-sysroot.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0019-cpp-honor-sysroot.patch
deleted file mode 100644
index 417a5ed..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0019-cpp-honor-sysroot.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 98d9c0c1b5552294b2130f7304bfb522da323442 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:22:00 +0400
-Subject: [PATCH 19/46] cpp: honor sysroot.
-
-Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
-preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
-rather than the --sysroot option specified on the commandline. If access to that directory is
-permission denied (unreadable), gcc will error.
-
-This happens when ccache is in use due to the fact it uses preprocessed source files.
-
-The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
--isystem, -isysroot happen and the correct sysroot is used.
-
-[YOCTO #2074]
-
-RP 2012/04/13
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/cp/lang-specs.h | 2 +-
- gcc/gcc.c           | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
-index 9707fac..fe487a2 100644
---- a/gcc/cp/lang-specs.h
-+++ b/gcc/cp/lang-specs.h
-@@ -64,5 +64,5 @@ along with GCC; see the file COPYING3.  If not see
-   {".ii", "@c++-cpp-output", 0, 0, 0},
-   {"@c++-cpp-output",
-    "%{!M:%{!MM:%{!E:\
--    cc1plus -fpreprocessed %i %(cc1_options) %2\
-+    cc1plus -fpreprocessed %i %I %(cc1_options) %2\
-     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 7ca129f..04fa81d 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1329,7 +1329,7 @@ static const struct compiler default_compilers[] =
- 					   %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
-   {".i", "@cpp-output", 0, 0, 0},
-   {"@cpp-output",
--   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-+   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-   {".s", "@assembler", 0, 0, 0},
-   {"@assembler",
-    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0020-MIPS64-Default-to-N64-ABI.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0020-MIPS64-Default-to-N64-ABI.patch
deleted file mode 100644
index ba612f5..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0020-MIPS64-Default-to-N64-ABI.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 1f15447fbcf65142627af8a9694761534da8d0d1 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:23:08 +0400
-Subject: [PATCH 20/46] MIPS64: Default to N64 ABI
-
-MIPS64 defaults to n32 ABI, this patch makes it
-so that it defaults to N64 ABI
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [OE config specific]
----
- gcc/config.gcc | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index f66e48c..9c6d156 100644
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -2065,29 +2065,29 @@ mips*-*-linux*)				# Linux MIPS, either endian.
- 			default_mips_arch=mips32
- 			;;
- 		mips64el-st-linux-gnu)
--			default_mips_abi=n32
-+			default_mips_abi=64
- 			tm_file="${tm_file} mips/st.h"
- 			tmake_file="${tmake_file} mips/t-st"
- 			enable_mips_multilibs="yes"
- 			;;
- 		mips64octeon*-*-linux*)
--			default_mips_abi=n32
-+			default_mips_abi=64
- 			tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
- 			target_cpu_default=MASK_SOFT_FLOAT_ABI
- 			enable_mips_multilibs="yes"
- 			;;
- 		mipsisa64r6*-*-linux*)
--			default_mips_abi=n32
-+			default_mips_abi=64
- 			default_mips_arch=mips64r6
- 			enable_mips_multilibs="yes"
- 			;;
- 		mipsisa64r2*-*-linux*)
--			default_mips_abi=n32
-+			default_mips_abi=64
- 			default_mips_arch=mips64r2
- 			enable_mips_multilibs="yes"
- 			;;
- 		mips64*-*-linux* | mipsisa64*-*-linux*)
--			default_mips_abi=n32
-+			default_mips_abi=64
- 			enable_mips_multilibs="yes"
- 			;;
- 	esac
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0021-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0021-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
deleted file mode 100644
index 6675ce3..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0021-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ /dev/null
@@ -1,234 +0,0 @@
-From 9f73c8918b63e6a1c9b79384fac411d1056eec1c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:24:50 +0400
-Subject: [PATCH 21/46] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
- relative to SYSTEMLIBS_DIR
-
-This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
-relative to SYSTEMLIBS_DIR which can be set in generated headers
-This breaks the assumption of hardcoded multilib in gcc
-Change is only for the supported architectures in OE including
-SH, sparc, alpha for possible future support (if any)
-
-Removes the do_headerfix task in metadata
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [OE configuration]
----
- gcc/config/alpha/linux-elf.h |  4 ++--
- gcc/config/arm/linux-eabi.h  |  4 ++--
- gcc/config/arm/linux-elf.h   |  2 +-
- gcc/config/i386/linux.h      |  2 +-
- gcc/config/i386/linux64.h    |  6 +++---
- gcc/config/linux.h           |  8 ++++----
- gcc/config/mips/linux.h      | 12 ++++++------
- gcc/config/rs6000/linux64.h  | 16 ++++++----------
- gcc/config/sh/linux.h        |  2 +-
- gcc/config/sparc/linux.h     |  2 +-
- gcc/config/sparc/linux64.h   |  4 ++--
- 11 files changed, 29 insertions(+), 33 deletions(-)
-
-diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
-index a0764d3..02f7a7c 100644
---- a/gcc/config/alpha/linux-elf.h
-+++ b/gcc/config/alpha/linux-elf.h
-@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  If not see
- #define EXTRA_SPECS \
- { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
- 
--#define GLIBC_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
--#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-+#define GLIBC_DYNAMIC_LINKER	SYSTEMLIBS_DIR "ld-linux.so.2"
-+#define UCLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-uClibc.so.0"
- #if DEFAULT_LIBC == LIBC_UCLIBC
- #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
- #elif DEFAULT_LIBC == LIBC_GLIBC
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
-index ace8481..4010435 100644
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -68,8 +68,8 @@
-    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
- 
- #undef  GLIBC_DYNAMIC_LINKER
--#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
--#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
-+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
-+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
- #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
- 
- #define GLIBC_DYNAMIC_LINKER \
-diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
-index a94bd2d..0220628 100644
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -62,7 +62,7 @@
- 
- #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
- 
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
- 
- #define LINUX_TARGET_LINK_SPEC  "%{h*} \
-    %{static:-Bstatic} \
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
-index d37a875..edde586 100644
---- a/gcc/config/i386/linux.h
-+++ b/gcc/config/i386/linux.h
-@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.  If not see
- <http://www.gnu.org/licenses/>.  */
- 
- #define GNU_USER_LINK_EMULATION "elf_i386"
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
- 
- #undef MUSL_DYNAMIC_LINKER
- #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
-index 73d22e3..f4b5615 100644
---- a/gcc/config/i386/linux64.h
-+++ b/gcc/config/i386/linux64.h
-@@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
- #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
- 
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
--#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
--#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
-+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
-+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
- 
- #undef MUSL_DYNAMIC_LINKER32
- #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
-index 9aeeb94..b055652 100644
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -81,10 +81,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
-    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
-    supporting both 32-bit and 64-bit compilation.  */
--#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
--#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
--#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
--#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
- #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
- #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
- #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
-index fa253b6..da02c8d 100644
---- a/gcc/config/mips/linux.h
-+++ b/gcc/config/mips/linux.h
-@@ -22,20 +22,20 @@ along with GCC; see the file COPYING3.  If not see
- #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
- 
- #define GLIBC_DYNAMIC_LINKER32 \
--  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
- #define GLIBC_DYNAMIC_LINKER64 \
--  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
- #define GLIBC_DYNAMIC_LINKERN32 \
--  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
- 
- #undef UCLIBC_DYNAMIC_LINKER32
- #define UCLIBC_DYNAMIC_LINKER32 \
--  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
- #undef UCLIBC_DYNAMIC_LINKER64
- #define UCLIBC_DYNAMIC_LINKER64 \
--  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
- #define UCLIBC_DYNAMIC_LINKERN32 \
--  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
-+  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
- 
- #undef MUSL_DYNAMIC_LINKER32
- #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
-diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
-index fefa0c4..7173938 100644
---- a/gcc/config/rs6000/linux64.h
-+++ b/gcc/config/rs6000/linux64.h
-@@ -412,16 +412,11 @@ extern int dot_symbols;
- #undef	LINK_OS_DEFAULT_SPEC
- #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
- 
--#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
--
-+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
- #ifdef LINUX64_DEFAULT_ABI_ELFv2
--#define GLIBC_DYNAMIC_LINKER64 \
--"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
--":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
-+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
- #else
--#define GLIBC_DYNAMIC_LINKER64 \
--"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
--":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
-+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
- #endif
- 
- #define MUSL_DYNAMIC_LINKER32 \
-@@ -429,8 +424,9 @@ extern int dot_symbols;
- #define MUSL_DYNAMIC_LINKER64 \
-   "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
- 
--#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
--#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
-+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
-+
- #if DEFAULT_LIBC == LIBC_UCLIBC
- #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
-   "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
-diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
-index 2a036ac..50fb735 100644
---- a/gcc/config/sh/linux.h
-+++ b/gcc/config/sh/linux.h
-@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3.  If not see
-   "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
-   "%{mfdpic:-fdpic}.so.1"
- 
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
- 
- #undef SUBTARGET_LINK_EMUL_SUFFIX
- #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
-diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
-index 9b32577..7bd66de 100644
---- a/gcc/config/sparc/linux.h
-+++ b/gcc/config/sparc/linux.h
-@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
-    When the -shared link option is used a final link is not being
-    done.  */
- 
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
- 
- #undef  LINK_SPEC
- #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
-diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
-index a1ef325..3bae3d5 100644
---- a/gcc/config/sparc/linux64.h
-+++ b/gcc/config/sparc/linux64.h
-@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3.  If not see
-    When the -shared link option is used a final link is not being
-    done.  */
- 
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
--#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
-+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
- 
- #ifdef SPARC_BI_ARCH
- 
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0022-gcc-Fix-argument-list-too-long-error.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0022-gcc-Fix-argument-list-too-long-error.patch
deleted file mode 100644
index fab6e4a..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0022-gcc-Fix-argument-list-too-long-error.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From acce5157f6b3a1dc9a3676b7118ac887dc5693be Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:26:37 +0400
-Subject: [PATCH 22/46] gcc: Fix argument list too long error.
-
-There would be an "Argument list too long" error when the
-build directory is longer than 200, this is caused by:
-
-headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
-
-The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
-it, use the $(sort list) of GNU make which can handle the too long list
-would fix the problem, the header would be short enough after sorted.
-The "tr ' ' '\012'" was used for translating the space to "\n", the
-$(sort list) doesn't need this.
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 9a1d466..450cb79 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3349,7 +3349,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
- # We keep the directory structure for files in config or c-family and .def
- # files. All other files are flattened to a single directory.
- 	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
--	headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
-+	headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \
- 	srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
- 	for file in $$headers; do \
- 	  if [ -f $$file ] ; then \
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0023-Disable-sdt.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0023-Disable-sdt.patch
deleted file mode 100644
index 0efd890..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0023-Disable-sdt.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 6573aec00ada35c48c1838c8491ce8f7798ae993 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:28:10 +0400
-Subject: [PATCH 23/46] Disable sdt.
-
-We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
-It may or may not exist from preivous builds though. To be determinstic, disable
-sdt.h usage always. This avoids build failures if the header is removed after configure
-but before libgcc is compiled for example.
-
-RP 2012/8/7
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Disable sdt for libstdc++-v3.
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-
-Upstream-Status: Inappropriate [hack]
----
- gcc/configure             | 12 ++++++------
- gcc/configure.ac          | 18 +++++++++---------
- libstdc++-v3/configure    |  6 +++---
- libstdc++-v3/configure.ac |  2 +-
- 4 files changed, 19 insertions(+), 19 deletions(-)
-
-diff --git a/gcc/configure b/gcc/configure
-index 389b6d5..73c264d 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -28528,12 +28528,12 @@ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
- $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
- have_sys_sdt_h=no
--if test -f $target_header_dir/sys/sdt.h; then
--  have_sys_sdt_h=yes
--
--$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
--
--fi
-+#if test -f $target_header_dir/sys/sdt.h; then
-+#  have_sys_sdt_h=yes
-+#
-+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
-+#
-+#fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
- $as_echo "$have_sys_sdt_h" >&6; }
- 
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 91ac800..cecf121 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -5514,15 +5514,15 @@ fi
- AC_SUBST([enable_default_ssp])
- 
- # Test for <sys/sdt.h> on the target.
--GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
--AC_MSG_CHECKING(sys/sdt.h in the target C library)
--have_sys_sdt_h=no
--if test -f $target_header_dir/sys/sdt.h; then
--  have_sys_sdt_h=yes
--  AC_DEFINE(HAVE_SYS_SDT_H, 1,
--            [Define if your target C library provides sys/sdt.h])
--fi
--AC_MSG_RESULT($have_sys_sdt_h)
-+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
-+#AC_MSG_CHECKING(sys/sdt.h in the target C library)
-+#have_sys_sdt_h=no
-+#if test -f $target_header_dir/sys/sdt.h; then
-+#  have_sys_sdt_h=yes
-+#  AC_DEFINE(HAVE_SYS_SDT_H, 1,
-+#            [Define if your target C library provides sys/sdt.h])
-+#fi
-+#AC_MSG_RESULT($have_sys_sdt_h)
- 
- # Check if TFmode long double should be used by default or not.
- # Some glibc targets used DFmode long double, but with glibc 2.4
-diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
-index 8a5481c..6a40e92 100755
---- a/libstdc++-v3/configure
-+++ b/libstdc++-v3/configure
-@@ -21735,11 +21735,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
- ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
- ac_compiler_gnu=$ac_cv_c_compiler_gnu
- 
--  if test $glibcxx_cv_sys_sdt_h = yes; then
-+#  if test $glibcxx_cv_sys_sdt_h = yes; then
- 
--$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
-+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
- 
--  fi
-+#  fi
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
- $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
- 
-diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
-index 9e19e99..0077ffd 100644
---- a/libstdc++-v3/configure.ac
-+++ b/libstdc++-v3/configure.ac
-@@ -230,7 +230,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
- GLIBCXX_CHECK_SC_NPROC_ONLN
- GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
- GLIBCXX_CHECK_SYSCTL_HW_NCPU
--GLIBCXX_CHECK_SDT_H
-+#GLIBCXX_CHECK_SDT_H
- 
- # Check for available headers.
- AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0024-libtool.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0024-libtool.patch
deleted file mode 100644
index 1f73b5d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0024-libtool.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 6c0aa5c2538829248547197718037ff0b9788676 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:29:11 +0400
-Subject: [PATCH 24/46] libtool
-
-libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
-when running on am x86_64 build host.
-
-This patch stops this speading to libdir in the libstdc++.la file within libtool.
-Arguably, it shouldn't be passing this into libtool in the first place but
-for now this resolves the nastiest problems this causes.
-
-func_normal_abspath would resolve an empty path to `pwd` so we need
-to filter the zero case.
-
-RP 2012/8/24
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- ltmain.sh | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/ltmain.sh b/ltmain.sh
-index 9503ec8..0121fba 100644
---- a/ltmain.sh
-+++ b/ltmain.sh
-@@ -6359,6 +6359,10 @@ func_mode_link ()
- 	func_warning "ignoring multiple \`-rpath's for a libtool library"
- 
-       install_libdir="$1"
-+      if test -n "$install_libdir"; then
-+	func_normal_abspath "$install_libdir"
-+	install_libdir=$func_normal_abspath_result
-+      fi
- 
-       oldlibs=
-       if test -z "$rpath"; then
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0025-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0025-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
deleted file mode 100644
index 3b7ee49..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0025-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From b1263a48553ce75f8c3bed4fe12122af57845567 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:30:32 +0400
-Subject: [PATCH 25/46] gcc: armv4: pass fix-v4bx to linker to support EABI.
-
-The LINK_SPEC for linux gets overwritten by linux-eabi.h which
-means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
-the option is not passed to linker when chosing march=armv4
-This patch redefines this in linux-eabi.h and reinserts it
-for eabi defaulting toolchains.
-
-We might want to send it upstream.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/config/arm/linux-eabi.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
-index 4010435..aaea1c9 100644
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -94,10 +94,14 @@
- #define MUSL_DYNAMIC_LINKER \
-   "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
- 
-+/* For armv4 we pass --fix-v4bx to linker to support EABI */
-+#undef TARGET_FIX_V4BX_SPEC
-+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
-    use the GNU/Linux version, not the generic BPABI version.  */
- #undef  LINK_SPEC
--#define LINK_SPEC EABI_LINK_SPEC					\
-+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC			\
-   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,				\
- 		       LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
- 
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0026-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0026-Use-the-multilib-config-files-from-B-instead-of-usin.patch
deleted file mode 100644
index be25be6..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0026-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From b5c305fc251299f2e328410b18cfb55c75b5f038 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:33:04 +0400
-Subject: [PATCH 26/46] Use the multilib config files from ${B} instead of
- using the ones from ${S}
-
-Use the multilib config files from ${B} instead of using the ones from ${S}
-so that the source can be shared between gcc-cross-initial,
-gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
-
-Upstream-Status: Inappropriate [configuration]
----
- gcc/configure    | 22 ++++++++++++++++++----
- gcc/configure.ac | 22 ++++++++++++++++++----
- 2 files changed, 36 insertions(+), 8 deletions(-)
-
-diff --git a/gcc/configure b/gcc/configure
-index 73c264d..377253e 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -12110,10 +12110,20 @@ done
- tmake_file_=
- for f in ${tmake_file}
- do
--	if test -f ${srcdir}/config/$f
--	then
--		tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
--	fi
-+  case $f in
-+    */t-linux64 )
-+       if test -f ./config/$f
-+       then
-+         tmake_file_="${tmake_file_} ./config/$f"
-+       fi
-+       ;;
-+    * )
-+       if test -f ${srcdir}/config/$f
-+       then
-+         tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
-+       fi
-+       ;;
-+  esac
- done
- tmake_file="${tmake_file_}"
- 
-@@ -12124,6 +12134,10 @@ tm_file_list="options.h"
- tm_include_list="options.h insn-constants.h"
- for f in $tm_file; do
-   case $f in
-+    */linux64.h )
-+       tm_file_list="${tm_file_list} ./config/$f"
-+       tm_include_list="${tm_include_list} ./config/$f"
-+       ;;
-     ./* )
-        f=`echo $f | sed 's/^..//'`
-        tm_file_list="${tm_file_list} $f"
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index cecf121..54e7619 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -1863,10 +1863,20 @@ done
- tmake_file_=
- for f in ${tmake_file}
- do
--	if test -f ${srcdir}/config/$f
--	then
--		tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
--	fi
-+  case $f in
-+    */t-linux64 )
-+       if test -f ./config/$f
-+       then
-+         tmake_file_="${tmake_file_} ./config/$f"
-+       fi
-+       ;;
-+    * )
-+       if test -f ${srcdir}/config/$f
-+       then
-+         tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
-+       fi
-+       ;;
-+  esac
- done
- tmake_file="${tmake_file_}"
- 
-@@ -1877,6 +1887,10 @@ tm_file_list="options.h"
- tm_include_list="options.h insn-constants.h"
- for f in $tm_file; do
-   case $f in
-+    */linux64.h )
-+       tm_file_list="${tm_file_list} ./config/$f"
-+       tm_include_list="${tm_include_list} ./config/$f"
-+       ;;
-     ./* )
-        f=`echo $f | sed 's/^..//'`
-        tm_file_list="${tm_file_list} $f"
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0027-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0027-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
deleted file mode 100644
index d1bbebc..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0027-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From eb6178b7fb466ae429c56380c6dbc564a16d900a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 09:39:38 +0000
-Subject: [PATCH 27/46] Avoid using libdir from .la which usually points to a
- host path
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Jonathan Liu <net147@gmail.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- ltmain.sh | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/ltmain.sh b/ltmain.sh
-index 0121fba..52bdbdb 100644
---- a/ltmain.sh
-+++ b/ltmain.sh
-@@ -5628,6 +5628,9 @@ func_mode_link ()
- 	    absdir="$abs_ladir"
- 	    libdir="$abs_ladir"
- 	  else
-+	    # Instead of using libdir from .la which usually points to a host path,
-+	    # use the path the .la is contained in.
-+	    libdir="$abs_ladir"
- 	    dir="$libdir"
- 	    absdir="$libdir"
- 	  fi
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0028-export-CPP.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0028-export-CPP.patch
deleted file mode 100644
index c212539..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0028-export-CPP.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 617184f35e97934d9e6268e71378574e2b776c2b Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 09:40:59 +0000
-Subject: [PATCH 28/46] export CPP
-
-The OE environment sets and exports CPP as being the target gcc. When
-building gcc-cross-canadian for a mingw targetted sdk, the following can be found
-in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
-
-configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
-configure:3666: gcc  -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe  conftest.c >&5
-configure:3666: $? = 0
-configure:3698: result: no
-configure:3786: checking how to run the C preprocessor
-configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
-configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
-configure:3876: $? = 0
-
-Note this is a *build* target (in build-x86_64-linux) so it should be
-using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32
-headers are very different, using the wrong cpp is a real problem. It is leaking
-into configure through the CPP variable. Ultimately this leads to build
-failures related to not being able to include a process.h file for pem-unix.c.
-
-The fix is to ensure we export a sane CPP value into the build
-environment when using build targets. We could define a CPP_FOR_BUILD value which may be
-the version which needs to be upstreamed but for now, this fix is good enough to
-avoid the problem.
-
-RP 22/08/2013
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makefile.in | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Makefile.in b/Makefile.in
-index 1522e39..beb9b9a 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -149,6 +149,7 @@ BUILD_EXPORTS = \
- 	AR="$(AR_FOR_BUILD)"; export AR; \
- 	AS="$(AS_FOR_BUILD)"; export AS; \
- 	CC="$(CC_FOR_BUILD)"; export CC; \
-+	CPP="$(CC_FOR_BUILD) -E"; export CPP; \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
- 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0029-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0029-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
deleted file mode 100644
index 47b9c0d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0029-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From e140700976e3b7eb4250b1ffde9bc16494456903 Mon Sep 17 00:00:00 2001
-From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
-Date: Wed, 5 Feb 2014 16:52:31 +0200
-Subject: [PATCH 29/46] Enable SPE & AltiVec generation on powepc*linux target
-
-When is configured with --target=powerpc-linux, the resulting GCC will
-not be able to generate code for SPE targets (e500v1/v2).
-GCC configured with --target=powerpc-linuxspe will not be able to
-generate AltiVec instructions (for e6500).
-This patch modifies the configured file such that SPE or AltiVec code
-can be generated when gcc is configured with --target=powerpc-linux.
-The ABI and speciffic instructions can be selected through the
-"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
----
- gcc/config.gcc               | 9 ++++++++-
- gcc/config/rs6000/linuxspe.h | 3 ---
- 2 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 9c6d156..18cff5a 100644
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -2392,7 +2392,14 @@ powerpc-*-rtems*)
- 	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
- 	;;
- powerpc*-*-linux*)
--	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
-+	case ${target} in
-+	    powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
-+		tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
-+		;;
-+	    *)
-+		tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h"
-+		;;
-+	esac
- 	extra_options="${extra_options} rs6000/sysv4.opt"
- 	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
- 	extra_objs="$extra_objs rs6000-linux.o"
-diff --git a/gcc/config/rs6000/linuxspe.h b/gcc/config/rs6000/linuxspe.h
-index 35623cd..f74e00d 100644
---- a/gcc/config/rs6000/linuxspe.h
-+++ b/gcc/config/rs6000/linuxspe.h
-@@ -27,6 +27,3 @@
- #undef	TARGET_DEFAULT
- #define TARGET_DEFAULT MASK_STRICT_ALIGN
- #endif
--
--#undef  ASM_DEFAULT_SPEC
--#define	ASM_DEFAULT_SPEC "-mppc -mspe -me500"
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0030-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0030-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
deleted file mode 100644
index c09d019..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0030-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 0ddcb95a86830766fd02122f19384fc929b377c5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 10:21:55 +0000
-Subject: [PATCH 30/46] Disable the MULTILIB_OSDIRNAMES and other multilib
- options.
-
-Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
-systems where the libdir is NOT set to /lib64.  This is allowed by the
-ABI, as
-long as the dynamic loader is present in /lib.
-
-We simply want to use the default rules in gcc to find and configure the
-normal libdir.
-
-Upstream-Status: Inappropriate[OE-Specific]
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gcc/config/aarch64/t-aarch64-linux | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
-index 1cfe9f3..d688ac9 100644
---- a/gcc/config/aarch64/t-aarch64-linux
-+++ b/gcc/config/aarch64/t-aarch64-linux
-@@ -21,8 +21,8 @@
- LIB1ASMSRC   = aarch64/lib1funcs.asm
- LIB1ASMFUNCS = _aarch64_sync_cache_range
- 
--AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
--MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
--MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
-+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
-+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
- 
--MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
-+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0031-Ensure-target-gcc-headers-can-be-included.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0031-Ensure-target-gcc-headers-can-be-included.patch
deleted file mode 100644
index fb1cd0f..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0031-Ensure-target-gcc-headers-can-be-included.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From fc6621435a64a9d69aa251b70361da94cf2db6be Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 10:25:11 +0000
-Subject: [PATCH 31/46] Ensure target gcc headers can be included
-
-There are a few headers installed as part of the OpenEmbedded
-gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
-built for the target architecture, these are within the target
-sysroot and not cross/nativesdk; thus they weren't able to be
-found by gcc with the existing search paths. Add support for
-picking up these headers under the sysroot supplied on the gcc
-command line in order to resolve this.
-
-Upstream-Status: Pending
-
-Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gcc/Makefile.in  | 2 ++
- gcc/cppdefault.c | 4 ++++
- gcc/defaults.h   | 9 +++++++++
- gcc/gcc.c        | 7 -------
- 4 files changed, 15 insertions(+), 7 deletions(-)
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 450cb79..cc75536 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -593,6 +593,7 @@ libexecdir = @libexecdir@
- 
- # Directory in which the compiler finds libraries etc.
- libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
-+libsubdir_target = gcc/$(target_noncanonical)/$(version)
- # Directory in which the compiler finds executables
- libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
- # Directory in which all plugin resources are installed
-@@ -2688,6 +2689,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
- 
- PREPROCESSOR_DEFINES = \
-   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
-+  -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
-   -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-   -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
-diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
-index 54aaf06..7b4dd51 100644
---- a/gcc/cppdefault.c
-+++ b/gcc/cppdefault.c
-@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
-     /* This is the dir for gcc's private headers.  */
-     { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
- #endif
-+#ifdef GCC_INCLUDE_SUBDIR_TARGET
-+    /* This is the dir for gcc's private headers under the specified sysroot.  */
-+    { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
-+#endif
- #ifdef LOCAL_INCLUDE_DIR
-     /* /usr/local/include comes before the fixincluded header files.  */
-     { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
-diff --git a/gcc/defaults.h b/gcc/defaults.h
-index 3e18338..0f317f2 100644
---- a/gcc/defaults.h
-+++ b/gcc/defaults.h
-@@ -1492,4 +1492,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
- #endif
- 
-+/* Default prefixes to attach to command names.  */
-+
-+#ifndef STANDARD_STARTFILE_PREFIX_1
-+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
-+#endif
-+#ifndef STANDARD_STARTFILE_PREFIX_2
-+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
-+#endif
-+
- #endif  /* ! GCC_DEFAULTS_H */
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 04fa81d..9750cc2 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1450,13 +1450,6 @@ static const char *gcc_libexec_prefix;
- 
- /* Default prefixes to attach to command names.  */
- 
--#ifndef STANDARD_STARTFILE_PREFIX_1
--#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
--#endif
--#ifndef STANDARD_STARTFILE_PREFIX_2
--#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
--#endif
--
- #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
- #undef MD_EXEC_PREFIX
- #undef MD_STARTFILE_PREFIX
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0032-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0032-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
deleted file mode 100644
index c0b001d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0032-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From ff939c5063d8f8d444bdb25651a0a48e608efaa4 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 11:17:19 +0000
-Subject: [PATCH 32/46] gcc 4.8+ won't build with --disable-dependency-tracking
-
-since the *.Ppo files don't get created unless --enable-dependency-tracking is true.
-
-This patch ensures we only use those compiler options when its enabled.
-
-Upstream-Status: Submitted
-
-(Problem was already reported upstream, attached this patch there
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
-
-RP
-2012/09/22
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- libatomic/Makefile.am | 3 ++-
- libatomic/Makefile.in | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
-index b351244..399ce18 100644
---- a/libatomic/Makefile.am
-+++ b/libatomic/Makefile.am
-@@ -101,7 +101,8 @@ PAT_S		= $(word 3,$(PAT_SPLIT))
- IFUNC_DEF	= -DIFUNC_ALT=$(PAT_S)
- IFUNC_OPT	= $(word $(PAT_S),$(IFUNC_OPTIONS))
- 
--M_DEPS		= -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
-+@AMDEP_TRUE@M_DEPS		= -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
-+@AMDEP_FALSE@M_DEPS		=
- M_SIZE		= -DN=$(PAT_N)
- M_IFUNC		= $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
- M_FILE		= $(PAT_BASE)_n.c
-diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
-index a083d87..a92cfce 100644
---- a/libatomic/Makefile.in
-+++ b/libatomic/Makefile.in
-@@ -330,7 +330,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
- PAT_S = $(word 3,$(PAT_SPLIT))
- IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
- IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
--M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
-+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
-+@AMDEP_FALSE@M_DEPS =
- M_SIZE = -DN=$(PAT_N)
- M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
- M_FILE = $(PAT_BASE)_n.c
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0033-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0033-Don-t-search-host-directory-during-relink-if-inst_pr.patch
deleted file mode 100644
index e425d71..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0033-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 5092f5389d02e78cd59690cf3fca24b56a97aff2 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 3 Mar 2015 08:21:19 +0000
-Subject: [PATCH 33/46] Don't search host directory during "relink" if
- $inst_prefix is provided
-
-http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
-
-Upstream-Status: Submitted
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- ltmain.sh | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/ltmain.sh b/ltmain.sh
-index 52bdbdb..82bcec3 100644
---- a/ltmain.sh
-+++ b/ltmain.sh
-@@ -6004,12 +6004,13 @@ func_mode_link ()
- 	      fi
- 	    else
- 	      # We cannot seem to hardcode it, guess we'll fake it.
-+	      # Default if $libdir is not relative to the prefix:
- 	      add_dir="-L$libdir"
--	      # Try looking first in the location we're being installed to.
-+
- 	      if test -n "$inst_prefix_dir"; then
- 		case $libdir in
- 		  [\\/]*)
--		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
-+		    add_dir="-L$inst_prefix_dir$libdir"
- 		    ;;
- 		esac
- 	      fi
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0034-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0034-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
deleted file mode 100644
index 922a855..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0034-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 1faa6f69f93bb95af2b2b2bd24e181b50fb5b37c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 28 Apr 2015 23:15:27 -0700
-Subject: [PATCH 34/46] Use SYSTEMLIBS_DIR replacement instead of hardcoding
- base_libdir
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Inappropriate [OE Configuration]
-
- gcc/config/aarch64/aarch64-linux.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
-index 5fcaa59..8588ac0 100644
---- a/gcc/config/aarch64/aarch64-linux.h
-+++ b/gcc/config/aarch64/aarch64-linux.h
-@@ -21,7 +21,7 @@
- #ifndef GCC_AARCH64_LINUX_H
- #define GCC_AARCH64_LINUX_H
- 
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
-+#define GLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
- 
- #undef MUSL_DYNAMIC_LINKER
- #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0035-aarch64-Add-support-for-musl-ldso.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0035-aarch64-Add-support-for-musl-ldso.patch
deleted file mode 100644
index 9dfc472..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0035-aarch64-Add-support-for-musl-ldso.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 3768468c1a6cc170fff88c03b808c975ac653811 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 28 Apr 2015 23:18:39 -0700
-Subject: [PATCH 35/46] aarch64: Add support for musl ldso
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Inappropriate [OE Configuration]
-
- gcc/config/aarch64/aarch64-linux.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
-index 8588ac0..946b3ca 100644
---- a/gcc/config/aarch64/aarch64-linux.h
-+++ b/gcc/config/aarch64/aarch64-linux.h
-@@ -24,7 +24,7 @@
- #define GLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
- 
- #undef MUSL_DYNAMIC_LINKER
--#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
-+#define MUSL_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
- 
- #undef  ASAN_CC1_SPEC
- #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch
deleted file mode 100644
index f89a886..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From f4d3c8e970d42a43cd3d2f751e13324efa936ff8 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Sun, 5 Jul 2015 20:25:18 -0700
-Subject: [PATCH 36/46] libcc1: fix libcc1's install path and rpath
-
-* Install libcc1.so and libcc1plugin.so into
-  $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
-  had done to lto-plugin.
-* Fix bad RPATH iussue:
-  gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file
- /path/to/gcc/5.2.0-r0/packages-split/gcc-plugins/usr/lib64/gcc/x86_64-poky-linux/5.2.0/plugin/libcc1plugin.so.0.0.0
- [rpaths]
-
-Upstream-Status: Inappropriate [OE configuration]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- libcc1/Makefile.am | 4 ++--
- libcc1/Makefile.in | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
-index b40820b..32930c5 100644
---- a/libcc1/Makefile.am
-+++ b/libcc1/Makefile.am
-@@ -35,8 +35,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
- 	    $(Wc)$(libiberty_normal)))
- libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
- 
--plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
--cc1libdir = $(libdir)/$(libsuffix)
-+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
-+plugindir = $(cc1libdir)
- 
- if ENABLE_PLUGIN
- plugin_LTLIBRARIES = libcc1plugin.la
-diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
-index 79d39d3..227ec22 100644
---- a/libcc1/Makefile.in
-+++ b/libcc1/Makefile.in
-@@ -291,8 +291,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
- 	    $(Wc)$(libiberty_normal)))
- 
- libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
--plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
--cc1libdir = $(libdir)/$(libsuffix)
-+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
-+plugindir = $(cc1libdir)
- @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la
- @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
- BUILT_SOURCES = compiler-name.h
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0037-handle-sysroot-support-for-nativesdk-gcc.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0037-handle-sysroot-support-for-nativesdk-gcc.patch
deleted file mode 100644
index 15efcb1..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0037-handle-sysroot-support-for-nativesdk-gcc.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-From 1475b941d7a9c9874b0fb0558d01805945467331 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 7 Dec 2015 23:39:54 +0000
-Subject: [PATCH 37/46] handle sysroot support for nativesdk-gcc
-
-Being able to build a nativesdk gcc is useful, particularly in cases
-where the host compiler may be of an incompatible version (or a 32
-bit compiler is needed).
-
-Sadly, building nativesdk-gcc is not straight forward. We install
-nativesdk-gcc into a relocatable location and this means that its
-library locations can change. "Normal" sysroot support doesn't help
-in this case since the values of paths like "libdir" change, not just
-base root directory of the system.
-
-In order to handle this we do two things:
-
-a) Add %r into spec file markup which can be used for injected paths
-   such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
-b) Add other paths which need relocation into a .gccrelocprefix section
-   which the relocation code will notice and adjust automatically.
-
-Upstream-Status: Inappropriate
-RP 2015/7/28
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gcc/cppdefault.c | 50 +++++++++++++++++++++++++++++++++++++-------------
- gcc/cppdefault.h |  3 ++-
- gcc/gcc.c        | 20 ++++++++++++++------
- 3 files changed, 53 insertions(+), 20 deletions(-)
-
-diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
-index 7b4dd51..9d1166c 100644
---- a/gcc/cppdefault.c
-+++ b/gcc/cppdefault.c
-@@ -35,6 +35,30 @@
- # undef CROSS_INCLUDE_DIR
- #endif
- 
-+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
-+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
-+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
-+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
-+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
-+#ifdef LOCAL_INCLUDE_DIR
-+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
-+#endif
-+#ifdef PREFIX_INCLUDE_DIR
-+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
-+#endif
-+#ifdef FIXED_INCLUDE_DIR
-+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
-+#endif
-+#ifdef CROSS_INCLUDE_DIR
-+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
-+#endif
-+#ifdef TOOL_INCLUDE_DIR
-+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
-+#endif
-+#ifdef NATIVE_SYSTEM_HEADER_DIR
-+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
-+#endif
-+
- const struct default_include cpp_include_defaults[]
- #ifdef INCLUDE_DEFAULTS
- = INCLUDE_DEFAULTS;
-@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
- = {
- #ifdef GPLUSPLUS_INCLUDE_DIR
-     /* Pick up GNU C++ generic include files.  */
--    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
-+    { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
-       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
- #endif
- #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
-     /* Pick up GNU C++ target-dependent include files.  */
--    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
-+    { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
-       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
- #endif
- #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
-     /* Pick up GNU C++ backward and deprecated include files.  */
--    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
-+    { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
-       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
- #endif
- #ifdef GCC_INCLUDE_DIR
-     /* This is the dir for gcc's private headers.  */
--    { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
-+    { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
- #endif
- #ifdef GCC_INCLUDE_SUBDIR_TARGET
-     /* This is the dir for gcc's private headers under the specified sysroot.  */
--    { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
-+    { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
- #endif
- #ifdef LOCAL_INCLUDE_DIR
-     /* /usr/local/include comes before the fixincluded header files.  */
--    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
--    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
-+    { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
-+    { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
- #endif
- #ifdef PREFIX_INCLUDE_DIR
--    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
-+    { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
- #endif
- #ifdef FIXED_INCLUDE_DIR
-     /* This is the dir for fixincludes.  */
--    { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
-+    { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
-       /* A multilib suffix needs adding if different multilibs use
- 	 different headers.  */
- #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
-@@ -85,16 +109,16 @@ const struct default_include cpp_include_defaults[]
- #endif
- #ifdef CROSS_INCLUDE_DIR
-     /* One place the target system's headers might be.  */
--    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
-+    { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
- #endif
- #ifdef TOOL_INCLUDE_DIR
-     /* Another place the target system's headers might be.  */
--    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
-+    { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
- #endif
- #ifdef NATIVE_SYSTEM_HEADER_DIR
-     /* /usr/include comes dead last.  */
--    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
--    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
-+    { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
-+    { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
- #endif
-     { 0, 0, 0, 0, 0, 0 }
-   };
-diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
-index 8a81b45..9759efd 100644
---- a/gcc/cppdefault.h
-+++ b/gcc/cppdefault.h
-@@ -33,7 +33,8 @@
- 
- struct default_include
- {
--  const char *const fname;	/* The name of the directory.  */
-+  const char *fname;     /* The name of the directory.  */
-+
-   const char *const component;	/* The component containing the directory
- 				   (see update_path in prefix.c) */
-   const char cplusplus;		/* Only look here if we're compiling C++.  */
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 9750cc2..94c240e 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -247,6 +247,8 @@ FILE *report_times_to_file = NULL;
- #endif
- static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
- 
-+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
-+
- /* Nonzero means pass the updated target_system_root to the compiler.  */
- 
- static int target_system_root_changed;
-@@ -517,6 +519,7 @@ or with constant text in a single argument.
-  %G     process LIBGCC_SPEC as a spec.
-  %R     Output the concatenation of target_system_root and
-         target_sysroot_suffix.
-+ %r     Output the base path target_relocatable_prefix
-  %S     process STARTFILE_SPEC as a spec.  A capital S is actually used here.
-  %E     process ENDFILE_SPEC as a spec.  A capital E is actually used here.
-  %C     process CPP_SPEC as a spec.
-@@ -1473,10 +1476,10 @@ static const char *gcc_libexec_prefix;
-    gcc_exec_prefix is set because, in that case, we know where the
-    compiler has been installed, and use paths relative to that
-    location instead.  */
--static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
--static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
--static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
--static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
-+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
-+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
-+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
-+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
- 
- /* For native compilers, these are well-known paths containing
-    components that may be provided by the system.  For cross
-@@ -1484,9 +1487,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
- static const char *md_exec_prefix = MD_EXEC_PREFIX;
- static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
- static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
--static const char *const standard_startfile_prefix_1
-+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
-   = STANDARD_STARTFILE_PREFIX_1;
--static const char *const standard_startfile_prefix_2
-+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
-   = STANDARD_STARTFILE_PREFIX_2;
- 
- /* A relative path to be used in finding the location of tools
-@@ -5762,6 +5765,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
- 	      }
- 	    break;
- 
-+          case 'r':
-+              obstack_grow (&obstack, target_relocatable_prefix,
-+		      strlen (target_relocatable_prefix));
-+            break;
-+
- 	  case 'S':
- 	    value = do_spec_1 (startfile_spec, 0, NULL);
- 	    if (value != 0)
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0038-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0038-Search-target-sysroot-gcc-version-specific-dirs-with.patch
deleted file mode 100644
index 89ee79d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0038-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From 42e4cdcaad590536246866b0846ec279e124fa16 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 7 Dec 2015 23:41:45 +0000
-Subject: [PATCH 38/46] Search target sysroot gcc version specific dirs with
- multilib.
-
-We install the gcc libraries (such as crtbegin.p) into
-<sysroot><libdir>/<target-sys>/5.2.0/
-which is a default search path for GCC (aka multi_suffix in the
-code below). <target-sys> is 'machine' in gcc's terminology. We use
-these directories so that multiple gcc versions could in theory
-co-exist on target.
-
-We only want to build one gcc-cross-canadian per arch and have this work
-for all multilibs. <target-sys> can be handled by mapping the multilib
-<target-sys> to the one used by gcc-cross-canadian, e.g.
-mips64-polkmllib32-linux
-is symlinked to by mips64-poky-linux.
-
-The default gcc search path in the target sysroot for a "lib64" mutlilib
-is:
-
-<sysroot>/lib32/mips64-poky-linux/5.2.0/
-<sysroot>/lib32/../lib64/
-<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
-<sysroot>/usr/lib32/../lib64/
-<sysroot>/lib32/
-<sysroot>/usr/lib32/
-
-which means that the lib32 crtbegin.o will be found and the lib64 ones
-will not which leads to compiler failures.
-
-This patch injects a multilib version of that path first so the lib64
-binaries can be found first. With this change the search path becomes:
-
-<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
-<sysroot>/lib32/mips64-poky-linux/5.2.0/
-<sysroot>/lib32/../lib64/
-<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
-<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
-<sysroot>/usr/lib32/../lib64/
-<sysroot>/lib32/
-<sysroot>/usr/lib32/
-
-Upstream-Status: Pending
-RP 2015/7/31
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gcc/gcc.c | 29 ++++++++++++++++++++++++++++-
- 1 file changed, 28 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 94c240e..2812819 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -2507,7 +2507,7 @@ for_each_path (const struct path_prefix *paths,
-       if (path == NULL)
- 	{
- 	  len = paths->max_len + extra_space + 1;
--	  len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
-+	  len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
- 	  path = XNEWVEC (char, len);
- 	}
- 
-@@ -2519,6 +2519,33 @@ for_each_path (const struct path_prefix *paths,
- 	  /* Look first in MACHINE/VERSION subdirectory.  */
- 	  if (!skip_multi_dir)
- 	    {
-+	      if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
-+	        {
-+	          const char *this_multi;
-+	          size_t this_multi_len;
-+
-+	          if (pl->os_multilib)
-+		    {
-+		      this_multi = multi_os_dir;
-+		      this_multi_len = multi_os_dir_len;
-+		    }
-+	          else
-+		    {
-+		      this_multi = multi_dir;
-+		      this_multi_len = multi_dir_len;
-+		    }
-+
-+	          /* Look in multilib MACHINE/VERSION subdirectory first */
-+	          if (this_multi_len)
-+	            {
-+		      memcpy (path + len, this_multi, this_multi_len + 1);
-+	              memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
-+	              ret = callback (path, callback_info);
-+	                if (ret)
-+		          break;
-+	            }
-+	        }
-+
- 	      memcpy (path + len, multi_suffix, suffix_len + 1);
- 	      ret = callback (path, callback_info);
- 	      if (ret)
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0039-Fix-various-_FOR_BUILD-and-related-variables.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0039-Fix-various-_FOR_BUILD-and-related-variables.patch
deleted file mode 100644
index 0ce7aec..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0039-Fix-various-_FOR_BUILD-and-related-variables.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 9ced49e459ccf1887feb58adf1e8836dcb4b1bdf Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 7 Dec 2015 23:42:45 +0000
-Subject: [PATCH 39/46] Fix various _FOR_BUILD and related variables
-
-When doing a FOR_BUILD thing, you have to override CFLAGS with
-CFLAGS_FOR_BUILD. And if you use C++, you also have to override
-CXXFLAGS with CXXFLAGS_FOR_BUILD.
-Without this, when building for mingw, you end up trying to use
-the mingw headers for a host build.
-
-The same goes for other variables as well, such as CPPFLAGS,
-CPP, and GMPINC.
-
-Upstream-Status: Pending
-
-Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makefile.in      | 6 ++++++
- Makefile.tpl     | 5 +++++
- gcc/Makefile.in  | 2 +-
- gcc/configure    | 2 +-
- gcc/configure.ac | 2 +-
- 5 files changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/Makefile.in b/Makefile.in
-index beb9b9a..3e1c6bc 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
- 	CPP="$(CC_FOR_BUILD) -E"; export CPP; \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-+	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
- 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
- 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
- 	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
-@@ -170,6 +171,9 @@ BUILD_EXPORTS = \
- # built for the build system to override those in BASE_FLAGS_TO_PASS.
- EXTRA_BUILD_FLAGS = \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
-+	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
-+	CPP="$(CC_FOR_BUILD) -E" \
-+	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
- 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
- 
- # This is the list of directories to built for the host system.
-@@ -187,6 +191,7 @@ HOST_SUBDIR = @host_subdir@
- HOST_EXPORTS = \
- 	$(BASE_EXPORTS) \
- 	CC="$(CC)"; export CC; \
-+	CPP="$(CC) -E"; export CPP; \
- 	ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
- 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-@@ -713,6 +718,7 @@ BASE_FLAGS_TO_PASS = \
- 	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
- 	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
- 	"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
-+	"CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
- 	"EXPECT=$(EXPECT)" \
- 	"FLEX=$(FLEX)" \
- 	"INSTALL=$(INSTALL)" \
-diff --git a/Makefile.tpl b/Makefile.tpl
-index 6b2eb6a..114e462 100644
---- a/Makefile.tpl
-+++ b/Makefile.tpl
-@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
- 	CC="$(CC_FOR_BUILD)"; export CC; \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-+	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
- 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
- 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
- 	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
-@@ -172,6 +173,9 @@ BUILD_EXPORTS = \
- # built for the build system to override those in BASE_FLAGS_TO_PASS.
- EXTRA_BUILD_FLAGS = \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
-+	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
-+	CPP="$(CC_FOR_BUILD) -E" \
-+	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
- 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
- 
- # This is the list of directories to built for the host system.
-@@ -189,6 +193,7 @@ HOST_SUBDIR = @host_subdir@
- HOST_EXPORTS = \
- 	$(BASE_EXPORTS) \
- 	CC="$(CC)"; export CC; \
-+	CPP="$(CC) -E"; export CPP; \
- 	ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
- 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index cc75536..0ad2dc8 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -780,7 +780,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@
- BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
- BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
- BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
--		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
-+		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD)
- 
- # Actual name to use when installing a native compiler.
- GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
-diff --git a/gcc/configure b/gcc/configure
-index 377253e..78fc64a 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -11799,7 +11799,7 @@ else
- 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
- 	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
- 	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
--	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
-+	GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
- 	${realsrcdir}/configure \
- 		--enable-languages=${enable_languages-all} \
- 		--target=$target_alias --host=$build_alias --build=$build_alias
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 54e7619..a94666e 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -1682,7 +1682,7 @@ else
- 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
- 	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
- 	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
--	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
-+	GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
- 	${realsrcdir}/configure \
- 		--enable-languages=${enable_languages-all} \
- 		--target=$target_alias --host=$build_alias --build=$build_alias
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0040-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0040-nios2-Define-MUSL_DYNAMIC_LINKER.patch
deleted file mode 100644
index c9a6fd0..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0040-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b0412c01c275aaeb6b458461cd2425120c8bcec8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 2 Feb 2016 10:26:10 -0800
-Subject: [PATCH 40/46] nios2: Define MUSL_DYNAMIC_LINKER
-
-Signed-off-by: Marek Vasut <marex@denx.de>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- gcc/config/nios2/linux.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
-index 4ef55b5..62bc1e7 100644
---- a/gcc/config/nios2/linux.h
-+++ b/gcc/config/nios2/linux.h
-@@ -30,6 +30,7 @@
- #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
- 
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
-+#define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-nios2.so.1"
- 
- #undef LINK_SPEC
- #define LINK_SPEC LINK_SPEC_ENDIAN \
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
deleted file mode 100644
index 29b7ce7..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 210f6b3b82084cc756e02b8bc12f909a43b14ee8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 27 Jun 2017 18:10:54 -0700
-Subject: [PATCH 40/49] Add ssp_nonshared to link commandline for musl targets
-
-when -fstack-protector options are enabled we need to
-link with ssp_shared on musl since it does not provide
-the __stack_chk_fail_local() so essentially it provides
-libssp but not libssp_nonshared something like
-TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
- where-as for glibc the needed symbols
-are already present in libc_nonshared library therefore
-we do not need any library helper on glibc based systems
-but musl needs the libssp_noshared from gcc
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gcc/config/linux.h          |  7 +++++++
- gcc/config/rs6000/linux.h   | 10 ++++++++++
- gcc/config/rs6000/linux64.h | 10 ++++++++++
- 3 files changed, 27 insertions(+)
-
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
-index 2e683d0c430..1b4df798671 100644
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-     { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
-     { 0, 0, 0, 0, 0, 0 }				\
-   }
-+#ifdef TARGET_LIBC_PROVIDES_SSP
-+#undef LINK_SSP_SPEC
-+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
-+		       "|fstack-protector-strong|fstack-protector-explicit" \
-+		       ":-lssp_nonshared}"
-+#endif
-+
- #endif
- 
- #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
-diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
-index 684afd6c190..22cfa391b89 100644
---- a/gcc/config/rs6000/linux.h
-+++ b/gcc/config/rs6000/linux.h
-@@ -91,6 +91,16 @@
- 					 " -m elf32ppclinux")
- #endif
- 
-+/* link libssp_nonshared.a with musl */
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#ifdef TARGET_LIBC_PROVIDES_SSP
-+#undef LINK_SSP_SPEC
-+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
-+		       "|fstack-protector-strong|fstack-protector-explicit" \
-+		       ":-lssp_nonshared}"
-+#endif
-+#endif
-+
- #undef LINK_OS_LINUX_SPEC
- #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
-   %{rdynamic:-export-dynamic} \
-diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
-index 3b00ec0fcf0..8371f8d7b6b 100644
---- a/gcc/config/rs6000/linux64.h
-+++ b/gcc/config/rs6000/linux64.h
-@@ -465,6 +465,16 @@ extern int dot_symbols;
- 					   " -m elf64ppc")
- #endif
- 
-+/* link libssp_nonshared.a with musl */
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#ifdef TARGET_LIBC_PROVIDES_SSP
-+#undef LINK_SSP_SPEC
-+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
-+		       "|fstack-protector-strong|fstack-protector-explicit" \
-+		       ":-lssp_nonshared}"
-+#endif
-+#endif
-+
- #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
-   %{rdynamic:-export-dynamic} \
-   -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
--- 
-2.13.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0042-gcc-libcpp-support-ffile-prefix-map-old-new.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0042-gcc-libcpp-support-ffile-prefix-map-old-new.patch
deleted file mode 100644
index 861f0fd..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0042-gcc-libcpp-support-ffile-prefix-map-old-new.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From ba738cc411c9a54e389e336bcaa0a2428dd4a9d2 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <hongxu.jia@windriver.com>
-Date: Wed, 16 Mar 2016 02:27:43 -0400
-Subject: [PATCH 42/46] gcc/libcpp: support -ffile-prefix-map=<old>=<new>
-
-Similar -fdebug-prefix-map, add option -ffile-prefix-map to map one
-directory name (old) to another (new) in __FILE__, __BASE_FILE__ and
-__builtin_FILE ().
-
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
-
-Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- gcc/c-family/c-opts.c     | 13 +++++++
- gcc/c-family/c.opt        |  4 +++
- gcc/dwarf2out.c           |  1 +
- gcc/gimplify.c            |  3 ++
- libcpp/Makefile.in        | 10 +++---
- libcpp/file-map.c         | 92 +++++++++++++++++++++++++++++++++++++++++++++++
- libcpp/include/file-map.h | 30 ++++++++++++++++
- libcpp/macro.c            |  2 ++
- 8 files changed, 150 insertions(+), 5 deletions(-)
- create mode 100644 libcpp/file-map.c
- create mode 100644 libcpp/include/file-map.h
-
-diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
-index fec58bc..7a0af43 100644
---- a/gcc/c-family/c-opts.c
-+++ b/gcc/c-family/c-opts.c
-@@ -38,6 +38,14 @@ along with GCC; see the file COPYING3.  If not see
- #include "opts.h"
- #include "plugin.h"		/* For PLUGIN_INCLUDE_FILE event.  */
- #include "mkdeps.h"
-+#include "file-map.h"
-+#include "c-target.h"
-+#include "tm.h"			/* For BYTES_BIG_ENDIAN,
-+				   DOLLARS_IN_IDENTIFIERS,
-+				   STDC_0_IN_SYSTEM_HEADERS,
-+				   TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
-+				   TARGET_OPTF.  */
-+#include "tm_p.h"		/* For C_COMMON_OVERRIDE_OPTIONS.  */
- #include "dumpfile.h"
- 
- #ifndef DOLLARS_IN_IDENTIFIERS
-@@ -503,6 +511,11 @@ c_common_handle_option (size_t scode, const char *arg, int value,
-       cpp_opts->narrow_charset = arg;
-       break;
- 
-+    case OPT_ffile_prefix_map_:
-+      if (add_file_prefix_map (arg) < 0)
-+        error ("invalid argument %qs to -ffile-prefix-map", arg);
-+      break;
-+
-     case OPT_fwide_exec_charset_:
-       cpp_opts->wide_charset = arg;
-       break;
-diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
-index 660da6c..31f7b34 100644
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -1208,6 +1208,10 @@ fexec-charset=
- C ObjC C++ ObjC++ Joined RejectNegative
- -fexec-charset=<cset>	Convert all strings and character constants to character set <cset>.
- 
-+ffile-prefix-map=
-+C ObjC C++ ObjC++ Joined RejectNegative
-+-ffile-prefix-map=<old=new>	Map one directory name to another in __FILE__, __BASE_FILE__ and __builtin_FILE ()
-+
- fextended-identifiers
- C ObjC C++ ObjC++
- Permit universal character names (\\u and \\U) in identifiers.
-diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
-index 80f2df5..a2bfcc0 100644
---- a/gcc/dwarf2out.c
-+++ b/gcc/dwarf2out.c
-@@ -21672,6 +21672,7 @@ gen_producer_string (void)
-       case OPT_fltrans_output_list_:
-       case OPT_fresolution_:
-       case OPT_fdebug_prefix_map_:
-+      case OPT_ffile_prefix_map_:
- 	/* Ignore these.  */
- 	continue;
-       default:
-diff --git a/gcc/gimplify.c b/gcc/gimplify.c
-index e223e59..1433c25 100644
---- a/gcc/gimplify.c
-+++ b/gcc/gimplify.c
-@@ -57,6 +57,8 @@ along with GCC; see the file COPYING3.  If not see
- #include "gomp-constants.h"
- #include "tree-dump.h"
- #include "gimple-walk.h"
-+#include "file-map.h"
-+
- #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
- #include "builtins.h"
- 
-@@ -2432,6 +2434,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
-       case BUILT_IN_FILE:
- 	{
- 	  const char *locfile = LOCATION_FILE (EXPR_LOCATION (*expr_p));
-+	  locfile = remap_file_filename (locfile);
- 	  *expr_p = build_string_literal (strlen (locfile) + 1, locfile);
- 	  return GS_OK;
- 	}
-diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
-index a7d7828..3d29572 100644
---- a/libcpp/Makefile.in
-+++ b/libcpp/Makefile.in
-@@ -84,12 +84,12 @@ DEPMODE = $(CXXDEPMODE)
- 
- 
- libcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
--	expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
--	mkdeps.o pch.o symtab.o traditional.o
-+	expr.o file-map.o files.o identifiers.o init.o lex.o line-map.o \
-+	macro.o mkdeps.o pch.o symtab.o traditional.o
- 
- libcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
--	expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
--	mkdeps.c pch.c symtab.c traditional.c
-+	expr.c file-map.c files.c identifiers.c init.c lex.c line-map.c \
-+	macro.c mkdeps.c pch.c symtab.c traditional.c
- 
- all: libcpp.a $(USED_CATALOGS)
- 
-@@ -263,7 +263,7 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
- 
- TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \
-     include/line-map.h include/symtab.h include/cpp-id-data.h \
--    include/cpplib.h include/mkdeps.h system.h
-+    include/cpplib.h include/mkdeps.h system.h include/file-map.h
- 
- TAGS: $(TAGS_SOURCES)
- 	cd $(srcdir) && etags $(TAGS_SOURCES)
-diff --git a/libcpp/file-map.c b/libcpp/file-map.c
-new file mode 100644
-index 0000000..18035ef
---- /dev/null
-+++ b/libcpp/file-map.c
-@@ -0,0 +1,92 @@
-+/* Map one directory name to another in __FILE__, __BASE_FILE__
-+   and __builtin_FILE ().
-+   Copyright (C) 2001-2016 Free Software Foundation, Inc.
-+
-+This program is free software; you can redistribute it and/or modify it
-+under the terms of the GNU General Public License as published by the
-+Free Software Foundation; either version 3, or (at your option) any
-+later version.
-+
-+This program is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with this program; see the file COPYING3.  If not see
-+<http://www.gnu.org/licenses/>.
-+
-+ In other words, you are welcome to use, share and improve this program.
-+ You are forbidden to forbid anyone else to use, share and improve
-+ what you give them.   Help stamp out software-hoarding!  */
-+
-+#include "config.h"
-+#include "system.h"
-+#include "file-map.h"
-+
-+/* Structure recording the mapping from source file and directory
-+   names at compile time to __FILE__ */
-+typedef struct file_prefix_map
-+{
-+  const char *old_prefix;
-+  const char *new_prefix;
-+  size_t old_len;
-+  size_t new_len;
-+  struct file_prefix_map *next;
-+} file_prefix_map;
-+
-+/* Linked list of such structures.  */
-+static file_prefix_map *file_prefix_maps;
-+
-+/* Record prefix mapping of __FILE__.  ARG is the argument to
-+   -ffile-prefix-map and must be of the form OLD=NEW.  */
-+int
-+add_file_prefix_map (const char *arg)
-+{
-+  file_prefix_map *map;
-+  const char *p;
-+
-+  p = strchr (arg, '=');
-+  if (!p)
-+  {
-+      fprintf(stderr, "invalid argument %qs to -ffile-prefix-map", arg);
-+      return -1;
-+  }
-+  map = XNEW (file_prefix_map);
-+  map->old_prefix = xstrndup (arg, p - arg);
-+  map->old_len = p - arg;
-+  p++;
-+  map->new_prefix = xstrdup (p);
-+  map->new_len = strlen (p);
-+  map->next = file_prefix_maps;
-+  file_prefix_maps = map;
-+
-+  return 0;
-+}
-+
-+/* Perform user-specified mapping of __FILE__ prefixes.  Return
-+   the new name corresponding to filename.  */
-+
-+const char *
-+remap_file_filename (const char *filename)
-+{
-+  file_prefix_map *map;
-+  char *s;
-+  const char *name;
-+  size_t name_len;
-+
-+  for (map = file_prefix_maps; map; map = map->next)
-+    if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
-+      break;
-+  if (!map)
-+    return filename;
-+  name = filename + map->old_len;
-+  name_len = strlen (name) + 1;
-+  s = (char *) alloca (name_len + map->new_len);
-+  memcpy (s, map->new_prefix, map->new_len);
-+  memcpy (s + map->new_len, name, name_len);
-+
-+  return xstrdup (s);
-+}
-+
-+
-diff --git a/libcpp/include/file-map.h b/libcpp/include/file-map.h
-new file mode 100644
-index 0000000..8750315
---- /dev/null
-+++ b/libcpp/include/file-map.h
-@@ -0,0 +1,30 @@
-+/* Map one directory name to another in __FILE__, __BASE_FILE__
-+   and __builtin_FILE ().
-+   Copyright (C) 2001-2016 Free Software Foundation, Inc.
-+
-+This program is free software; you can redistribute it and/or modify it
-+under the terms of the GNU General Public License as published by the
-+Free Software Foundation; either version 3, or (at your option) any
-+later version.
-+
-+This program is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with this program; see the file COPYING3.  If not see
-+<http://www.gnu.org/licenses/>.
-+
-+ In other words, you are welcome to use, share and improve this program.
-+ You are forbidden to forbid anyone else to use, share and improve
-+ what you give them.   Help stamp out software-hoarding!  */
-+
-+#ifndef LIBCPP_FILE_MAP_H
-+#define LIBCPP_FILE_MAP_H
-+
-+const char * remap_file_filename (const char *filename);
-+
-+int add_file_prefix_map (const char *arg);
-+
-+#endif /* !LIBCPP_FILE_MAP_H  */
-diff --git a/libcpp/macro.c b/libcpp/macro.c
-index c251553..3ceec3d 100644
---- a/libcpp/macro.c
-+++ b/libcpp/macro.c
-@@ -26,6 +26,7 @@ along with this program; see the file COPYING3.  If not see
- #include "system.h"
- #include "cpplib.h"
- #include "internal.h"
-+#include "file-map.h"
- 
- typedef struct macro_arg macro_arg;
- /* This structure represents the tokens of a macro argument.  These
-@@ -301,6 +302,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
- 	    if (!name)
- 	      abort ();
- 	  }
-+	name = remap_file_filename (name);
- 	len = strlen (name);
- 	buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
- 	result = buf;
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0043-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0043-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
deleted file mode 100644
index 0077f80..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0043-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 25c87c6cc40ec5cc6965f8bfb215bec01abd6d82 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <hongxu.jia@windriver.com>
-Date: Wed, 16 Mar 2016 05:39:59 -0400
-Subject: [PATCH 43/46] Reuse -fdebug-prefix-map to replace -ffile-prefix-map
-
-The oe-core may use external toolchain to compile,
-which may not support -ffile-prefix-map.
-
-Since we use -fdebug-prefix-map to do the same thing,
-so we could reuse it to replace -ffile-prefix-map.
-
-Upstream-Status: Inappropriate[oe-core specific]
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- gcc/opts-global.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/gcc/opts-global.c b/gcc/opts-global.c
-index b7e5232..121d7b9 100644
---- a/gcc/opts-global.c
-+++ b/gcc/opts-global.c
-@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
- #include "langhooks.h"
- #include "dbgcnt.h"
- #include "debug.h"
-+#include "file-map.h"
- #include "output.h"
- #include "plugin.h"
- #include "toplev.h"
-@@ -357,6 +358,9 @@ handle_common_deferred_options (void)
- 
- 	case OPT_fdebug_prefix_map_:
- 	  add_debug_prefix_map (opt->arg);
-+
-+	  /* Reuse -fdebug-prefix-map to replace -ffile-prefix-map */
-+	  add_file_prefix_map (opt->arg);
- 	  break;
- 
- 	case OPT_fdump_:
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch
deleted file mode 100644
index 5d41af4..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 6ab23e88aef22bbabee7b9600c459ff39547bb66 Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <hongxu.jia@windriver.com>
-Date: Thu, 24 Mar 2016 11:23:14 -0400
-Subject: [PATCH 44/46] gcc/final.c: -fdebug-prefix-map support to remap
- sources with relative path
-
-PR other/70428
-* final.c (remap_debug_filename): Use lrealpath to translate
-relative path before remapping
-
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
-Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- gcc/final.c | 15 ++++++++++++---
- 1 file changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/final.c b/gcc/final.c
-index 55cf509..23293e5 100644
---- a/gcc/final.c
-+++ b/gcc/final.c
-@@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename)
-   const char *name;
-   size_t name_len;
- 
-+  /* Support to remap filename with relative path  */
-+  char *realpath = lrealpath (filename);
-+  if (realpath == NULL)
-+    return filename;
-+
-   for (map = debug_prefix_maps; map; map = map->next)
--    if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
-+    if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0)
-       break;
-   if (!map)
--    return filename;
--  name = filename + map->old_len;
-+    {
-+      free (realpath);
-+      return filename;
-+    }
-+  name = realpath + map->old_len;
-   name_len = strlen (name) + 1;
-   s = (char *) alloca (name_len + map->new_len);
-   memcpy (s, map->new_prefix, map->new_len);
-   memcpy (s + map->new_len, name, name_len);
-+  free (realpath);
-   return ggc_strdup (s);
- }
- 
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
deleted file mode 100644
index c62b727..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 5a47d404ea29e2547269e3ddf38754462d93f903 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Apr 2016 20:03:28 +0000
-Subject: [PATCH 45/46] libgcc: Add knob to use ldbl-128 on ppc
-
-musl does not support ldbl 128 so we can not assume
-that linux as a whole supports ldbl-128 bits, instead
-act upon configure option passed to gcc and assume no
-on musl and yes otherwise if no option is passed since
-default behaviour is to assume ldbl128 it does not
-change the defaults
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- libgcc/Makefile.in           |  1 +
- libgcc/config/rs6000/t-linux |  5 ++++-
- libgcc/configure             | 18 ++++++++++++++++++
- libgcc/configure.ac          | 12 ++++++++++++
- 4 files changed, 35 insertions(+), 1 deletion(-)
- mode change 100644 => 100755 libgcc/configure
-
-diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
-index f09b39b..296cf0f 100644
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -43,6 +43,7 @@ enable_vtable_verify = @enable_vtable_verify@
- enable_decimal_float = @enable_decimal_float@
- fixed_point = @fixed_point@
- with_aix_soname = @with_aix_soname@
-+with_ldbl128 = @with_ldbl128@
- 
- host_noncanonical = @host_noncanonical@
- real_host_noncanonical = @real_host_noncanonical@
-diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
-index 4f6d4c4..c50dd94 100644
---- a/libgcc/config/rs6000/t-linux
-+++ b/libgcc/config/rs6000/t-linux
-@@ -1,3 +1,6 @@
- SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
- 
--HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
-+ifeq ($(with_ldbl128),yes)
-+HOST_LIBGCC2_CFLAGS += -mlong-double-128
-+endif
-+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
-diff --git a/libgcc/configure b/libgcc/configure
-old mode 100644
-new mode 100755
-index e7d6c75..e9a9019
---- a/libgcc/configure
-+++ b/libgcc/configure
-@@ -614,6 +614,7 @@ build_vendor
- build_cpu
- build
- with_aix_soname
-+with_ldbl128
- enable_vtable_verify
- enable_shared
- libgcc_topdir
-@@ -663,6 +664,7 @@ with_cross_host
- with_ld
- enable_shared
- enable_vtable_verify
-+with_long_double_128
- with_aix_soname
- enable_version_specific_runtime_libs
- with_slibdir
-@@ -1319,6 +1321,7 @@ Optional Packages:
-   --with-target-subdir=SUBDIR      Configuring in a subdirectory for target
-   --with-cross-host=HOST           Configuring with a cross compiler
-   --with-ld               arrange to use the specified ld (full pathname)
-+  --with-long-double-128  use 128-bit long double by default
-   --with-aix-soname=aix|svr4|both
-                           shared library versioning (aka "SONAME") variant to
-                           provide on AIX
-@@ -2201,6 +2204,21 @@ fi
- 
- 
- 
-+# Check whether --with-long-double-128 was given.
-+if test "${with_long_double_128+set}" = set; then :
-+  withval=$with_long_double_128; with_ldbl128="$with_long_double_128"
-+else
-+  case "${host}" in
-+ power*-*-musl*)
-+   with_ldbl128="no";;
-+ *) with_ldbl128="yes";;
-+ esac
-+
-+fi
-+
-+
-+
-+
- # Check whether --with-aix-soname was given.
- if test "${with_aix_soname+set}" = set; then :
-   withval=$with_aix_soname; case "${host}:${enable_shared}" in
-diff --git a/libgcc/configure.ac b/libgcc/configure.ac
-index 269997f..81dc3ba 100644
---- a/libgcc/configure.ac
-+++ b/libgcc/configure.ac
-@@ -77,6 +77,18 @@ AC_ARG_ENABLE(vtable-verify,
- [enable_vtable_verify=no])
- AC_SUBST(enable_vtable_verify)
- 
-+AC_ARG_WITH(long-double-128,
-+[AS_HELP_STRING([--with-long-double-128],
-+    [use 128-bit long double by default])],
-+      with_ldbl128="$with_long_double_128",
-+[case "${host}" in
-+ power*-*-musl*)
-+   with_ldbl128="no";;
-+ *) with_ldbl128="yes";;
-+ esac
-+])
-+AC_SUBST(with_ldbl128)
-+
- AC_ARG_WITH(aix-soname,
- [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
-     [shared library versioning (aka "SONAME") variant to provide on AIX])],
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
deleted file mode 100644
index 390037f..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 513bf3c33e2f551f08bd57605091d5ddeba3536b Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 4 May 2016 21:11:34 -0700
-Subject: [PATCH 46/46] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
-
-Upstream-Status: Pending
-
-Signed-off-by: Christopher Larson <chris_larson@mentor.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- libgcc/config/t-slibgcc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
-index 8c5f890..29be909 100644
---- a/libgcc/config/t-slibgcc
-+++ b/libgcc/config/t-slibgcc
-@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
- 	$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
- 
- SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
--	$(SHLIB_LDFLAGS) \
-+	$(LDFLAGS) $(SHLIB_LDFLAGS) \
- 	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
- 	$(SHLIB_OBJS) $(SHLIB_LC) && \
- 	rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
--- 
-2.8.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
deleted file mode 100644
index 6b5da02..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 0a9ed0479203cb7e69c3745b0c259007410f39ba Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Sat, 24 Oct 2015 20:09:53 +0000
-Subject: [PATCH 47/47] libgcc_s: Use alias for __cpu_indicator_init instead of
- symver
-
-Adapter from
-
-https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
-
-This fix was debated but hasnt been applied gcc upstream since
-they expect musl to support '@' in symbol versioning which is
-a sun/gnu versioning extention. This patch however avoids the
-need for the '@' symbols at all
-
-libgcc/Changelog:
-
-2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>
-
-	* config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
-	(__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
-
-	* config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
-
-gcc/Changelog:
-
-2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>
-
-	* config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init
-	call __cpu_indicator_init_local instead of __cpu_indicator_init.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Denied
-
- gcc/config/i386/i386.c       | 4 ++--
- libgcc/config/i386/cpuinfo.c | 6 +++---
- libgcc/config/i386/t-linux   | 2 +-
- 3 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 861a029..1c97d72 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -40323,10 +40323,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
-     {
-     case IX86_BUILTIN_CPU_INIT:
-       {
--	/* Make it call __cpu_indicator_init in libgcc. */
-+	/* Make it call __cpu_indicator_init_local in libgcc.a. */
- 	tree call_expr, fndecl, type;
-         type = build_function_type_list (integer_type_node, NULL_TREE); 
--	fndecl = build_fn_decl ("__cpu_indicator_init", type);
-+	fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
- 	call_expr = build_call_expr (fndecl, 0); 
- 	return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
-       }
-diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
-index 8c2248d..6c82f15 100644
---- a/libgcc/config/i386/cpuinfo.c
-+++ b/libgcc/config/i386/cpuinfo.c
-@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
-   return 0;
- }
- 
--#if defined SHARED && defined USE_ELF_SYMVER
--__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
--__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
-+#ifndef SHARED
-+int __cpu_indicator_init_local (void)
-+  __attribute__ ((weak, alias ("__cpu_indicator_init")));
- #endif
-diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
-index 11bb46e..4f47f7b 100644
---- a/libgcc/config/i386/t-linux
-+++ b/libgcc/config/i386/t-linux
-@@ -3,4 +3,4 @@
- # t-slibgcc-elf-ver and t-linux
- SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
- 
--HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
-+HOST_LIBGCC2_CFLAGS += -mlong-double-80
--- 
-2.9.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0048-sync-gcc-stddef.h-with-musl.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0048-sync-gcc-stddef.h-with-musl.patch
deleted file mode 100644
index 30c158d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0048-sync-gcc-stddef.h-with-musl.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 10595c03c39b4e980d2a00e16fc84e9caf82292e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 3 Feb 2017 12:56:00 -0800
-Subject: [PATCH 48/48] sync gcc stddef.h with musl
-
-musl defines ptrdiff_t size_t and wchar_t
-so dont define them here if musl is definining them
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- gcc/ginclude/stddef.h | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
-index d711530d053..c315b7a97c1 100644
---- a/gcc/ginclude/stddef.h
-+++ b/gcc/ginclude/stddef.h
-@@ -134,6 +134,7 @@ _TYPE_wchar_t;
- #ifndef ___int_ptrdiff_t_h
- #ifndef _GCC_PTRDIFF_T
- #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
-+#ifndef __DEFINED_ptrdiff_t /* musl */
- #define _PTRDIFF_T
- #define _T_PTRDIFF_
- #define _T_PTRDIFF
-@@ -143,10 +144,12 @@ _TYPE_wchar_t;
- #define ___int_ptrdiff_t_h
- #define _GCC_PTRDIFF_T
- #define _PTRDIFF_T_DECLARED
-+#define __DEFINED_ptrdiff_t /* musl */
- #ifndef __PTRDIFF_TYPE__
- #define __PTRDIFF_TYPE__ long int
- #endif
- typedef __PTRDIFF_TYPE__ ptrdiff_t;
-+#endif /* __DEFINED_ptrdiff_t */
- #endif /* _PTRDIFF_T_DECLARED */
- #endif /* _GCC_PTRDIFF_T */
- #endif /* ___int_ptrdiff_t_h */
-@@ -184,6 +187,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
- #ifndef _GCC_SIZE_T
- #ifndef _SIZET_
- #ifndef __size_t
-+#ifndef __DEFINED_size_t /* musl */
- #define __size_t__	/* BeOS */
- #define __SIZE_T__	/* Cray Unicos/Mk */
- #define _SIZE_T
-@@ -200,6 +204,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
- #define ___int_size_t_h
- #define _GCC_SIZE_T
- #define _SIZET_
-+#define __DEFINED_size_t /* musl */
- #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
-   || defined(__DragonFly__) \
-   || defined(__FreeBSD_kernel__)
-@@ -235,6 +240,7 @@ typedef long ssize_t;
- #endif /* _SIZE_T */
- #endif /* __SIZE_T__ */
- #endif /* __size_t__ */
-+#endif /* __DEFINED_size_t */
- #undef	__need_size_t
- #endif /* _STDDEF_H or __need_size_t.  */
- 
-@@ -264,6 +270,7 @@ typedef long ssize_t;
- #ifndef ___int_wchar_t_h
- #ifndef __INT_WCHAR_T_H
- #ifndef _GCC_WCHAR_T
-+#ifndef __DEFINED_wchar_t /* musl */
- #define __wchar_t__	/* BeOS */
- #define __WCHAR_T__	/* Cray Unicos/Mk */
- #define _WCHAR_T
-@@ -279,6 +286,7 @@ typedef long ssize_t;
- #define __INT_WCHAR_T_H
- #define _GCC_WCHAR_T
- #define _WCHAR_T_DECLARED
-+#define __DEFINED_wchar_t /* musl */
- 
- /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
-    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
-@@ -344,6 +352,7 @@ typedef __WCHAR_TYPE__ wchar_t;
- #endif
- #endif /* __WCHAR_T__ */
- #endif /* __wchar_t__ */
-+#endif /* __DEFINED_wchar_t musl */
- #undef	__need_wchar_t
- #endif /* _STDDEF_H or __need_wchar_t.  */
- 
--- 
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0054_all_nopie-all-flags.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0054_all_nopie-all-flags.patch
deleted file mode 100644
index 73ab950..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0054_all_nopie-all-flags.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Need to pass NO_PIE_CFLAGS to ALL_* so gcc doesn't fail when
-we compile it with older gcc and pie.
-
-Upstream-Status: Inappropriate [configuration]
-
-Maintained by: Gentoo Toolchain Project <toolchain@gentoo.org>
-Signed-off-by: Stephen Arnold <stephen.arnold42@gmail.com>
-
---- a/gcc/Makefile.in	2015-06-25 19:18:12.000000000 +0200
-+++ b/gcc/Makefile.in	2016-04-22 00:12:54.029178860 +0200
-@@ -991,10 +991,10 @@ ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@)
- ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
-
- # This is the variable to use when using $(COMPILER).
--ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
-+ALL_COMPILERFLAGS = $(NO_PIE_CFLAGS) $(ALL_CXXFLAGS)
-
- # This is the variable to use when using $(LINKER).
--ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
-+ALL_LINKERFLAGS = $(NO_PIE_CFLAGS) $(ALL_CXXFLAGS)
-
- # Build and host support libraries.
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0055-unwind_h-glibc26.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0055-unwind_h-glibc26.patch
deleted file mode 100644
index c266cfe..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0055-unwind_h-glibc26.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-Backport and edit of patches from:
-https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=249957
-by jsm28 (Joseph Myers)
-
-Current glibc no longer gives the ucontext_t type the tag struct
-ucontext, to conform with POSIX namespace rules.  This requires
-various linux-unwind.h files in libgcc, that were previously using
-struct ucontext, to be fixed to use ucontext_t instead.  This is
-similar to the removal of the struct siginfo tag from siginfo_t some
-years ago.
-
-This patch changes those files to use ucontext_t instead.  As the
-standard name that should be unconditionally safe, so this is not
-restricted to architectures supported by glibc, or conditioned on the
-glibc version.
-
-Upstream-Status: Backport
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
---- branches/gcc-6-branch/libgcc/config/aarch64/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/aarch64/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -52,7 +52,7 @@
-   struct rt_sigframe
-   {
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   };
- 
-   struct rt_sigframe *rt_;
---- branches/gcc-6-branch/libgcc/config/alpha/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/alpha/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -51,7 +51,7 @@
-     {
-       struct rt_sigframe {
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       sc = &rt_->uc.uc_mcontext;
-     }
---- branches/gcc-6-branch/libgcc/config/bfin/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/bfin/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -52,7 +52,7 @@
- 	void *puc;
- 	char retcode[8];
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
- 
-       /* The void * cast is necessary to avoid an aliasing warning.
---- branches/gcc-6-branch/libgcc/config/i386/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/i386/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -58,7 +58,7 @@
-   if (*(unsigned char *)(pc+0) == 0x48
-       && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
-     {
--      struct ucontext *uc_ = context->cfa;
-+      ucontext_t *uc_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
-          because it does not alias anything.  */
-@@ -138,7 +138,7 @@
- 	siginfo_t *pinfo;
- 	void *puc;
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
---- branches/gcc-6-branch/libgcc/config/m68k/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/m68k/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -33,7 +33,7 @@
- /* <sys/ucontext.h> is unfortunately broken right now.  */
- struct uw_ucontext {
- 	unsigned long	  uc_flags;
--	struct ucontext  *uc_link;
-+	ucontext_t	 *uc_link;
- 	stack_t		  uc_stack;
- 	mcontext_t	  uc_mcontext;
- 	unsigned long	  uc_filler[80];
---- branches/gcc-6-branch/libgcc/config/nios2/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/nios2/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -38,7 +38,7 @@
- 
- struct nios2_ucontext {
-   unsigned long uc_flags;
--  struct ucontext *uc_link;
-+  ucontext_t *uc_link;
-   stack_t uc_stack;
-   struct nios2_mcontext uc_mcontext;
-   sigset_t uc_sigmask;	/* mask last for extensibility */
---- branches/gcc-6-branch/libgcc/config/pa/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/pa/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -80,7 +80,7 @@
-   struct sigcontext *sc;
-   struct rt_sigframe {
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   } *frame;
- 
-   /* rt_sigreturn trampoline:
---- branches/gcc-6-branch/libgcc/config/sh/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/sh/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -180,7 +180,7 @@
-     {
-       struct rt_sigframe {
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
---- branches/gcc-6-branch/libgcc/config/tilepro/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/tilepro/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -61,7 +61,7 @@
-   struct rt_sigframe {
-     unsigned char save_area[C_ABI_SAVE_AREA_SIZE];
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   } *rt_;
- 
-   /* Return if this is not a signal handler.  */
---- branches/gcc-6-branch/libgcc/config/xtensa/linux-unwind.h	2017/07/04 10:22:56	249956
---- b/libgcc/config/xtensa/linux-unwind.h	2017/07/04 10:23:57	249957
-@@ -67,7 +67,7 @@
- 
-   struct rt_sigframe {
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   } *rt_;
- 
-   /* movi a2, __NR_rt_sigreturn; syscall */
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0057-ARM-PR-82445-suppress-32-bit-aligned-ldrd-strd-peeph.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0057-ARM-PR-82445-suppress-32-bit-aligned-ldrd-strd-peeph.patch
deleted file mode 100644
index 0214ab8..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/0057-ARM-PR-82445-suppress-32-bit-aligned-ldrd-strd-peeph.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From ad5bf450aef2ffee6d57ed193fabc5f72f8eaa65 Mon Sep 17 00:00:00 2001
-From: rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu, 19 Oct 2017 13:16:42 +0000
-Subject: [PATCH] [ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing
- with -mno-unaligned-access
-
-Peephole patterns exist in the arm backend to spot load/store
-operations to adjacent memory operations in order to convert them into
-ldrd/strd instructions.  However, when we have strict alignment
-enforced, then we can only do this if the accesses are known to be
-64-bit aligned; this is unlikely to be the case for most loads.  The
-patch adds some alignment checking to the code that validates the
-addresses for use in the peephole patterns.  This should also fix
-incorrect generation of ldrd/strd with unaligned accesses that could
-previously have occurred on ARMv5e where all such operations must be
-64-bit aligned.
-
-I've added some new tests as well.  In doing so I discovered that the
-ldrd/strd peephole tests could never fail since they would match the
-source file name in the scanned assembly as well as any instructions
-of the intended type.  I've fixed those by tightening the scan results
-slightly.
-
-gcc:
-
-* config/arm/arm.c (align_ok_ldrd_strd): New function.
-(mem_ok_for_ldrd_strd): New parameter align.  Extract the alignment of the
-mem into it.
-(gen_operands_ldrd_strd): Validate the alignment of the accesses.
-
-testsuite:
-
-* gcc.target/arm/peep-ldrd-1.c: Tighten test scan pattern.
-* gcc.target/arm/peep-strd-1.c: Likewise.
-* gcc.target/arm/peep-ldrd-2.c: New test.
-* gcc.target/arm/peep-strd-2.c: New test.
-
-
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@253892 138bc75d-0d04-0410-961f-82ee72b054a4
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- gcc/ChangeLog                                      |  8 +++++++
- gcc/config/arm/arm.c                               | 27 ++++++++++++++++++----
- gcc/testsuite/ChangeLog                            |  8 +++++++
- gcc/testsuite/gcc.target/arm/peep-ldrd-1.c         |  2 +-
- .../arm/{peep-ldrd-1.c => peep-ldrd-2.c}           |  4 ++--
- gcc/testsuite/gcc.target/arm/peep-strd-1.c         |  2 +-
- .../arm/{peep-strd-1.c => peep-strd-2.c}           |  4 ++--
- 7 files changed, 44 insertions(+), 11 deletions(-)
- copy gcc/testsuite/gcc.target/arm/{peep-ldrd-1.c => peep-ldrd-2.c} (63%)
- copy gcc/testsuite/gcc.target/arm/{peep-strd-1.c => peep-strd-2.c} (58%)
-
-diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
-index 9c0813d598d..e3da9f77fb6 100644
---- a/gcc/config/arm/arm.c
-+++ b/gcc/config/arm/arm.c
-@@ -15926,12 +15926,23 @@ operands_ok_ldrd_strd (rtx rt, rtx rt2, rtx rn, HOST_WIDE_INT offset,
-   return true;
- }
- 
-+/* Return true if a 64-bit access with alignment ALIGN and with a
-+   constant offset OFFSET from the base pointer is permitted on this
-+   architecture.  */
-+static bool
-+align_ok_ldrd_strd (HOST_WIDE_INT align, HOST_WIDE_INT offset)
-+{
-+  return (unaligned_access
-+	  ? (align >= BITS_PER_WORD && (offset & 3) == 0)
-+	  : (align >= 2 * BITS_PER_WORD && (offset & 7) == 0));
-+}
-+
- /* Helper for gen_operands_ldrd_strd.  Returns true iff the memory
-    operand MEM's address contains an immediate offset from the base
--   register and has no side effects, in which case it sets BASE and
--   OFFSET accordingly.  */
-+   register and has no side effects, in which case it sets BASE,
-+   OFFSET and ALIGN accordingly.  */
- static bool
--mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset)
-+mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset, HOST_WIDE_INT *align)
- {
-   rtx addr;
- 
-@@ -15950,6 +15961,7 @@ mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset)
-   gcc_assert (MEM_P (mem));
- 
-   *offset = const0_rtx;
-+  *align = MEM_ALIGN (mem);
- 
-   addr = XEXP (mem, 0);
- 
-@@ -15990,7 +16002,7 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
-                         bool const_store, bool commute)
- {
-   int nops = 2;
--  HOST_WIDE_INT offsets[2], offset;
-+  HOST_WIDE_INT offsets[2], offset, align[2];
-   rtx base = NULL_RTX;
-   rtx cur_base, cur_offset, tmp;
-   int i, gap;
-@@ -16002,7 +16014,8 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
-      registers, and the corresponding memory offsets.  */
-   for (i = 0; i < nops; i++)
-     {
--      if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset))
-+      if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset,
-+				 &align[i]))
-         return false;
- 
-       if (i == 0)
-@@ -16114,6 +16127,7 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
-       /* Swap the instructions such that lower memory is accessed first.  */
-       std::swap (operands[0], operands[1]);
-       std::swap (operands[2], operands[3]);
-+      std::swap (align[0], align[1]);
-       if (const_store)
-         std::swap (operands[4], operands[5]);
-     }
-@@ -16127,6 +16141,9 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
-   if (gap != 4)
-     return false;
- 
-+  if (!align_ok_ldrd_strd (align[0], offset))
-+    return false;
-+
-   /* Make sure we generate legal instructions.  */
-   if (operands_ok_ldrd_strd (operands[0], operands[1], base, offset,
-                              false, load))
-diff --git a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c b/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
-index eb2b86ee7b6..d49eff6b87e 100644
---- a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
-+++ b/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
-@@ -8,4 +8,4 @@ int foo(int a, int b, int* p, int *q)
-   *p = a;
-   return a;
- }
--/* { dg-final { scan-assembler "ldrd" } } */
-+/* { dg-final { scan-assembler "ldrd\\t" } } */
-diff --git a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c b/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
-similarity index 63%
-copy from gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
-copy to gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
-index eb2b86ee7b6..6822c2b1454 100644
---- a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
-+++ b/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
-@@ -1,6 +1,6 @@
- /* { dg-do compile } */
- /* { dg-require-effective-target arm_prefer_ldrd_strd } */
--/* { dg-options "-O2" }  */
-+/* { dg-options "-O2 -mno-unaligned-access" }  */
- int foo(int a, int b, int* p, int *q)
- {
-   a = p[2] + p[3];
-@@ -8,4 +8,4 @@ int foo(int a, int b, int* p, int *q)
-   *p = a;
-   return a;
- }
--/* { dg-final { scan-assembler "ldrd" } } */
-+/* { dg-final { scan-assembler-not "ldrd\\t" } } */
-diff --git a/gcc/testsuite/gcc.target/arm/peep-strd-1.c b/gcc/testsuite/gcc.target/arm/peep-strd-1.c
-index bd330769599..fe1beac7229 100644
---- a/gcc/testsuite/gcc.target/arm/peep-strd-1.c
-+++ b/gcc/testsuite/gcc.target/arm/peep-strd-1.c
-@@ -6,4 +6,4 @@ void foo(int a, int b, int* p)
-   p[2] = a;
-   p[3] = b;
- }
--/* { dg-final { scan-assembler "strd" } } */
-+/* { dg-final { scan-assembler "strd\\t" } } */
-diff --git a/gcc/testsuite/gcc.target/arm/peep-strd-1.c b/gcc/testsuite/gcc.target/arm/peep-strd-2.c
-similarity index 58%
-copy from gcc/testsuite/gcc.target/arm/peep-strd-1.c
-copy to gcc/testsuite/gcc.target/arm/peep-strd-2.c
-index bd330769599..bfc5ebe9eec 100644
---- a/gcc/testsuite/gcc.target/arm/peep-strd-1.c
-+++ b/gcc/testsuite/gcc.target/arm/peep-strd-2.c
-@@ -1,9 +1,9 @@
- /* { dg-do compile } */
- /* { dg-require-effective-target arm_prefer_ldrd_strd } */
--/* { dg-options "-O2" }  */
-+/* { dg-options "-O2 -mno-unaligned-access" }  */
- void foo(int a, int b, int* p)
- {
-   p[2] = a;
-   p[3] = b;
- }
--/* { dg-final { scan-assembler "strd" } } */
-+/* { dg-final { scan-assembler-not "strd\\t" } } */
--- 
-2.15.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-enable-FL_LPAE-flag-for-armv7ve-cores.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-enable-FL_LPAE-flag-for-armv7ve-cores.patch
deleted file mode 100644
index 3f664c5..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-enable-FL_LPAE-flag-for-armv7ve-cores.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 22fcc126fad61a8e9ddaaabbc8036644273642dc Mon Sep 17 00:00:00 2001
-From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu, 9 Nov 2017 14:34:28 +0000
-Subject: [PATCH] enable FL_LPAE flag for armv7ve cores
-
-The following commit added the FL_LPAE flag to FL_FOR_ARCH7VE, but
-neglected to also add it to the armv7ve compatible cores defined in
-arm-cores.def.
-
-  https://github.com/gcc-mirror/gcc/commit/af2d9b9e58e8be576c53d94f30c48c68146b0c98
-
-The result is that gcc 6.4 now refuses to allow -march=armv7ve and
--mcpu=XXX to be used together, even when -mcpu is set to an armv7ve
-compatible core:
-
-  arm-linux-gnueabi-gcc -march=armv7ve -mcpu=cortex-a7 -Werror ...
-  error: switch -mcpu=cortex-a7 conflicts with -march=armv7ve switch [-Werror]
-
-Fix by defining flags for armv7ve compatible cores directly from
-FL_FOR_ARCH7VE, rather than re-creating the armv7ve flags
-independently by combining FL_FOR_ARCH7A with the armv7ve specific
-FL_THUMB_DIV and FL_ARM_DIV flags.
-
-Upstream-Status: Backport
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@254584 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- gcc/config/arm/arm-cores.def | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
-index 829b839..ca37e6f 100644
---- a/gcc/config/arm/arm-cores.def
-+++ b/gcc/config/arm/arm-cores.def
-@@ -145,12 +145,12 @@ ARM_CORE("cortex-m0plus.small-multiply",cortexm0plussmallmultiply, cortexm0plus,
- /* V7 Architecture Processors */
- ARM_CORE("generic-armv7-a",	genericv7a, genericv7a,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7A), cortex)
- ARM_CORE("cortex-a5",		cortexa5, cortexa5,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7A), cortex_a5)
--ARM_CORE("cortex-a7",		cortexa7, cortexa7,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a7)
-+ARM_CORE("cortex-a7",		cortexa7, cortexa7,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a7)
- ARM_CORE("cortex-a8",		cortexa8, cortexa8,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7A), cortex_a8)
- ARM_CORE("cortex-a9",		cortexa9, cortexa9,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7A), cortex_a9)
--ARM_CORE("cortex-a12",		cortexa12, cortexa17,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a12)
--ARM_CORE("cortex-a15",		cortexa15, cortexa15,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a15)
--ARM_CORE("cortex-a17",		cortexa17, cortexa17,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a12)
-+ARM_CORE("cortex-a12",		cortexa12, cortexa17,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a12)
-+ARM_CORE("cortex-a15",		cortexa15, cortexa15,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a15)
-+ARM_CORE("cortex-a17",		cortexa17, cortexa17,		7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a12)
- ARM_CORE("cortex-r4",		cortexr4, cortexr4,		7R,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7R), cortex)
- ARM_CORE("cortex-r4f",		cortexr4f, cortexr4f,		7R,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7R), cortex)
- ARM_CORE("cortex-r5",		cortexr5, cortexr5,		7R,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_ARM_DIV | FL_FOR_ARCH7R), cortex)
-@@ -162,8 +162,8 @@ ARM_CORE("cortex-m3",		cortexm3, cortexm3,		7M,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED |
- ARM_CORE("marvell-pj4",		marvell_pj4, marvell_pj4,	7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7A), marvell_pj4)
- 
- /* V7 big.LITTLE implementations */
--ARM_CORE("cortex-a15.cortex-a7", cortexa15cortexa7, cortexa7,	7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a15)
--ARM_CORE("cortex-a17.cortex-a7", cortexa17cortexa7, cortexa7,	7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV | FL_FOR_ARCH7A), cortex_a12)
-+ARM_CORE("cortex-a15.cortex-a7", cortexa15cortexa7, cortexa7,	7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a15)
-+ARM_CORE("cortex-a17.cortex-a7", cortexa17cortexa7, cortexa7,	7A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_FOR_ARCH7VE), cortex_a12)
- 
- /* V8 Architecture Processors */
- ARM_CORE("cortex-a32",	cortexa32, cortexa53,	8A,	ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_CRC32 | FL_FOR_ARCH8A), cortex_a35)
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-i386-Move-struct-ix86_frame-to-machine_function.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-i386-Move-struct-ix86_frame-to-machine_function.patch
deleted file mode 100644
index 00b0ffd..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0001-i386-Move-struct-ix86_frame-to-machine_function.patch
+++ /dev/null
@@ -1,247 +0,0 @@
-From c2c7775c5587dc59b6756162d390d89d60971a16 Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 15 Jan 2018 11:27:24 +0000
-Subject: [PATCH 01/12] i386: Move struct ix86_frame to machine_function
-
-Make ix86_frame available to i386 code generation.  This is needed to
-backport the patch set of -mindirect-branch= to mitigate variant #2 of
-the speculative execution vulnerabilities on x86 processors identified
-by CVE-2017-5715, aka Spectre.
-
-	Backport from mainline
-	2017-06-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>
-
-	* config/i386/i386.c (ix86_frame): Moved to ...
-	* config/i386/i386.h (ix86_frame): Here.
-	(machine_function): Add frame.
-	* config/i386/i386.c (ix86_compute_frame_layout): Repace the
-	frame argument with &cfun->machine->frame.
-	(ix86_can_use_return_insn_p): Don't pass &frame to
-	ix86_compute_frame_layout.  Copy frame from cfun->machine->frame.
-	(ix86_can_eliminate): Likewise.
-	(ix86_expand_prologue): Likewise.
-	(ix86_expand_epilogue): Likewise.
-	(ix86_expand_split_stack_prologue): Likewise.
-
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c | 68 ++++++++++----------------------------------------
- gcc/config/i386/i386.h | 53 ++++++++++++++++++++++++++++++++++++++-
- 2 files changed, 65 insertions(+), 56 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 8b5faac..a1ff32b 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -2434,53 +2434,6 @@ struct GTY(()) stack_local_entry {
-   struct stack_local_entry *next;
- };
- 
--/* Structure describing stack frame layout.
--   Stack grows downward:
--
--   [arguments]
--					<- ARG_POINTER
--   saved pc
--
--   saved static chain			if ix86_static_chain_on_stack
--
--   saved frame pointer			if frame_pointer_needed
--					<- HARD_FRAME_POINTER
--   [saved regs]
--					<- regs_save_offset
--   [padding0]
--
--   [saved SSE regs]
--					<- sse_regs_save_offset
--   [padding1]          |
--		       |		<- FRAME_POINTER
--   [va_arg registers]  |
--		       |
--   [frame]	       |
--		       |
--   [padding2]	       | = to_allocate
--					<- STACK_POINTER
--  */
--struct ix86_frame
--{
--  int nsseregs;
--  int nregs;
--  int va_arg_size;
--  int red_zone_size;
--  int outgoing_arguments_size;
--
--  /* The offsets relative to ARG_POINTER.  */
--  HOST_WIDE_INT frame_pointer_offset;
--  HOST_WIDE_INT hard_frame_pointer_offset;
--  HOST_WIDE_INT stack_pointer_offset;
--  HOST_WIDE_INT hfp_save_offset;
--  HOST_WIDE_INT reg_save_offset;
--  HOST_WIDE_INT sse_reg_save_offset;
--
--  /* When save_regs_using_mov is set, emit prologue using
--     move instead of push instructions.  */
--  bool save_regs_using_mov;
--};
--
- /* Which cpu are we scheduling for.  */
- enum attr_cpu ix86_schedule;
- 
-@@ -2572,7 +2525,7 @@ static unsigned int ix86_function_arg_boundary (machine_mode,
- 						const_tree);
- static rtx ix86_static_chain (const_tree, bool);
- static int ix86_function_regparm (const_tree, const_tree);
--static void ix86_compute_frame_layout (struct ix86_frame *);
-+static void ix86_compute_frame_layout (void);
- static bool ix86_expand_vector_init_one_nonzero (bool, machine_mode,
- 						 rtx, rtx, int);
- static void ix86_add_new_builtins (HOST_WIDE_INT);
-@@ -10944,7 +10897,8 @@ ix86_can_use_return_insn_p (void)
-   if (crtl->args.pops_args && crtl->args.size >= 32768)
-     return 0;
- 
--  ix86_compute_frame_layout (&frame);
-+  ix86_compute_frame_layout ();
-+  frame = cfun->machine->frame;
-   return (frame.stack_pointer_offset == UNITS_PER_WORD
- 	  && (frame.nregs + frame.nsseregs) == 0);
- }
-@@ -11355,8 +11309,8 @@ ix86_can_eliminate (const int from, const int to)
- HOST_WIDE_INT
- ix86_initial_elimination_offset (int from, int to)
- {
--  struct ix86_frame frame;
--  ix86_compute_frame_layout (&frame);
-+  ix86_compute_frame_layout ();
-+  struct ix86_frame frame = cfun->machine->frame;
- 
-   if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
-     return frame.hard_frame_pointer_offset;
-@@ -11395,8 +11349,9 @@ ix86_builtin_setjmp_frame_value (void)
- /* Fill structure ix86_frame about frame of currently computed function.  */
- 
- static void
--ix86_compute_frame_layout (struct ix86_frame *frame)
-+ix86_compute_frame_layout (void)
- {
-+  struct ix86_frame *frame = &cfun->machine->frame;
-   unsigned HOST_WIDE_INT stack_alignment_needed;
-   HOST_WIDE_INT offset;
-   unsigned HOST_WIDE_INT preferred_alignment;
-@@ -12702,7 +12657,8 @@ ix86_expand_prologue (void)
-   m->fs.sp_offset = INCOMING_FRAME_SP_OFFSET;
-   m->fs.sp_valid = true;
- 
--  ix86_compute_frame_layout (&frame);
-+  ix86_compute_frame_layout ();
-+  frame = m->frame;
- 
-   if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
-     {
-@@ -13379,7 +13335,8 @@ ix86_expand_epilogue (int style)
-   bool using_drap;
- 
-   ix86_finalize_stack_realign_flags ();
--  ix86_compute_frame_layout (&frame);
-+  ix86_compute_frame_layout ();
-+  frame = m->frame;
- 
-   m->fs.sp_valid = (!frame_pointer_needed
- 		    || (crtl->sp_is_unchanging
-@@ -13876,7 +13833,8 @@ ix86_expand_split_stack_prologue (void)
-   gcc_assert (flag_split_stack && reload_completed);
- 
-   ix86_finalize_stack_realign_flags ();
--  ix86_compute_frame_layout (&frame);
-+  ix86_compute_frame_layout ();
-+  frame = cfun->machine->frame;
-   allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET;
- 
-   /* This is the label we will branch to if we have enough stack
-diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
-index 8113f83..5414416 100644
---- a/gcc/config/i386/i386.h
-+++ b/gcc/config/i386/i386.h
-@@ -2427,9 +2427,56 @@ enum avx_u128_state
- 
- #define FASTCALL_PREFIX '@'
- 
-+#ifndef USED_FOR_TARGET
-+/* Structure describing stack frame layout.
-+   Stack grows downward:
-+
-+   [arguments]
-+					<- ARG_POINTER
-+   saved pc
-+
-+   saved static chain			if ix86_static_chain_on_stack
-+
-+   saved frame pointer			if frame_pointer_needed
-+					<- HARD_FRAME_POINTER
-+   [saved regs]
-+					<- regs_save_offset
-+   [padding0]
-+
-+   [saved SSE regs]
-+					<- sse_regs_save_offset
-+   [padding1]          |
-+		       |		<- FRAME_POINTER
-+   [va_arg registers]  |
-+		       |
-+   [frame]	       |
-+		       |
-+   [padding2]	       | = to_allocate
-+					<- STACK_POINTER
-+  */
-+struct GTY(()) ix86_frame
-+{
-+  int nsseregs;
-+  int nregs;
-+  int va_arg_size;
-+  int red_zone_size;
-+  int outgoing_arguments_size;
-+
-+  /* The offsets relative to ARG_POINTER.  */
-+  HOST_WIDE_INT frame_pointer_offset;
-+  HOST_WIDE_INT hard_frame_pointer_offset;
-+  HOST_WIDE_INT stack_pointer_offset;
-+  HOST_WIDE_INT hfp_save_offset;
-+  HOST_WIDE_INT reg_save_offset;
-+  HOST_WIDE_INT sse_reg_save_offset;
-+
-+  /* When save_regs_using_mov is set, emit prologue using
-+     move instead of push instructions.  */
-+  bool save_regs_using_mov;
-+};
-+
- /* Machine specific frame tracking during prologue/epilogue generation.  */
- 
--#ifndef USED_FOR_TARGET
- struct GTY(()) machine_frame_state
- {
-   /* This pair tracks the currently active CFA as reg+offset.  When reg
-@@ -2475,6 +2522,9 @@ struct GTY(()) machine_function {
-   int varargs_fpr_size;
-   int optimize_mode_switching[MAX_386_ENTITIES];
- 
-+  /* Cached initial frame layout for the current function.  */
-+  struct ix86_frame frame;
-+
-   /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE
-      has been computed for.  */
-   int use_fast_prologue_epilogue_nregs;
-@@ -2554,6 +2604,7 @@ struct GTY(()) machine_function {
- #define ix86_current_function_calls_tls_descriptor \
-   (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG))
- #define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack)
-+#define ix86_red_zone_size (cfun->machine->frame.red_zone_size)
- 
- /* Control behavior of x86_file_start.  */
- #define X86_FILE_START_VERSION_DIRECTIVE false
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch
deleted file mode 100644
index df65b08..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From fe2b3be3f4b6ec6b3a6f89c26016a3983b7cb351 Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 15 Jan 2018 11:28:44 +0000
-Subject: [PATCH 02/12] i386: Use reference of struct ix86_frame to avoid copy
-
-When there is no need to make a copy of ix86_frame, we can use reference
-of struct ix86_frame to avoid copy.
-
-	Backport from mainline
-	2017-11-06  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
-	of struct ix86_frame.
-	(ix86_initial_elimination_offset): Likewise.
-	(ix86_expand_split_stack_prologue): Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index a1ff32b..13ebf10 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -10887,7 +10887,6 @@ symbolic_reference_mentioned_p (rtx op)
- bool
- ix86_can_use_return_insn_p (void)
- {
--  struct ix86_frame frame;
- 
-   if (! reload_completed || frame_pointer_needed)
-     return 0;
-@@ -10898,7 +10897,7 @@ ix86_can_use_return_insn_p (void)
-     return 0;
- 
-   ix86_compute_frame_layout ();
--  frame = cfun->machine->frame;
-+  struct ix86_frame &frame = cfun->machine->frame;
-   return (frame.stack_pointer_offset == UNITS_PER_WORD
- 	  && (frame.nregs + frame.nsseregs) == 0);
- }
-@@ -11310,7 +11309,7 @@ HOST_WIDE_INT
- ix86_initial_elimination_offset (int from, int to)
- {
-   ix86_compute_frame_layout ();
--  struct ix86_frame frame = cfun->machine->frame;
-+  struct ix86_frame &frame = cfun->machine->frame;
- 
-   if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
-     return frame.hard_frame_pointer_offset;
-@@ -13821,7 +13820,6 @@ static GTY(()) rtx split_stack_fn_large;
- void
- ix86_expand_split_stack_prologue (void)
- {
--  struct ix86_frame frame;
-   HOST_WIDE_INT allocate;
-   unsigned HOST_WIDE_INT args_size;
-   rtx_code_label *label;
-@@ -13834,7 +13832,7 @@ ix86_expand_split_stack_prologue (void)
- 
-   ix86_finalize_stack_realign_flags ();
-   ix86_compute_frame_layout ();
--  frame = cfun->machine->frame;
-+  struct ix86_frame &frame = cfun->machine->frame;
-   allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET;
- 
-   /* This is the label we will branch to if we have enough stack
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch
deleted file mode 100644
index a5ffd85..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 82243732dc63e9b90396a5ae4ad99ca36af81355 Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Sat, 27 Jan 2018 13:10:24 +0000
-Subject: [PATCH 03/12] i386: Use const reference of struct ix86_frame to avoid
- copy
-
-We can use const reference of struct ix86_frame to avoid making a local
-copy of ix86_frame.  ix86_expand_epilogue makes a local copy of struct
-ix86_frame and uses the reg_save_offset field as a local variable.  This
-patch uses a separate local variable for reg_save_offset.
-
-Tested on x86-64 with ada.
-
-	Backport from mainline
-	PR target/83905
-	* config/i386/i386.c (ix86_expand_prologue): Use cost reference
-	of struct ix86_frame.
-	(ix86_expand_epilogue): Likewise.  Add a local variable for
-	the reg_save_offset field in struct ix86_frame.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257123 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c | 24 ++++++++++++------------
- 1 file changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 13ebf10..6c98f75 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -12633,7 +12633,6 @@ ix86_expand_prologue (void)
- {
-   struct machine_function *m = cfun->machine;
-   rtx insn, t;
--  struct ix86_frame frame;
-   HOST_WIDE_INT allocate;
-   bool int_registers_saved;
-   bool sse_registers_saved;
-@@ -12657,7 +12656,7 @@ ix86_expand_prologue (void)
-   m->fs.sp_valid = true;
- 
-   ix86_compute_frame_layout ();
--  frame = m->frame;
-+  const struct ix86_frame &frame = cfun->machine->frame;
- 
-   if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
-     {
-@@ -13329,13 +13328,12 @@ ix86_expand_epilogue (int style)
- {
-   struct machine_function *m = cfun->machine;
-   struct machine_frame_state frame_state_save = m->fs;
--  struct ix86_frame frame;
-   bool restore_regs_via_mov;
-   bool using_drap;
- 
-   ix86_finalize_stack_realign_flags ();
-   ix86_compute_frame_layout ();
--  frame = m->frame;
-+  const struct ix86_frame &frame = cfun->machine->frame;
- 
-   m->fs.sp_valid = (!frame_pointer_needed
- 		    || (crtl->sp_is_unchanging
-@@ -13377,11 +13375,13 @@ ix86_expand_epilogue (int style)
- 				  + UNITS_PER_WORD);
-     }
- 
-+  HOST_WIDE_INT reg_save_offset = frame.reg_save_offset;
-+
-   /* Special care must be taken for the normal return case of a function
-      using eh_return: the eax and edx registers are marked as saved, but
-      not restored along this path.  Adjust the save location to match.  */
-   if (crtl->calls_eh_return && style != 2)
--    frame.reg_save_offset -= 2 * UNITS_PER_WORD;
-+    reg_save_offset -= 2 * UNITS_PER_WORD;
- 
-   /* EH_RETURN requires the use of moves to function properly.  */
-   if (crtl->calls_eh_return)
-@@ -13397,11 +13397,11 @@ ix86_expand_epilogue (int style)
-   else if (TARGET_EPILOGUE_USING_MOVE
- 	   && cfun->machine->use_fast_prologue_epilogue
- 	   && (frame.nregs > 1
--	       || m->fs.sp_offset != frame.reg_save_offset))
-+	       || m->fs.sp_offset != reg_save_offset))
-     restore_regs_via_mov = true;
-   else if (frame_pointer_needed
- 	   && !frame.nregs
--	   && m->fs.sp_offset != frame.reg_save_offset)
-+	   && m->fs.sp_offset != reg_save_offset)
-     restore_regs_via_mov = true;
-   else if (frame_pointer_needed
- 	   && TARGET_USE_LEAVE
-@@ -13439,7 +13439,7 @@ ix86_expand_epilogue (int style)
-       rtx t;
- 
-       if (frame.nregs)
--	ix86_emit_restore_regs_using_mov (frame.reg_save_offset, style == 2);
-+	ix86_emit_restore_regs_using_mov (reg_save_offset, style == 2);
- 
-       /* eh_return epilogues need %ecx added to the stack pointer.  */
-       if (style == 2)
-@@ -13529,19 +13529,19 @@ ix86_expand_epilogue (int style)
- 	 epilogues.  */
-       if (!m->fs.sp_valid
-  	  || (TARGET_SEH
--	      && (m->fs.sp_offset - frame.reg_save_offset
-+	      && (m->fs.sp_offset - reg_save_offset
- 		  >= SEH_MAX_FRAME_SIZE)))
- 	{
- 	  pro_epilogue_adjust_stack (stack_pointer_rtx, hard_frame_pointer_rtx,
- 				     GEN_INT (m->fs.fp_offset
--					      - frame.reg_save_offset),
-+					      - reg_save_offset),
- 				     style, false);
- 	}
--      else if (m->fs.sp_offset != frame.reg_save_offset)
-+      else if (m->fs.sp_offset != reg_save_offset)
- 	{
- 	  pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- 				     GEN_INT (m->fs.sp_offset
--					      - frame.reg_save_offset),
-+					      - reg_save_offset),
- 				     style,
- 				     m->fs.cfa_reg == stack_pointer_rtx);
- 	}
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0004-x86-Add-mindirect-branch.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0004-x86-Add-mindirect-branch.patch
deleted file mode 100644
index a9d6e5f..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0004-x86-Add-mindirect-branch.patch
+++ /dev/null
@@ -1,2154 +0,0 @@
-From 6140c2c0bb2b61e69d0da84315e0433ff3520aaa Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 6 Jan 2018 22:29:55 -0800
-Subject: [PATCH 04/12] x86: Add -mindirect-branch=
-
-Add -mindirect-branch= option to convert indirect call and jump to call
-and return thunks.  The default is 'keep', which keeps indirect call and
-jump unmodified.  'thunk' converts indirect call and jump to call and
-return thunk.  'thunk-inline' converts indirect call and jump to inlined
-call and return thunk.  'thunk-extern' converts indirect call and jump to
-external call and return thunk provided in a separate object file.  You
-can control this behavior for a specific function by using the function
-attribute indirect_branch.
-
-2 kinds of thunks are geneated.  Memory thunk where the function address
-is at the top of the stack:
-
-__x86_indirect_thunk:
-	call L2
-L1:
-	pause
-	lfence
-	jmp L1
-L2:
-	lea 8(%rsp), %rsp|lea 4(%esp), %esp
-	ret
-
-Indirect jmp via memory, "jmp mem", is converted to
-
-	push memory
-	jmp __x86_indirect_thunk
-
-Indirect call via memory, "call mem", is converted to
-
-	jmp L2
-L1:
-	push [mem]
-	jmp __x86_indirect_thunk
-L2:
-	call L1
-
-Register thunk where the function address is in a register, reg:
-
-__x86_indirect_thunk_reg:
-	call	L2
-L1:
-	pause
-	lfence
-	jmp	L1
-L2:
-	movq	%reg, (%rsp)|movl    %reg, (%esp)
-	ret
-
-where reg is one of (r|e)ax, (r|e)dx, (r|e)cx, (r|e)bx, (r|e)si, (r|e)di,
-(r|e)bp, r8, r9, r10, r11, r12, r13, r14 and r15.
-
-Indirect jmp via register, "jmp reg", is converted to
-
-	jmp __x86_indirect_thunk_reg
-
-Indirect call via register, "call reg", is converted to
-
-	call __x86_indirect_thunk_reg
-
-gcc/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/i386-opts.h (indirect_branch): New.
-	* config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise.
-	* config/i386/i386.c (ix86_using_red_zone): Disallow red-zone
-	with local indirect jump when converting indirect call and jump.
-	(ix86_set_indirect_branch_type): New.
-	(ix86_set_current_function): Call ix86_set_indirect_branch_type.
-	(indirectlabelno): New.
-	(indirect_thunk_needed): Likewise.
-	(indirect_thunk_bnd_needed): Likewise.
-	(indirect_thunks_used): Likewise.
-	(indirect_thunks_bnd_used): Likewise.
-	(INDIRECT_LABEL): Likewise.
-	(indirect_thunk_name): Likewise.
-	(output_indirect_thunk): Likewise.
-	(output_indirect_thunk_function): Likewise.
-	(ix86_output_indirect_branch_via_reg): Likewise.
-	(ix86_output_indirect_branch_via_push): Likewise.
-	(ix86_output_indirect_branch): Likewise.
-	(ix86_output_indirect_jmp): Likewise.
-	(ix86_code_end): Call output_indirect_thunk_function if needed.
-	(ix86_output_call_insn): Call ix86_output_indirect_branch if
-	needed.
-	(ix86_handle_fndecl_attribute): Handle indirect_branch.
-	(ix86_attribute_table): Add indirect_branch.
-	* config/i386/i386.h (machine_function): Add indirect_branch_type
-	and has_local_indirect_jump.
-	* config/i386/i386.md (indirect_jump): Set has_local_indirect_jump
-	to true.
-	(tablejump): Likewise.
-	(*indirect_jump): Use ix86_output_indirect_jmp.
-	(*tablejump_1): Likewise.
-	(simple_return_indirect_internal): Likewise.
-	* config/i386/i386.opt (mindirect-branch=): New option.
-	(indirect_branch): New.
-	(keep): Likewise.
-	(thunk): Likewise.
-	(thunk-inline): Likewise.
-	(thunk-extern): Likewise.
-	* doc/extend.texi: Document indirect_branch function attribute.
-	* doc/invoke.texi: Document -mindirect-branch= option.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* gcc.target/i386/indirect-thunk-1.c: New test.
-	* gcc.target/i386/indirect-thunk-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386-opts.h                        |  13 +
- gcc/config/i386/i386-protos.h                      |   1 +
- gcc/config/i386/i386.c                             | 639 ++++++++++++++++++++-
- gcc/config/i386/i386.h                             |   7 +
- gcc/config/i386/i386.md                            |  26 +-
- gcc/config/i386/i386.opt                           |  20 +
- gcc/doc/extend.texi                                |  10 +
- gcc/doc/invoke.texi                                |  13 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-1.c   |  20 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c   |  20 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c   |  21 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c   |  21 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-5.c   |  17 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-6.c   |  18 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c   |  44 ++
- .../gcc.target/i386/indirect-thunk-attr-1.c        |  23 +
- .../gcc.target/i386/indirect-thunk-attr-2.c        |  21 +
- .../gcc.target/i386/indirect-thunk-attr-3.c        |  23 +
- .../gcc.target/i386/indirect-thunk-attr-4.c        |  22 +
- .../gcc.target/i386/indirect-thunk-attr-5.c        |  22 +
- .../gcc.target/i386/indirect-thunk-attr-6.c        |  21 +
- .../gcc.target/i386/indirect-thunk-attr-7.c        |  44 ++
- .../gcc.target/i386/indirect-thunk-attr-8.c        |  42 ++
- .../gcc.target/i386/indirect-thunk-bnd-1.c         |  20 +
- .../gcc.target/i386/indirect-thunk-bnd-2.c         |  21 +
- .../gcc.target/i386/indirect-thunk-bnd-3.c         |  19 +
- .../gcc.target/i386/indirect-thunk-bnd-4.c         |  20 +
- .../gcc.target/i386/indirect-thunk-extern-1.c      |  19 +
- .../gcc.target/i386/indirect-thunk-extern-2.c      |  19 +
- .../gcc.target/i386/indirect-thunk-extern-3.c      |  20 +
- .../gcc.target/i386/indirect-thunk-extern-4.c      |  20 +
- .../gcc.target/i386/indirect-thunk-extern-5.c      |  16 +
- .../gcc.target/i386/indirect-thunk-extern-6.c      |  17 +
- .../gcc.target/i386/indirect-thunk-extern-7.c      |  43 ++
- .../gcc.target/i386/indirect-thunk-inline-1.c      |  20 +
- .../gcc.target/i386/indirect-thunk-inline-2.c      |  20 +
- .../gcc.target/i386/indirect-thunk-inline-3.c      |  21 +
- .../gcc.target/i386/indirect-thunk-inline-4.c      |  21 +
- .../gcc.target/i386/indirect-thunk-inline-5.c      |  17 +
- .../gcc.target/i386/indirect-thunk-inline-6.c      |  18 +
- .../gcc.target/i386/indirect-thunk-inline-7.c      |  44 ++
- 41 files changed, 1486 insertions(+), 17 deletions(-)
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-
-diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
-index b7f92e3..cc21152 100644
---- a/gcc/config/i386/i386-opts.h
-+++ b/gcc/config/i386/i386-opts.h
-@@ -99,4 +99,17 @@ enum stack_protector_guard {
-   SSP_GLOBAL    /* global canary */
- };
- 
-+/* This is used to mitigate variant #2 of the speculative execution
-+   vulnerabilities on x86 processors identified by CVE-2017-5715, aka
-+   Spectre.  They convert indirect branches and function returns to
-+   call and return thunks to avoid speculative execution via indirect
-+   call, jmp and ret.  */
-+enum indirect_branch {
-+  indirect_branch_unset = 0,
-+  indirect_branch_keep,
-+  indirect_branch_thunk,
-+  indirect_branch_thunk_inline,
-+  indirect_branch_thunk_extern
-+};
-+
- #endif
-diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
-index ff47bc1..eca4cbf 100644
---- a/gcc/config/i386/i386-protos.h
-+++ b/gcc/config/i386/i386-protos.h
-@@ -311,6 +311,7 @@ extern enum attr_cpu ix86_schedule;
- #endif
- 
- extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
-+extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p);
- extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
- 						enum machine_mode mode);
- 
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 6c98f75..0b9fc4d 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -3662,12 +3662,23 @@ make_pass_stv (gcc::context *ctxt)
-   return new pass_stv (ctxt);
- }
- 
--/* Return true if a red-zone is in use.  */
-+/* Return true if a red-zone is in use.  We can't use red-zone when
-+   there are local indirect jumps, like "indirect_jump" or "tablejump",
-+   which jumps to another place in the function, since "call" in the
-+   indirect thunk pushes the return address onto stack, destroying
-+   red-zone.
-+
-+   TODO: If we can reserve the first 2 WORDs, for PUSH and, another
-+   for CALL, in red-zone, we can allow local indirect jumps with
-+   indirect thunk.  */
- 
- bool
- ix86_using_red_zone (void)
- {
--  return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI;
-+  return (TARGET_RED_ZONE
-+	  && !TARGET_64BIT_MS_ABI
-+	  && (!cfun->machine->has_local_indirect_jump
-+	      || cfun->machine->indirect_branch_type == indirect_branch_keep));
- }
- 
- /* Return a string that documents the current -m options.  The caller is
-@@ -6350,6 +6361,37 @@ ix86_reset_previous_fndecl (void)
-   ix86_previous_fndecl = NULL_TREE;
- }
- 
-+/* Set the indirect_branch_type field from the function FNDECL.  */
-+
-+static void
-+ix86_set_indirect_branch_type (tree fndecl)
-+{
-+  if (cfun->machine->indirect_branch_type == indirect_branch_unset)
-+    {
-+      tree attr = lookup_attribute ("indirect_branch",
-+				    DECL_ATTRIBUTES (fndecl));
-+      if (attr != NULL)
-+	{
-+	  tree args = TREE_VALUE (attr);
-+	  if (args == NULL)
-+	    gcc_unreachable ();
-+	  tree cst = TREE_VALUE (args);
-+	  if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
-+	    cfun->machine->indirect_branch_type = indirect_branch_keep;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
-+	    cfun->machine->indirect_branch_type = indirect_branch_thunk;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
-+	    cfun->machine->indirect_branch_type = indirect_branch_thunk_inline;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
-+	    cfun->machine->indirect_branch_type = indirect_branch_thunk_extern;
-+	  else
-+	    gcc_unreachable ();
-+	}
-+      else
-+	cfun->machine->indirect_branch_type = ix86_indirect_branch;
-+    }
-+}
-+
- /* Establish appropriate back-end context for processing the function
-    FNDECL.  The argument might be NULL to indicate processing at top
-    level, outside of any function scope.  */
-@@ -6360,7 +6402,13 @@ ix86_set_current_function (tree fndecl)
-      several times in the course of compiling a function, and we don't want to
-      slow things down too much or call target_reinit when it isn't safe.  */
-   if (fndecl == ix86_previous_fndecl)
--    return;
-+    {
-+      /* There may be 2 function bodies for the same function FNDECL,
-+	 one is extern inline and one isn't.  */
-+      if (fndecl != NULL_TREE)
-+	ix86_set_indirect_branch_type (fndecl);
-+      return;
-+    }
- 
-   tree old_tree;
-   if (ix86_previous_fndecl == NULL_TREE)
-@@ -6377,6 +6425,8 @@ ix86_set_current_function (tree fndecl)
-       return;
-     }
- 
-+  ix86_set_indirect_branch_type (fndecl);
-+
-   tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
-   if (new_tree == NULL_TREE)
-     new_tree = target_option_default_node;
-@@ -10962,6 +11012,220 @@ ix86_setup_frame_addresses (void)
- # endif
- #endif
- 
-+/* Label count for call and return thunks.  It is used to make unique
-+   labels in call and return thunks.  */
-+static int indirectlabelno;
-+
-+/* True if call and return thunk functions are needed.  */
-+static bool indirect_thunk_needed = false;
-+/* True if call and return thunk functions with the BND prefix are
-+   needed.  */
-+static bool indirect_thunk_bnd_needed = false;
-+
-+/* Bit masks of integer registers, which contain branch target, used
-+   by call and return thunks functions.  */
-+static int indirect_thunks_used;
-+/* Bit masks of integer registers, which contain branch target, used
-+   by call and return thunks functions with the BND prefix.  */
-+static int indirect_thunks_bnd_used;
-+
-+#ifndef INDIRECT_LABEL
-+# define INDIRECT_LABEL "LIND"
-+#endif
-+
-+/* Fills in the label name that should be used for the indirect thunk.  */
-+
-+static void
-+indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
-+{
-+  if (USE_HIDDEN_LINKONCE)
-+    {
-+      const char *bnd = need_bnd_p ? "_bnd" : "";
-+      if (regno >= 0)
-+	{
-+	  const char *reg_prefix;
-+	  if (LEGACY_INT_REGNO_P (regno))
-+	    reg_prefix = TARGET_64BIT ? "r" : "e";
-+	  else
-+	    reg_prefix = "";
-+	  sprintf (name, "__x86_indirect_thunk%s_%s%s",
-+		   bnd, reg_prefix, reg_names[regno]);
-+	}
-+      else
-+	sprintf (name, "__x86_indirect_thunk%s", bnd);
-+    }
-+  else
-+    {
-+      if (regno >= 0)
-+	{
-+	  if (need_bnd_p)
-+	    ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno);
-+	  else
-+	    ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
-+	}
-+      else
-+	{
-+	  if (need_bnd_p)
-+	    ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0);
-+	  else
-+	    ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
-+	}
-+    }
-+}
-+
-+/* Output a call and return thunk for indirect branch.  If BND_P is
-+   true, the BND prefix is needed.   If REGNO != -1,  the function
-+   address is in REGNO and the call and return thunk looks like:
-+
-+	call	L2
-+   L1:
-+	pause
-+	jmp	L1
-+   L2:
-+	mov	%REG, (%sp)
-+	ret
-+
-+   Otherwise, the function address is on the top of stack and the
-+   call and return thunk looks like:
-+
-+	call L2
-+  L1:
-+	pause
-+	jmp L1
-+  L2:
-+	lea WORD_SIZE(%sp), %sp
-+	ret
-+ */
-+
-+static void
-+output_indirect_thunk (bool need_bnd_p, int regno)
-+{
-+  char indirectlabel1[32];
-+  char indirectlabel2[32];
-+
-+  ASM_GENERATE_INTERNAL_LABEL (indirectlabel1, INDIRECT_LABEL,
-+			       indirectlabelno++);
-+  ASM_GENERATE_INTERNAL_LABEL (indirectlabel2, INDIRECT_LABEL,
-+			       indirectlabelno++);
-+
-+  /* Call */
-+  if (need_bnd_p)
-+    fputs ("\tbnd call\t", asm_out_file);
-+  else
-+    fputs ("\tcall\t", asm_out_file);
-+  assemble_name_raw (asm_out_file, indirectlabel2);
-+  fputc ('\n', asm_out_file);
-+
-+  ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
-+
-+  /* Pause + lfence.  */
-+  fprintf (asm_out_file, "\tpause\n\tlfence\n");
-+
-+  /* Jump.  */
-+  fputs ("\tjmp\t", asm_out_file);
-+  assemble_name_raw (asm_out_file, indirectlabel1);
-+  fputc ('\n', asm_out_file);
-+
-+  ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
-+
-+  if (regno >= 0)
-+    {
-+      /* MOV.  */
-+      rtx xops[2];
-+      xops[0] = gen_rtx_MEM (word_mode, stack_pointer_rtx);
-+      xops[1] = gen_rtx_REG (word_mode, regno);
-+      output_asm_insn ("mov\t{%1, %0|%0, %1}", xops);
-+    }
-+  else
-+    {
-+      /* LEA.  */
-+      rtx xops[2];
-+      xops[0] = stack_pointer_rtx;
-+      xops[1] = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD);
-+      output_asm_insn ("lea\t{%E1, %0|%0, %E1}", xops);
-+    }
-+
-+  if (need_bnd_p)
-+    fputs ("\tbnd ret\n", asm_out_file);
-+  else
-+    fputs ("\tret\n", asm_out_file);
-+}
-+
-+/* Output a funtion with a call and return thunk for indirect branch.
-+   If BND_P is true, the BND prefix is needed.   If REGNO != -1,  the
-+   function address is in REGNO.  Otherwise, the function address is
-+   on the top of stack.  */
-+
-+static void
-+output_indirect_thunk_function (bool need_bnd_p, int regno)
-+{
-+  char name[32];
-+  tree decl;
-+
-+  /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd.  */
-+  indirect_thunk_name (name, regno, need_bnd_p);
-+  decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
-+		     get_identifier (name),
-+		     build_function_type_list (void_type_node, NULL_TREE));
-+  DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
-+				   NULL_TREE, void_type_node);
-+  TREE_PUBLIC (decl) = 1;
-+  TREE_STATIC (decl) = 1;
-+  DECL_IGNORED_P (decl) = 1;
-+
-+#if TARGET_MACHO
-+  if (TARGET_MACHO)
-+    {
-+      switch_to_section (darwin_sections[picbase_thunk_section]);
-+      fputs ("\t.weak_definition\t", asm_out_file);
-+      assemble_name (asm_out_file, name);
-+      fputs ("\n\t.private_extern\t", asm_out_file);
-+      assemble_name (asm_out_file, name);
-+      putc ('\n', asm_out_file);
-+      ASM_OUTPUT_LABEL (asm_out_file, name);
-+      DECL_WEAK (decl) = 1;
-+    }
-+  else
-+#endif
-+    if (USE_HIDDEN_LINKONCE)
-+      {
-+	cgraph_node::create (decl)->set_comdat_group (DECL_ASSEMBLER_NAME (decl));
-+
-+	targetm.asm_out.unique_section (decl, 0);
-+	switch_to_section (get_named_section (decl, NULL, 0));
-+
-+	targetm.asm_out.globalize_label (asm_out_file, name);
-+	fputs ("\t.hidden\t", asm_out_file);
-+	assemble_name (asm_out_file, name);
-+	putc ('\n', asm_out_file);
-+	ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl);
-+      }
-+    else
-+      {
-+	switch_to_section (text_section);
-+	ASM_OUTPUT_LABEL (asm_out_file, name);
-+      }
-+
-+  DECL_INITIAL (decl) = make_node (BLOCK);
-+  current_function_decl = decl;
-+  allocate_struct_function (decl, false);
-+  init_function_start (decl);
-+  /* We're about to hide the function body from callees of final_* by
-+     emitting it directly; tell them we're a thunk, if they care.  */
-+  cfun->is_thunk = true;
-+  first_function_block_is_cold = false;
-+  /* Make sure unwind info is emitted for the thunk if needed.  */
-+  final_start_function (emit_barrier (), asm_out_file, 1);
-+
-+  output_indirect_thunk (need_bnd_p, regno);
-+
-+  final_end_function ();
-+  init_insn_lengths ();
-+  free_after_compilation (cfun);
-+  set_cfun (NULL);
-+  current_function_decl = NULL;
-+}
-+
- static int pic_labels_used;
- 
- /* Fills in the label name that should be used for a pc thunk for
-@@ -10988,11 +11252,32 @@ ix86_code_end (void)
-   rtx xops[2];
-   int regno;
- 
-+  if (indirect_thunk_needed)
-+    output_indirect_thunk_function (false, -1);
-+  if (indirect_thunk_bnd_needed)
-+    output_indirect_thunk_function (true, -1);
-+
-+  for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++)
-+    {
-+      int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1;
-+      if ((indirect_thunks_used & (1 << i)))
-+	output_indirect_thunk_function (false, regno);
-+
-+      if ((indirect_thunks_bnd_used & (1 << i)))
-+	output_indirect_thunk_function (true, regno);
-+    }
-+
-   for (regno = AX_REG; regno <= SP_REG; regno++)
-     {
-       char name[32];
-       tree decl;
- 
-+      if ((indirect_thunks_used & (1 << regno)))
-+	output_indirect_thunk_function (false, regno);
-+
-+      if ((indirect_thunks_bnd_used & (1 << regno)))
-+	output_indirect_thunk_function (true, regno);
-+
-       if (!(pic_labels_used & (1 << regno)))
- 	continue;
- 
-@@ -27369,12 +27654,292 @@ ix86_nopic_noplt_attribute_p (rtx call_op)
-   return false;
- }
- 
-+/* Output indirect branch via a call and return thunk.  CALL_OP is a
-+   register which contains the branch target.  XASM is the assembly
-+   template for CALL_OP.  Branch is a tail call if SIBCALL_P is true.
-+   A normal call is converted to:
-+
-+	call __x86_indirect_thunk_reg
-+
-+   and a tail call is converted to:
-+
-+	jmp __x86_indirect_thunk_reg
-+ */
-+
-+static void
-+ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p)
-+{
-+  char thunk_name_buf[32];
-+  char *thunk_name;
-+  bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
-+  int regno = REGNO (call_op);
-+
-+  if (cfun->machine->indirect_branch_type
-+      != indirect_branch_thunk_inline)
-+    {
-+      if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
-+	{
-+	  int i = regno;
-+	  if (i >= FIRST_REX_INT_REG)
-+	    i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
-+	  if (need_bnd_p)
-+	    indirect_thunks_bnd_used |= 1 << i;
-+	  else
-+	    indirect_thunks_used |= 1 << i;
-+	}
-+      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p);
-+      thunk_name = thunk_name_buf;
-+    }
-+  else
-+    thunk_name = NULL;
-+
-+  if (sibcall_p)
-+    {
-+      if (thunk_name != NULL)
-+	{
-+	  if (need_bnd_p)
-+	    fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	  else
-+	    fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, regno);
-+    }
-+  else
-+    {
-+      if (thunk_name != NULL)
-+	{
-+	  if (need_bnd_p)
-+	    fprintf (asm_out_file, "\tbnd call\t%s\n", thunk_name);
-+	  else
-+	    fprintf (asm_out_file, "\tcall\t%s\n", thunk_name);
-+	  return;
-+	}
-+
-+      char indirectlabel1[32];
-+      char indirectlabel2[32];
-+
-+      ASM_GENERATE_INTERNAL_LABEL (indirectlabel1,
-+				   INDIRECT_LABEL,
-+				   indirectlabelno++);
-+      ASM_GENERATE_INTERNAL_LABEL (indirectlabel2,
-+				   INDIRECT_LABEL,
-+				   indirectlabelno++);
-+
-+      /* Jump.  */
-+      if (need_bnd_p)
-+	fputs ("\tbnd jmp\t", asm_out_file);
-+      else
-+	fputs ("\tjmp\t", asm_out_file);
-+      assemble_name_raw (asm_out_file, indirectlabel2);
-+      fputc ('\n', asm_out_file);
-+
-+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
-+
-+      if (thunk_name != NULL)
-+	{
-+	  if (need_bnd_p)
-+	    fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	  else
-+	    fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, regno);
-+
-+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
-+
-+      /* Call.  */
-+      if (need_bnd_p)
-+	fputs ("\tbnd call\t", asm_out_file);
-+      else
-+	fputs ("\tcall\t", asm_out_file);
-+      assemble_name_raw (asm_out_file, indirectlabel1);
-+      fputc ('\n', asm_out_file);
-+    }
-+}
-+
-+/* Output indirect branch via a call and return thunk.  CALL_OP is
-+   the branch target.  XASM is the assembly template for CALL_OP.
-+   Branch is a tail call if SIBCALL_P is true.  A normal call is
-+   converted to:
-+
-+	jmp L2
-+   L1:
-+	push CALL_OP
-+	jmp __x86_indirect_thunk
-+   L2:
-+	call L1
-+
-+   and a tail call is converted to:
-+
-+	push CALL_OP
-+	jmp __x86_indirect_thunk
-+ */
-+
-+static void
-+ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm,
-+				      bool sibcall_p)
-+{
-+  char thunk_name_buf[32];
-+  char *thunk_name;
-+  char push_buf[64];
-+  bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
-+  int regno = -1;
-+
-+  if (cfun->machine->indirect_branch_type
-+      != indirect_branch_thunk_inline)
-+    {
-+      if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
-+	{
-+	  if (need_bnd_p)
-+	    indirect_thunk_bnd_needed = true;
-+	  else
-+	    indirect_thunk_needed = true;
-+	}
-+      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p);
-+      thunk_name = thunk_name_buf;
-+    }
-+  else
-+    thunk_name = NULL;
-+
-+  snprintf (push_buf, sizeof (push_buf), "push{%c}\t%s",
-+	    TARGET_64BIT ? 'q' : 'l', xasm);
-+
-+  if (sibcall_p)
-+    {
-+      output_asm_insn (push_buf, &call_op);
-+      if (thunk_name != NULL)
-+	{
-+	  if (need_bnd_p)
-+	    fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	  else
-+	    fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, regno);
-+    }
-+  else
-+    {
-+      char indirectlabel1[32];
-+      char indirectlabel2[32];
-+
-+      ASM_GENERATE_INTERNAL_LABEL (indirectlabel1,
-+				   INDIRECT_LABEL,
-+				   indirectlabelno++);
-+      ASM_GENERATE_INTERNAL_LABEL (indirectlabel2,
-+				   INDIRECT_LABEL,
-+				   indirectlabelno++);
-+
-+      /* Jump.  */
-+      if (need_bnd_p)
-+	fputs ("\tbnd jmp\t", asm_out_file);
-+      else
-+	fputs ("\tjmp\t", asm_out_file);
-+      assemble_name_raw (asm_out_file, indirectlabel2);
-+      fputc ('\n', asm_out_file);
-+
-+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
-+
-+      /* An external function may be called via GOT, instead of PLT.  */
-+      if (MEM_P (call_op))
-+	{
-+	  struct ix86_address parts;
-+	  rtx addr = XEXP (call_op, 0);
-+	  if (ix86_decompose_address (addr, &parts)
-+	      && parts.base == stack_pointer_rtx)
-+	    {
-+	      /* Since call will adjust stack by -UNITS_PER_WORD,
-+		 we must convert "disp(stack, index, scale)" to
-+		 "disp+UNITS_PER_WORD(stack, index, scale)".  */
-+	      if (parts.index)
-+		{
-+		  addr = gen_rtx_MULT (Pmode, parts.index,
-+				       GEN_INT (parts.scale));
-+		  addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
-+				       addr);
-+		}
-+	      else
-+		addr = stack_pointer_rtx;
-+
-+	      rtx disp;
-+	      if (parts.disp != NULL_RTX)
-+		disp = plus_constant (Pmode, parts.disp,
-+				      UNITS_PER_WORD);
-+	      else
-+		disp = GEN_INT (UNITS_PER_WORD);
-+
-+	      addr = gen_rtx_PLUS (Pmode, addr, disp);
-+	      call_op = gen_rtx_MEM (GET_MODE (call_op), addr);
-+	    }
-+	}
-+
-+      output_asm_insn (push_buf, &call_op);
-+
-+      if (thunk_name != NULL)
-+	{
-+	  if (need_bnd_p)
-+	    fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	  else
-+	    fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, regno);
-+
-+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
-+
-+      /* Call.  */
-+      if (need_bnd_p)
-+	fputs ("\tbnd call\t", asm_out_file);
-+      else
-+	fputs ("\tcall\t", asm_out_file);
-+      assemble_name_raw (asm_out_file, indirectlabel1);
-+      fputc ('\n', asm_out_file);
-+    }
-+}
-+
-+/* Output indirect branch via a call and return thunk.  CALL_OP is
-+   the branch target.  XASM is the assembly template for CALL_OP.
-+   Branch is a tail call if SIBCALL_P is true.   */
-+
-+static void
-+ix86_output_indirect_branch (rtx call_op, const char *xasm,
-+			     bool sibcall_p)
-+{
-+  if (REG_P (call_op))
-+    ix86_output_indirect_branch_via_reg (call_op, sibcall_p);
-+  else
-+    ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p);
-+}
-+/* Output indirect jump.  CALL_OP is the jump target.  Jump is a
-+   function return if RET_P is true.  */
-+
-+const char *
-+ix86_output_indirect_jmp (rtx call_op, bool ret_p)
-+{
-+  if (cfun->machine->indirect_branch_type != indirect_branch_keep)
-+    {
-+      /* We can't have red-zone if this isn't a function return since
-+	 "call" in the indirect thunk pushes the return address onto
-+	 stack, destroying red-zone.  */
-+      if (!ret_p && ix86_red_zone_size != 0)
-+	gcc_unreachable ();
-+
-+      ix86_output_indirect_branch (call_op, "%0", true);
-+      return "";
-+    }
-+  else
-+    return "%!jmp\t%A0";
-+}
-+
- /* Output the assembly for a call instruction.  */
- 
- const char *
- ix86_output_call_insn (rtx_insn *insn, rtx call_op)
- {
-   bool direct_p = constant_call_address_operand (call_op, VOIDmode);
-+  bool output_indirect_p
-+    = (!TARGET_SEH
-+       && cfun->machine->indirect_branch_type != indirect_branch_keep);
-   bool seh_nop_p = false;
-   const char *xasm;
- 
-@@ -27383,7 +27948,13 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
-       if (direct_p)
- 	{
- 	  if (ix86_nopic_noplt_attribute_p (call_op))
--	    xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	    {
-+	      direct_p = false;
-+	      if (output_indirect_p)
-+		xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	      else
-+		xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	    }
- 	  else
- 	    xasm = "%!jmp\t%P0";
- 	}
-@@ -27392,9 +27963,17 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
-       else if (TARGET_SEH)
- 	xasm = "%!rex.W jmp\t%A0";
-       else
--	xasm = "%!jmp\t%A0";
-+	{
-+	  if (output_indirect_p)
-+	    xasm = "%0";
-+	  else
-+	    xasm = "%!jmp\t%A0";
-+	}
- 
--      output_asm_insn (xasm, &call_op);
-+      if (output_indirect_p && !direct_p)
-+	ix86_output_indirect_branch (call_op, xasm, true);
-+      else
-+	output_asm_insn (xasm, &call_op);
-       return "";
-     }
- 
-@@ -27431,14 +28010,28 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
-   if (direct_p)
-     {
-       if (ix86_nopic_noplt_attribute_p (call_op))
--	xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	{
-+	  direct_p = false;
-+	  if (output_indirect_p)
-+	    xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	  else
-+	    xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
-+	}
-       else
- 	xasm = "%!call\t%P0";
-     }
-   else
--    xasm = "%!call\t%A0";
-+    {
-+      if (output_indirect_p)
-+	xasm = "%0";
-+      else
-+	xasm = "%!call\t%A0";
-+    }
- 
--  output_asm_insn (xasm, &call_op);
-+  if (output_indirect_p && !direct_p)
-+    ix86_output_indirect_branch (call_op, xasm, false);
-+  else
-+    output_asm_insn (xasm, &call_op);
- 
-   if (seh_nop_p)
-     return "nop";
-@@ -44836,7 +45429,7 @@ ix86_handle_struct_attribute (tree *node, tree name, tree, int,
- }
- 
- static tree
--ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
-+ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int,
- 			      bool *no_add_attrs)
- {
-   if (TREE_CODE (*node) != FUNCTION_DECL)
-@@ -44845,6 +45438,29 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
-                name);
-       *no_add_attrs = true;
-     }
-+
-+  if (is_attribute_p ("indirect_branch", name))
-+    {
-+      tree cst = TREE_VALUE (args);
-+      if (TREE_CODE (cst) != STRING_CST)
-+	{
-+	  warning (OPT_Wattributes,
-+		   "%qE attribute requires a string constant argument",
-+		   name);
-+	  *no_add_attrs = true;
-+	}
-+      else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
-+	{
-+	  warning (OPT_Wattributes,
-+		   "argument to %qE attribute is not "
-+		   "(keep|thunk|thunk-inline|thunk-extern)", name);
-+	  *no_add_attrs = true;
-+	}
-+    }
-+
-   return NULL_TREE;
- }
- 
-@@ -49072,6 +49688,9 @@ static const struct attribute_spec ix86_attribute_table[] =
-     false },
-   { "callee_pop_aggregate_return", 1, 1, false, true, true,
-     ix86_handle_callee_pop_aggregate_return, true },
-+  { "indirect_branch", 1, 1, true, false, false,
-+    ix86_handle_fndecl_attribute, false },
-+
-   /* End element.  */
-   { NULL,        0, 0, false, false, false, NULL, false }
- };
-diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
-index 5414416..9dccdb0 100644
---- a/gcc/config/i386/i386.h
-+++ b/gcc/config/i386/i386.h
-@@ -2572,6 +2572,13 @@ struct GTY(()) machine_function {
-   /* If true, it is safe to not save/restore DRAP register.  */
-   BOOL_BITFIELD no_drap_save_restore : 1;
- 
-+  /* How to generate indirec branch.  */
-+  ENUM_BITFIELD(indirect_branch) indirect_branch_type : 3;
-+
-+  /* If true, the current function has local indirect jumps, like
-+     "indirect_jump" or "tablejump".  */
-+  BOOL_BITFIELD has_local_indirect_jump : 1;
-+
-   /* If true, there is register available for argument passing.  This
-      is used only in ix86_function_ok_for_sibcall by 32-bit to determine
-      if there is scratch register available for indirect sibcall.  In
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index d2bfe31..153e162 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -11807,13 +11807,18 @@
- {
-   if (TARGET_X32)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-+  cfun->machine->has_local_indirect_jump = true;
- })
- 
- (define_insn "*indirect_jump"
-   [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))]
-   ""
--  "%!jmp\t%A0"
--  [(set_attr "type" "ibr")
-+  "* return ix86_output_indirect_jmp (operands[0], false);"
-+  [(set (attr "type")
-+     (if_then_else (match_test "(cfun->machine->indirect_branch_type
-+				 != indirect_branch_keep)")
-+	(const_string "multi")
-+	(const_string "ibr")))
-    (set_attr "length_immediate" "0")
-    (set_attr "maybe_prefix_bnd" "1")])
- 
-@@ -11856,14 +11861,19 @@
- 
-   if (TARGET_X32)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-+  cfun->machine->has_local_indirect_jump = true;
- })
- 
- (define_insn "*tablejump_1"
-   [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))
-    (use (label_ref (match_operand 1)))]
-   ""
--  "%!jmp\t%A0"
--  [(set_attr "type" "ibr")
-+  "* return ix86_output_indirect_jmp (operands[0], false);"
-+  [(set (attr "type")
-+     (if_then_else (match_test "(cfun->machine->indirect_branch_type
-+				 != indirect_branch_keep)")
-+	(const_string "multi")
-+	(const_string "ibr")))
-    (set_attr "length_immediate" "0")
-    (set_attr "maybe_prefix_bnd" "1")])
- 
-@@ -12520,8 +12530,12 @@
-   [(simple_return)
-    (use (match_operand:SI 0 "register_operand" "r"))]
-   "reload_completed"
--  "%!jmp\t%A0"
--  [(set_attr "type" "ibr")
-+  "* return ix86_output_indirect_jmp (operands[0], true);"
-+  [(set (attr "type")
-+     (if_then_else (match_test "(cfun->machine->indirect_branch_type
-+				 != indirect_branch_keep)")
-+	(const_string "multi")
-+	(const_string "ibr")))
-    (set_attr "length_immediate" "0")
-    (set_attr "maybe_prefix_bnd" "1")])
- 
-diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
-index f304b62..5ffa334 100644
---- a/gcc/config/i386/i386.opt
-+++ b/gcc/config/i386/i386.opt
-@@ -897,3 +897,23 @@ Enum(stack_protector_guard) String(global) Value(SSP_GLOBAL)
- mmitigate-rop
- Target Var(flag_mitigate_rop) Init(0)
- Attempt to avoid generating instruction sequences containing ret bytes.
-+
-+mindirect-branch=
-+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep)
-+Convert indirect call and jump to call and return thunks.
-+
-+Enum
-+Name(indirect_branch) Type(enum indirect_branch)
-+Known indirect branch choices (for use with the -mindirect-branch= option):
-+
-+EnumValue
-+Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
-+
-+EnumValue
-+Enum(indirect_branch) String(thunk) Value(indirect_branch_thunk)
-+
-+EnumValue
-+Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline)
-+
-+EnumValue
-+Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
-diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
-index 8cc4f7e..8668dae 100644
---- a/gcc/doc/extend.texi
-+++ b/gcc/doc/extend.texi
-@@ -5419,6 +5419,16 @@ Specify which floating-point unit to use.  You must specify the
- @code{target("fpmath=sse,387")} option as
- @code{target("fpmath=sse+387")} because the comma would separate
- different options.
-+
-+@item indirect_branch("@var{choice}")
-+@cindex @code{indirect_branch} function attribute, x86
-+On x86 targets, the @code{indirect_branch} attribute causes the compiler
-+to convert indirect call and jump with @var{choice}.  @samp{keep}
-+keeps indirect call and jump unmodified.  @samp{thunk} converts indirect
-+call and jump to call and return thunk.  @samp{thunk-inline} converts
-+indirect call and jump to inlined call and return thunk.
-+@samp{thunk-extern} converts indirect call and jump to external call
-+and return thunk provided in a separate object file.
- @end table
- 
- On the x86, the inliner does not inline a
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index b066f7b..ff9a194 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -1169,7 +1169,7 @@ See RS/6000 and PowerPC Options.
- -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
- -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
- -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
---mmitigate-rop}
-+-mmitigate-rop -mindirect-branch=@var{choice}}
- 
- @emph{x86 Windows Options}
- @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -24218,6 +24218,17 @@ opcodes, to mitigate against certain forms of attack. At the moment,
- this option is limited in what it can do and should not be relied
- on to provide serious protection.
- 
-+@item -mindirect-branch=@var{choice}
-+@opindex -mindirect-branch
-+Convert indirect call and jump with @var{choice}.  The default is
-+@samp{keep}, which keeps indirect call and jump unmodified.
-+@samp{thunk} converts indirect call and jump to call and return thunk.
-+@samp{thunk-inline} converts indirect call and jump to inlined call
-+and return thunk.  @samp{thunk-extern} converts indirect call and jump
-+to external call and return thunk provided in a separate object file.
-+You can control this behavior for a specific function by using the
-+function attribute @code{indirect_branch}.  @xref{Function Attributes}.
-+
- @end table
- 
- These @samp{-m} switches are supported in addition to the above
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-new file mode 100644
-index 0000000..d983e1c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-new file mode 100644
-index 0000000..58f09b4
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-new file mode 100644
-index 0000000..f20d35c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-new file mode 100644
-index 0000000..0eff8fb
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-new file mode 100644
-index 0000000..a25b20d
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-@@ -0,0 +1,17 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */
-+
-+extern void bar (void);
-+
-+void
-+foo (void)
-+{
-+  bar ();
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-new file mode 100644
-index 0000000..cff114a
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-@@ -0,0 +1,18 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */
-+
-+extern void bar (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-new file mode 100644
-index 0000000..afdb600
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-@@ -0,0 +1,44 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+void func0 (void);
-+void func1 (void);
-+void func2 (void);
-+void func3 (void);
-+void func4 (void);
-+void func4 (void);
-+void func5 (void);
-+
-+void
-+bar (int i)
-+{
-+  switch (i)
-+    {
-+    default:
-+      func0 ();
-+      break;
-+    case 1:
-+      func1 ();
-+      break;
-+    case 2:
-+      func2 ();
-+      break;
-+    case 3:
-+      func3 ();
-+      break;
-+    case 4:
-+      func4 ();
-+      break;
-+    case 5:
-+      func5 ();
-+      break;
-+    }
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-new file mode 100644
-index 0000000..d64d978
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-@@ -0,0 +1,23 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+extern void male_indirect_jump (long)
-+  __attribute__ ((indirect_branch("thunk")));
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-new file mode 100644
-index 0000000..9306745
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+__attribute__ ((indirect_branch("thunk")))
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-new file mode 100644
-index 0000000..97744d6
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-@@ -0,0 +1,23 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+extern int male_indirect_jump (long)
-+  __attribute__ ((indirect_branch("thunk-inline")));
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-new file mode 100644
-index 0000000..bfce3ea
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+__attribute__ ((indirect_branch("thunk-inline")))
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-new file mode 100644
-index 0000000..0833606
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+extern int male_indirect_jump (long)
-+  __attribute__ ((indirect_branch("thunk-extern")));
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-new file mode 100644
-index 0000000..2eba0fb
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+__attribute__ ((indirect_branch("thunk-extern")))
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-new file mode 100644
-index 0000000..f58427e
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-@@ -0,0 +1,44 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -fno-pic" } */
-+
-+void func0 (void);
-+void func1 (void);
-+void func2 (void);
-+void func3 (void);
-+void func4 (void);
-+void func4 (void);
-+void func5 (void);
-+
-+__attribute__ ((indirect_branch("thunk-extern")))
-+void
-+bar (int i)
-+{
-+  switch (i)
-+    {
-+    default:
-+      func0 ();
-+      break;
-+    case 1:
-+      func1 ();
-+      break;
-+    case 2:
-+      func2 ();
-+      break;
-+    case 3:
-+      func3 ();
-+      break;
-+    case 4:
-+      func4 ();
-+      break;
-+    case 5:
-+      func5 ();
-+      break;
-+    }
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-new file mode 100644
-index 0000000..564ed39
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-@@ -0,0 +1,42 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+
-+void func0 (void);
-+void func1 (void);
-+void func2 (void);
-+void func3 (void);
-+void func4 (void);
-+void func4 (void);
-+void func5 (void);
-+
-+__attribute__ ((indirect_branch("keep")))
-+void
-+bar (int i)
-+{
-+  switch (i)
-+    {
-+    default:
-+      func0 ();
-+      break;
-+    case 1:
-+      func1 ();
-+      break;
-+    case 2:
-+      func2 ();
-+      break;
-+    case 3:
-+      func3 ();
-+      break;
-+    case 4:
-+      func4 ();
-+      break;
-+    case 5:
-+      func5 ();
-+      break;
-+    }
-+}
-+
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-new file mode 100644
-index 0000000..50fbee2
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile { target { ! x32 } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+
-+void (*dispatch) (char *);
-+char buf[10];
-+
-+void
-+foo (void)
-+{
-+  dispatch (buf);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd ret" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-new file mode 100644
-index 0000000..2976e67
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile { target { ! x32 } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+
-+void (*dispatch) (char *);
-+char buf[10];
-+
-+int
-+foo (void)
-+{
-+  dispatch (buf);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd ret" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-new file mode 100644
-index 0000000..da4bc98
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-@@ -0,0 +1,19 @@
-+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+
-+void bar (char *);
-+char buf[10];
-+
-+void
-+foo (void)
-+{
-+  bar (buf);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "bnd ret" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-new file mode 100644
-index 0000000..c64d12e
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+
-+void bar (char *);
-+char buf[10];
-+
-+int
-+foo (void)
-+{
-+  bar (buf);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler "bnd ret" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-new file mode 100644
-index 0000000..49f27b4
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-@@ -0,0 +1,19 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-new file mode 100644
-index 0000000..a1e3eb6
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-@@ -0,0 +1,19 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-new file mode 100644
-index 0000000..395634e
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-new file mode 100644
-index 0000000..fd3f633
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-new file mode 100644
-index 0000000..ba2f92b
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-@@ -0,0 +1,16 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+
-+extern void bar (void);
-+
-+void
-+foo (void)
-+{
-+  bar ();
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-new file mode 100644
-index 0000000..0c5a2d4
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-@@ -0,0 +1,17 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+
-+extern void bar (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-new file mode 100644
-index 0000000..6652523
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-@@ -0,0 +1,43 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+void func0 (void);
-+void func1 (void);
-+void func2 (void);
-+void func3 (void);
-+void func4 (void);
-+void func4 (void);
-+void func5 (void);
-+
-+void
-+bar (int i)
-+{
-+  switch (i)
-+    {
-+    default:
-+      func0 ();
-+      break;
-+    case 1:
-+      func1 ();
-+      break;
-+    case 2:
-+      func2 ();
-+      break;
-+    case 3:
-+      func3 ();
-+      break;
-+    case 4:
-+      func4 ();
-+      break;
-+    case 5:
-+      func5 ();
-+      break;
-+    }
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-new file mode 100644
-index 0000000..68c0ff7
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-new file mode 100644
-index 0000000..e2da1fc
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-new file mode 100644
-index 0000000..244fec7
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-new file mode 100644
-index 0000000..107ebe3
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch[256];
-+
-+int
-+male_indirect_jump (long offset)
-+{
-+  dispatch[offset](offset);
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-new file mode 100644
-index 0000000..17b04ef
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-@@ -0,0 +1,17 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+
-+extern void bar (void);
-+
-+void
-+foo (void)
-+{
-+  bar ();
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-new file mode 100644
-index 0000000..d9eb112
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-@@ -0,0 +1,18 @@
-+/* { dg-do compile { target *-*-linux* } } */
-+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+
-+extern void bar (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-new file mode 100644
-index 0000000..d02b1dc
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-@@ -0,0 +1,44 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+void func0 (void);
-+void func1 (void);
-+void func2 (void);
-+void func3 (void);
-+void func4 (void);
-+void func4 (void);
-+void func5 (void);
-+
-+void
-+bar (int i)
-+{
-+  switch (i)
-+    {
-+    default:
-+      func0 ();
-+      break;
-+    case 1:
-+      func1 ();
-+      break;
-+    case 2:
-+      func2 ();
-+      break;
-+    case 3:
-+      func3 ();
-+      break;
-+    case 4:
-+      func4 ();
-+      break;
-+    case 5:
-+      func5 ();
-+      break;
-+    }
-+}
-+
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0005-x86-Add-mfunction-return.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0005-x86-Add-mfunction-return.patch
deleted file mode 100644
index 5354c77..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0005-x86-Add-mfunction-return.patch
+++ /dev/null
@@ -1,1570 +0,0 @@
-From e3270814b9e0caad63fbcdfd7ae9da2d52c97497 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 6 Jan 2018 22:29:56 -0800
-Subject: [PATCH 05/12] x86: Add -mfunction-return=
-
-Add -mfunction-return= option to convert function return to call and
-return thunks.  The default is 'keep', which keeps function return
-unmodified.  'thunk' converts function return to call and return thunk.
-'thunk-inline' converts function return to inlined call and return thunk.
-'thunk-extern' converts function return to external call and return
-thunk provided in a separate object file.  You can control this behavior
-for a specific function by using the function attribute function_return.
-
-Function return thunk is the same as memory thunk for -mindirect-branch=
-where the return address is at the top of the stack:
-
-__x86_return_thunk:
-	call L2
-L1:
-	pause
-	lfence
-	jmp L1
-L2:
-	lea 8(%rsp), %rsp|lea 4(%esp), %esp
-	ret
-
-and function return becomes
-
-	jmp __x86_return_thunk
-
--mindirect-branch= tests are updated with -mfunction-return=keep to
-avoid false test failures when -mfunction-return=thunk is added to
-RUNTESTFLAGS for "make check".
-
-gcc/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/i386-protos.h (ix86_output_function_return): New.
-	* config/i386/i386.c (ix86_set_indirect_branch_type): Also
-	set function_return_type.
-	(indirect_thunk_name): Add ret_p to indicate thunk for function
-	return.
-	(output_indirect_thunk_function): Pass false to
-	indirect_thunk_name.
-	(ix86_output_indirect_branch_via_reg): Likewise.
-	(ix86_output_indirect_branch_via_push): Likewise.
-	(output_indirect_thunk_function): Create alias for function
-	return thunk if regno < 0.
-	(ix86_output_function_return): New function.
-	(ix86_handle_fndecl_attribute): Handle function_return.
-	(ix86_attribute_table): Add function_return.
-	* config/i386/i386.h (machine_function): Add
-	function_return_type.
-	* config/i386/i386.md (simple_return_internal): Use
-	ix86_output_function_return.
-	(simple_return_internal_long): Likewise.
-	* config/i386/i386.opt (mfunction-return=): New option.
-	(indirect_branch): Mention -mfunction-return=.
-	* doc/extend.texi: Document function_return function attribute.
-	* doc/invoke.texi: Document -mfunction-return= option.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* gcc.target/i386/indirect-thunk-1.c (dg-options): Add
-	-mfunction-return=keep.
-	* gcc.target/i386/indirect-thunk-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
-	* gcc.target/i386/ret-thunk-1.c: New test.
-	* gcc.target/i386/ret-thunk-10.c: Likewise.
-	* gcc.target/i386/ret-thunk-11.c: Likewise.
-	* gcc.target/i386/ret-thunk-12.c: Likewise.
-	* gcc.target/i386/ret-thunk-13.c: Likewise.
-	* gcc.target/i386/ret-thunk-14.c: Likewise.
-	* gcc.target/i386/ret-thunk-15.c: Likewise.
-	* gcc.target/i386/ret-thunk-16.c: Likewise.
-	* gcc.target/i386/ret-thunk-2.c: Likewise.
-	* gcc.target/i386/ret-thunk-3.c: Likewise.
-	* gcc.target/i386/ret-thunk-4.c: Likewise.
-	* gcc.target/i386/ret-thunk-5.c: Likewise.
-	* gcc.target/i386/ret-thunk-6.c: Likewise.
-	* gcc.target/i386/ret-thunk-7.c: Likewise.
-	* gcc.target/i386/ret-thunk-8.c: Likewise.
-	* gcc.target/i386/ret-thunk-9.c: Likewise.
-
-i386: Don't use ASM_OUTPUT_DEF for TARGET_MACHO
-
-ASM_OUTPUT_DEF isn't defined for TARGET_MACHO.  Use ASM_OUTPUT_LABEL to
-generate the __x86_return_thunk label, instead of the set directive.
-Update testcase to remove the __x86_return_thunk label check.  Since
--fno-pic is ignored on Darwin, update testcases to sscan or "push"
-only on Linux.
-
-gcc/
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR target/83839
-	* config/i386/i386.c (output_indirect_thunk_function): Use
-	ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO
-	for  __x86.return_thunk.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR target/83839
-	* gcc.target/i386/indirect-thunk-1.c: Scan for "push" only on
-	Linux.
-	* gcc.target/i386/indirect-thunk-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-register-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-register-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-register-4.c: Likewise.
-	* gcc.target/i386/ret-thunk-10.c: Likewise.
-	* gcc.target/i386/ret-thunk-11.c: Likewise.
-	* gcc.target/i386/ret-thunk-12.c: Likewise.
-	* gcc.target/i386/ret-thunk-13.c: Likewise.
-	* gcc.target/i386/ret-thunk-14.c: Likewise.
-	* gcc.target/i386/ret-thunk-15.c: Likewise.
-	* gcc.target/i386/ret-thunk-9.c: Don't check the
-	__x86_return_thunk label.
-	Scan for "push" only for Linux.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386-protos.h                      |   1 +
- gcc/config/i386/i386.c                             | 152 +++++++++++++++++++--
- gcc/config/i386/i386.h                             |   3 +
- gcc/config/i386/i386.md                            |   9 +-
- gcc/config/i386/i386.opt                           |   6 +-
- gcc/doc/extend.texi                                |   9 ++
- gcc/doc/invoke.texi                                |  14 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-1.c   |   4 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c   |   4 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c   |   4 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c   |   4 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-5.c   |   2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-6.c   |   2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c   |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-1.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-2.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-3.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-4.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-5.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-6.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-7.c        |   4 +-
- .../gcc.target/i386/indirect-thunk-attr-8.c        |   2 +-
- .../gcc.target/i386/indirect-thunk-bnd-1.c         |   4 +-
- .../gcc.target/i386/indirect-thunk-bnd-2.c         |   4 +-
- .../gcc.target/i386/indirect-thunk-bnd-3.c         |   2 +-
- .../gcc.target/i386/indirect-thunk-bnd-4.c         |   2 +-
- .../gcc.target/i386/indirect-thunk-extern-1.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-extern-2.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-extern-3.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-extern-4.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-extern-5.c      |   2 +-
- .../gcc.target/i386/indirect-thunk-extern-6.c      |   2 +-
- .../gcc.target/i386/indirect-thunk-extern-7.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-inline-1.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-inline-2.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-inline-3.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-inline-4.c      |   4 +-
- .../gcc.target/i386/indirect-thunk-inline-5.c      |   2 +-
- .../gcc.target/i386/indirect-thunk-inline-6.c      |   2 +-
- .../gcc.target/i386/indirect-thunk-inline-7.c      |   4 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-1.c        |  13 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-10.c       |  23 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-11.c       |  23 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-12.c       |  22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-13.c       |  22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-14.c       |  22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-15.c       |  22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-16.c       |  18 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-2.c        |  13 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-3.c        |  12 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-4.c        |  12 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-5.c        |  15 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-6.c        |  14 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-7.c        |  13 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-8.c        |  14 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-9.c        |  24 ++++
- 56 files changed, 516 insertions(+), 74 deletions(-)
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-10.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-11.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-12.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-13.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-14.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-15.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-16.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-3.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-4.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-5.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-6.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-7.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-8.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-
-diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
-index eca4cbf..620d70e 100644
---- a/gcc/config/i386/i386-protos.h
-+++ b/gcc/config/i386/i386-protos.h
-@@ -312,6 +312,7 @@ extern enum attr_cpu ix86_schedule;
- 
- extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
- extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p);
-+extern const char * ix86_output_function_return (bool long_p);
- extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
- 						enum machine_mode mode);
- 
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 0b9fc4d..34e26a3 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -6390,6 +6390,31 @@ ix86_set_indirect_branch_type (tree fndecl)
-       else
- 	cfun->machine->indirect_branch_type = ix86_indirect_branch;
-     }
-+
-+  if (cfun->machine->function_return_type == indirect_branch_unset)
-+    {
-+      tree attr = lookup_attribute ("function_return",
-+				    DECL_ATTRIBUTES (fndecl));
-+      if (attr != NULL)
-+	{
-+	  tree args = TREE_VALUE (attr);
-+	  if (args == NULL)
-+	    gcc_unreachable ();
-+	  tree cst = TREE_VALUE (args);
-+	  if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
-+	    cfun->machine->function_return_type = indirect_branch_keep;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
-+	    cfun->machine->function_return_type = indirect_branch_thunk;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
-+	    cfun->machine->function_return_type = indirect_branch_thunk_inline;
-+	  else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
-+	    cfun->machine->function_return_type = indirect_branch_thunk_extern;
-+	  else
-+	    gcc_unreachable ();
-+	}
-+      else
-+	cfun->machine->function_return_type = ix86_function_return;
-+    }
- }
- 
- /* Establish appropriate back-end context for processing the function
-@@ -11036,8 +11061,12 @@ static int indirect_thunks_bnd_used;
- /* Fills in the label name that should be used for the indirect thunk.  */
- 
- static void
--indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
-+indirect_thunk_name (char name[32], int regno, bool need_bnd_p,
-+		     bool ret_p)
- {
-+  if (regno >= 0 && ret_p)
-+    gcc_unreachable ();
-+
-   if (USE_HIDDEN_LINKONCE)
-     {
-       const char *bnd = need_bnd_p ? "_bnd" : "";
-@@ -11052,7 +11081,10 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
- 		   bnd, reg_prefix, reg_names[regno]);
- 	}
-       else
--	sprintf (name, "__x86_indirect_thunk%s", bnd);
-+	{
-+	  const char *ret = ret_p ? "return" : "indirect";
-+	  sprintf (name, "__x86_%s_thunk%s", ret, bnd);
-+	}
-     }
-   else
-     {
-@@ -11065,10 +11097,20 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
- 	}
-       else
- 	{
--	  if (need_bnd_p)
--	    ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0);
-+	  if (ret_p)
-+	    {
-+	      if (need_bnd_p)
-+		ASM_GENERATE_INTERNAL_LABEL (name, "LRTB", 0);
-+	      else
-+		ASM_GENERATE_INTERNAL_LABEL (name, "LRT", 0);
-+	    }
- 	  else
--	    ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
-+	    {
-+	      if (need_bnd_p)
-+		ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0);
-+	      else
-+		ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
-+	    }
- 	}
-     }
- }
-@@ -11163,7 +11205,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno)
-   tree decl;
- 
-   /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd.  */
--  indirect_thunk_name (name, regno, need_bnd_p);
-+  indirect_thunk_name (name, regno, need_bnd_p, false);
-   decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
- 		     get_identifier (name),
- 		     build_function_type_list (void_type_node, NULL_TREE));
-@@ -11206,6 +11248,36 @@ output_indirect_thunk_function (bool need_bnd_p, int regno)
- 	ASM_OUTPUT_LABEL (asm_out_file, name);
-       }
- 
-+  if (regno < 0)
-+    {
-+      /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd.  */
-+      char alias[32];
-+
-+      indirect_thunk_name (alias, regno, need_bnd_p, true);
-+#if TARGET_MACHO
-+      if (TARGET_MACHO)
-+	{
-+	  fputs ("\t.weak_definition\t", asm_out_file);
-+	  assemble_name (asm_out_file, alias);
-+	  fputs ("\n\t.private_extern\t", asm_out_file);
-+	  assemble_name (asm_out_file, alias);
-+	  putc ('\n', asm_out_file);
-+	  ASM_OUTPUT_LABEL (asm_out_file, alias);
-+	}
-+#else
-+      ASM_OUTPUT_DEF (asm_out_file, alias, name);
-+      if (USE_HIDDEN_LINKONCE)
-+	{
-+	  fputs ("\t.globl\t", asm_out_file);
-+	  assemble_name (asm_out_file, alias);
-+	  putc ('\n', asm_out_file);
-+	  fputs ("\t.hidden\t", asm_out_file);
-+	  assemble_name (asm_out_file, alias);
-+	  putc ('\n', asm_out_file);
-+	}
-+#endif
-+    }
-+
-   DECL_INITIAL (decl) = make_node (BLOCK);
-   current_function_decl = decl;
-   allocate_struct_function (decl, false);
-@@ -27687,7 +27759,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p)
- 	  else
- 	    indirect_thunks_used |= 1 << i;
- 	}
--      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p);
-+      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false);
-       thunk_name = thunk_name_buf;
-     }
-   else
-@@ -27796,7 +27868,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm,
- 	  else
- 	    indirect_thunk_needed = true;
- 	}
--      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p);
-+      indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false);
-       thunk_name = thunk_name_buf;
-     }
-   else
-@@ -27931,6 +28003,46 @@ ix86_output_indirect_jmp (rtx call_op, bool ret_p)
-     return "%!jmp\t%A0";
- }
- 
-+/* Output function return.  CALL_OP is the jump target.  Add a REP
-+   prefix to RET if LONG_P is true and function return is kept.  */
-+
-+const char *
-+ix86_output_function_return (bool long_p)
-+{
-+  if (cfun->machine->function_return_type != indirect_branch_keep)
-+    {
-+      char thunk_name[32];
-+      bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
-+
-+      if (cfun->machine->function_return_type
-+	  != indirect_branch_thunk_inline)
-+	{
-+	  bool need_thunk = (cfun->machine->function_return_type
-+			     == indirect_branch_thunk);
-+	  indirect_thunk_name (thunk_name, -1, need_bnd_p, true);
-+	  if (need_bnd_p)
-+	    {
-+	      indirect_thunk_bnd_needed |= need_thunk;
-+	      fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	    }
-+	  else
-+	    {
-+	      indirect_thunk_needed |= need_thunk;
-+	      fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	    }
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, -1);
-+
-+      return "";
-+    }
-+
-+  if (!long_p || ix86_bnd_prefixed_insn_p (current_output_insn))
-+    return "%!ret";
-+
-+  return "rep%; ret";
-+}
-+
- /* Output the assembly for a call instruction.  */
- 
- const char *
-@@ -45461,6 +45573,28 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int,
- 	}
-     }
- 
-+  if (is_attribute_p ("function_return", name))
-+    {
-+      tree cst = TREE_VALUE (args);
-+      if (TREE_CODE (cst) != STRING_CST)
-+	{
-+	  warning (OPT_Wattributes,
-+		   "%qE attribute requires a string constant argument",
-+		   name);
-+	  *no_add_attrs = true;
-+	}
-+      else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
-+	       && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
-+	{
-+	  warning (OPT_Wattributes,
-+		   "argument to %qE attribute is not "
-+		   "(keep|thunk|thunk-inline|thunk-extern)", name);
-+	  *no_add_attrs = true;
-+	}
-+    }
-+
-   return NULL_TREE;
- }
- 
-@@ -49690,6 +49824,8 @@ static const struct attribute_spec ix86_attribute_table[] =
-     ix86_handle_callee_pop_aggregate_return, true },
-   { "indirect_branch", 1, 1, true, false, false,
-     ix86_handle_fndecl_attribute, false },
-+  { "function_return", 1, 1, true, false, false,
-+    ix86_handle_fndecl_attribute, false },
- 
-   /* End element.  */
-   { NULL,        0, 0, false, false, false, NULL, false }
-diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
-index 9dccdb0..b34bc11 100644
---- a/gcc/config/i386/i386.h
-+++ b/gcc/config/i386/i386.h
-@@ -2579,6 +2579,9 @@ struct GTY(()) machine_function {
-      "indirect_jump" or "tablejump".  */
-   BOOL_BITFIELD has_local_indirect_jump : 1;
- 
-+  /* How to generate function return.  */
-+  ENUM_BITFIELD(indirect_branch) function_return_type : 3;
-+
-   /* If true, there is register available for argument passing.  This
-      is used only in ix86_function_ok_for_sibcall by 32-bit to determine
-      if there is scratch register available for indirect sibcall.  In
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index 153e162..2da671e 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -12489,7 +12489,7 @@
- (define_insn "simple_return_internal"
-   [(simple_return)]
-   "reload_completed"
--  "%!ret"
-+  "* return ix86_output_function_return (false);"
-   [(set_attr "length" "1")
-    (set_attr "atom_unit" "jeu")
-    (set_attr "length_immediate" "0")
-@@ -12503,12 +12503,7 @@
-   [(simple_return)
-    (unspec [(const_int 0)] UNSPEC_REP)]
-   "reload_completed"
--{
--  if (ix86_bnd_prefixed_insn_p (insn))
--    return "%!ret";
--
--  return "rep%; ret";
--}
-+  "* return ix86_output_function_return (true);"
-   [(set_attr "length" "2")
-    (set_attr "atom_unit" "jeu")
-    (set_attr "length_immediate" "0")
-diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
-index 5ffa334..ad5916f 100644
---- a/gcc/config/i386/i386.opt
-+++ b/gcc/config/i386/i386.opt
-@@ -902,9 +902,13 @@ mindirect-branch=
- Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep)
- Convert indirect call and jump to call and return thunks.
- 
-+mfunction-return=
-+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_function_return) Init(indirect_branch_keep)
-+Convert function return to call and return thunk.
-+
- Enum
- Name(indirect_branch) Type(enum indirect_branch)
--Known indirect branch choices (for use with the -mindirect-branch= option):
-+Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
- 
- EnumValue
- Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
-diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
-index 8668dae..2cb6bd1 100644
---- a/gcc/doc/extend.texi
-+++ b/gcc/doc/extend.texi
-@@ -5429,6 +5429,15 @@ call and jump to call and return thunk.  @samp{thunk-inline} converts
- indirect call and jump to inlined call and return thunk.
- @samp{thunk-extern} converts indirect call and jump to external call
- and return thunk provided in a separate object file.
-+
-+@item function_return("@var{choice}")
-+@cindex @code{function_return} function attribute, x86
-+On x86 targets, the @code{function_return} attribute causes the compiler
-+to convert function return with @var{choice}.  @samp{keep} keeps function
-+return unmodified.  @samp{thunk} converts function return to call and
-+return thunk.  @samp{thunk-inline} converts function return to inlined
-+call and return thunk.  @samp{thunk-extern} converts function return to
-+external call and return thunk provided in a separate object file.
- @end table
- 
- On the x86, the inliner does not inline a
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index ff9a194..fa63dc5 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -1169,7 +1169,8 @@ See RS/6000 and PowerPC Options.
- -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
- -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
- -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
---mmitigate-rop -mindirect-branch=@var{choice}}
-+-mmitigate-rop -mindirect-branch=@var{choice} @gol
-+-mfunction-return=@var{choice}}
- 
- @emph{x86 Windows Options}
- @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -24229,6 +24230,17 @@ to external call and return thunk provided in a separate object file.
- You can control this behavior for a specific function by using the
- function attribute @code{indirect_branch}.  @xref{Function Attributes}.
- 
-+@item -mfunction-return=@var{choice}
-+@opindex -mfunction-return
-+Convert function return with @var{choice}.  The default is @samp{keep},
-+which keeps function return unmodified.  @samp{thunk} converts function
-+return to call and return thunk.  @samp{thunk-inline} converts function
-+return to inlined call and return thunk.  @samp{thunk-extern} converts
-+function return to external call and return thunk provided in a separate
-+object file.  You can control this behavior for a specific function by
-+using the function attribute @code{function_return}.
-+@xref{Function Attributes}.
-+
- @end table
- 
- These @samp{-m} switches are supported in addition to the above
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-index d983e1c..e365ef5 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-index 58f09b4..05a51ad 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-index f20d35c..3c0d4c3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-index 0eff8fb..14d4ef6 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-index a25b20d..b4836c3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-index cff114a..1f06bd1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-index afdb600..bc6b47a 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-@@ -35,7 +35,7 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-index d64d978..2257be3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -14,7 +14,7 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-index 9306745..e9cfdc5 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-index 97744d6..f938db0 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -14,7 +14,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-index bfce3ea..4e58599 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -13,7 +13,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-index 0833606..b8d5024 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -14,7 +14,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-index 2eba0fb..455adab 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -13,7 +13,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-index f58427e..4595b84 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-@@ -36,7 +36,7 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-index 564ed39..d730d31 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-index 50fbee2..5e3e118 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { ! x32 } } } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
- 
- void (*dispatch) (char *);
- char buf[10];
-@@ -10,7 +10,7 @@ foo (void)
-   dispatch (buf);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
- /* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-index 2976e67..2801aa4 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { ! x32 } } } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
- 
- void (*dispatch) (char *);
- char buf[10];
-@@ -11,7 +11,7 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
- /* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
- /* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-index da4bc98..70b4fb3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
- 
- void bar (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-index c64d12e..3baf03e 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
--/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
- 
- void bar (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-index 49f27b4..edeb264 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-index a1e3eb6..1d00413 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-index 395634e..06ebf1c 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-index fd3f633..1c8f944 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-index ba2f92b..21740ac 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-index 0c5a2d4..a77c1f4 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-index 6652523..86e9fd1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-@@ -35,7 +35,7 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-index 68c0ff7..3ecde87 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-index e2da1fc..df32a19 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-index 244fec7..9540996 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-index 107ebe3..f3db6e2 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-index 17b04ef..0f687c3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-index d9eb112..b27c6fc 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-index d02b1dc..764a375 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-@@ -35,7 +35,7 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-1.c b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
-new file mode 100644
-index 0000000..7223f67
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
-@@ -0,0 +1,13 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk" } */
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-new file mode 100644
-index 0000000..3a6727b
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-@@ -0,0 +1,23 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } }  } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-new file mode 100644
-index 0000000..b8f6818
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-@@ -0,0 +1,23 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-new file mode 100644
-index 0000000..01b0a02
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-new file mode 100644
-index 0000000..4b497b5
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+
-+extern void (*bar) (void);
-+extern int foo (void) __attribute__ ((function_return("thunk")));
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-new file mode 100644
-index 0000000..4ae4c44
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+__attribute__ ((function_return("thunk-inline")))
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-new file mode 100644
-index 0000000..5b5bc76
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+__attribute__ ((function_return("thunk-extern"), indirect_branch("thunk")))
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-16.c b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
-new file mode 100644
-index 0000000..a16cad1
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
-@@ -0,0 +1,18 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk-extern -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+__attribute__ ((function_return("keep"), indirect_branch("keep")))
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler-not "__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-2.c b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
-new file mode 100644
-index 0000000..c6659e3
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
-@@ -0,0 +1,13 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-3.c b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
-new file mode 100644
-index 0000000..0f7f388
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-4.c b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
-new file mode 100644
-index 0000000..9ae37e8
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep" } */
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-5.c b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
-new file mode 100644
-index 0000000..4bd0d2a
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
-@@ -0,0 +1,15 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep" } */
-+
-+extern void foo (void) __attribute__ ((function_return("thunk")));
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-6.c b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
-new file mode 100644
-index 0000000..053841f
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
-@@ -0,0 +1,14 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep" } */
-+
-+__attribute__ ((function_return("thunk-inline")))
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-7.c b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
-new file mode 100644
-index 0000000..262e678
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
-@@ -0,0 +1,13 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=keep" } */
-+
-+__attribute__ ((function_return("thunk-extern")))
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-8.c b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
-new file mode 100644
-index 0000000..c1658e9
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
-@@ -0,0 +1,14 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
-+
-+extern void foo (void) __attribute__ ((function_return("keep")));
-+
-+void
-+foo (void)
-+{
-+}
-+
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-new file mode 100644
-index 0000000..fa24a1f
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-@@ -0,0 +1,24 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */
-+
-+extern void (*bar) (void);
-+
-+int
-+foo (void)
-+{
-+  bar ();
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */
-+/* { dg-final { scan-assembler-times {\tpause} 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times {\tpause} 2 { target { x32 } } } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 2 { target { x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0006-x86-Add-mindirect-branch-register.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0006-x86-Add-mindirect-branch-register.patch
deleted file mode 100644
index ad73691..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0006-x86-Add-mindirect-branch-register.patch
+++ /dev/null
@@ -1,946 +0,0 @@
-From 3f1c39fb543884d36e759a6dc196a8e914eb4f73 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 6 Jan 2018 22:29:56 -0800
-Subject: [PATCH 06/12] x86: Add -mindirect-branch-register
-
-Add -mindirect-branch-register to force indirect branch via register.
-This is implemented by disabling patterns of indirect branch via memory,
-similar to TARGET_X32.
-
--mindirect-branch= and -mfunction-return= tests are updated with
--mno-indirect-branch-register to avoid false test failures when
--mindirect-branch-register is added to RUNTESTFLAGS for "make check".
-
-gcc/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/constraints.md (Bs): Disallow memory operand for
-	-mindirect-branch-register.
-	(Bw): Likewise.
-	* config/i386/predicates.md (indirect_branch_operand): Likewise.
-	(GOT_memory_operand): Likewise.
-	(call_insn_operand): Likewise.
-	(sibcall_insn_operand): Likewise.
-	(GOT32_symbol_operand): Likewise.
-	* config/i386/i386.md (indirect_jump): Call convert_memory_address
-	for -mindirect-branch-register.
-	(tablejump): Likewise.
-	(*sibcall_memory): Likewise.
-	(*sibcall_value_memory): Likewise.
-	Disallow peepholes of indirect call and jump via memory for
-	-mindirect-branch-register.
-	(*call_pop): Replace m with Bw.
-	(*call_value_pop): Likewise.
-	(*sibcall_pop_memory): Replace m with Bs.
-	* config/i386/i386.opt (mindirect-branch-register): New option.
-	* doc/invoke.texi: Document -mindirect-branch-register option.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* gcc.target/i386/indirect-thunk-1.c (dg-options): Add
-	-mno-indirect-branch-register.
-	* gcc.target/i386/indirect-thunk-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
-	* gcc.target/i386/ret-thunk-10.c: Likewise.
-	* gcc.target/i386/ret-thunk-11.c: Likewise.
-	* gcc.target/i386/ret-thunk-12.c: Likewise.
-	* gcc.target/i386/ret-thunk-13.c: Likewise.
-	* gcc.target/i386/ret-thunk-14.c: Likewise.
-	* gcc.target/i386/ret-thunk-15.c: Likewise.
-	* gcc.target/i386/ret-thunk-9.c: Likewise.
-	* gcc.target/i386/indirect-thunk-register-1.c: New test.
-	* gcc.target/i386/indirect-thunk-register-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-register-3.c: Likewise.
-
-i386: Rename to ix86_indirect_branch_register
-
-Rename the variable for -mindirect-branch-register to
-ix86_indirect_branch_register to match the command-line option name.
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/constraints.md (Bs): Replace
-	ix86_indirect_branch_thunk_register with
-	ix86_indirect_branch_register.
-	(Bw): Likewise.
-	* config/i386/i386.md (indirect_jump): Likewise.
-	(tablejump): Likewise.
-	(*sibcall_memory): Likewise.
-	(*sibcall_value_memory): Likewise.
-	Peepholes of indirect call and jump via memory: Likewise.
-	* config/i386/i386.opt: Likewise.
-	* config/i386/predicates.md (indirect_branch_operand): Likewise.
-	(GOT_memory_operand): Likewise.
-	(call_insn_operand): Likewise.
-	(sibcall_insn_operand): Likewise.
-	(GOT32_symbol_operand): Likewise.
-
-x86: Rewrite ix86_indirect_branch_register logic
-
-Rewrite ix86_indirect_branch_register logic with
-
-(and (not (match_test "ix86_indirect_branch_register"))
-     (original condition before r256662))
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/predicates.md (constant_call_address_operand):
-	Rewrite ix86_indirect_branch_register logic.
-	(sibcall_insn_operand): Likewise.
-
-Don't check ix86_indirect_branch_register for GOT operand
-
-Since GOT_memory_operand and GOT32_symbol_operand are simple pattern
-matches, don't check ix86_indirect_branch_register here.  If needed,
--mindirect-branch= will convert indirect branch via GOT slot to a call
-and return thunk.
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/constraints.md (Bs): Update
-	ix86_indirect_branch_register check.  Don't check
-	ix86_indirect_branch_register with GOT_memory_operand.
-	(Bw): Likewise.
-	* config/i386/predicates.md (GOT_memory_operand): Don't check
-	ix86_indirect_branch_register here.
-	(GOT32_symbol_operand): Likewise.
-
-i386: Rewrite indirect_branch_operand logic
-
-	Backport from mainline
-	2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/predicates.md (indirect_branch_operand): Rewrite
-	ix86_indirect_branch_register logic.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/constraints.md                     |  6 ++--
- gcc/config/i386/i386.md                            | 34 ++++++++++++++--------
- gcc/config/i386/i386.opt                           |  4 +++
- gcc/config/i386/predicates.md                      | 21 +++++++------
- gcc/doc/invoke.texi                                |  6 +++-
- gcc/testsuite/gcc.target/i386/indirect-thunk-1.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-5.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-6.c   |  2 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c   |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-1.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-2.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-3.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-4.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-5.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-6.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-attr-7.c        |  2 +-
- .../gcc.target/i386/indirect-thunk-bnd-1.c         |  2 +-
- .../gcc.target/i386/indirect-thunk-bnd-2.c         |  2 +-
- .../gcc.target/i386/indirect-thunk-bnd-3.c         |  2 +-
- .../gcc.target/i386/indirect-thunk-bnd-4.c         |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-1.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-2.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-3.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-4.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-5.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-6.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-extern-7.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-1.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-2.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-3.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-4.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-5.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-6.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-7.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-register-1.c    | 22 ++++++++++++++
- .../gcc.target/i386/indirect-thunk-register-2.c    | 20 +++++++++++++
- .../gcc.target/i386/indirect-thunk-register-3.c    | 19 ++++++++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-10.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-11.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-12.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-13.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-14.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-15.c       |  2 +-
- gcc/testsuite/gcc.target/i386/ret-thunk-9.c        |  2 +-
- 47 files changed, 147 insertions(+), 63 deletions(-)
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
-
-diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
-index 1a4c701..9204c8e 100644
---- a/gcc/config/i386/constraints.md
-+++ b/gcc/config/i386/constraints.md
-@@ -172,14 +172,16 @@
- 
- (define_constraint "Bs"
-   "@internal Sibcall memory operand."
--  (ior (and (not (match_test "TARGET_X32"))
-+  (ior (and (not (match_test "ix86_indirect_branch_register"))
-+	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "sibcall_memory_operand"))
-        (and (match_test "TARGET_X32 && Pmode == DImode")
- 	    (match_operand 0 "GOT_memory_operand"))))
- 
- (define_constraint "Bw"
-   "@internal Call memory operand."
--  (ior (and (not (match_test "TARGET_X32"))
-+  (ior (and (not (match_test "ix86_indirect_branch_register"))
-+	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "memory_operand"))
-        (and (match_test "TARGET_X32 && Pmode == DImode")
- 	    (match_operand 0 "GOT_memory_operand"))))
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index 2da671e..05a88ff 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -11805,7 +11805,7 @@
-   [(set (pc) (match_operand 0 "indirect_branch_operand"))]
-   ""
- {
--  if (TARGET_X32)
-+  if (TARGET_X32 || ix86_indirect_branch_register)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-   cfun->machine->has_local_indirect_jump = true;
- })
-@@ -11859,7 +11859,7 @@
- 					 OPTAB_DIRECT);
-     }
- 
--  if (TARGET_X32)
-+  if (TARGET_X32 || ix86_indirect_branch_register)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-   cfun->machine->has_local_indirect_jump = true;
- })
-@@ -12048,7 +12048,7 @@
-   [(call (mem:QI (match_operand:W 0 "memory_operand" "m"))
- 	 (match_operand 1))
-    (unspec [(const_int 0)] UNSPEC_PEEPSIB)]
--  "!TARGET_X32"
-+  "!TARGET_X32 && !ix86_indirect_branch_register"
-   "* return ix86_output_call_insn (insn, operands[0]);"
-   [(set_attr "type" "call")])
- 
-@@ -12057,7 +12057,9 @@
- 	(match_operand:W 1 "memory_operand"))
-    (call (mem:QI (match_dup 0))
- 	 (match_operand 3))]
--  "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
-+  "!TARGET_X32
-+   && !ix86_indirect_branch_register
-+   && SIBLING_CALL_P (peep2_next_insn (1))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
-   [(parallel [(call (mem:QI (match_dup 1))
-@@ -12070,7 +12072,9 @@
-    (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
-    (call (mem:QI (match_dup 0))
- 	 (match_operand 3))]
--  "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
-+  "!TARGET_X32
-+   && !ix86_indirect_branch_register
-+   && SIBLING_CALL_P (peep2_next_insn (2))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
-   [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
-@@ -12092,7 +12096,7 @@
- })
- 
- (define_insn "*call_pop"
--  [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lmBz"))
-+  [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lBwBz"))
- 	 (match_operand 1))
-    (set (reg:SI SP_REG)
- 	(plus:SI (reg:SI SP_REG)
-@@ -12112,7 +12116,7 @@
-   [(set_attr "type" "call")])
- 
- (define_insn "*sibcall_pop_memory"
--  [(call (mem:QI (match_operand:SI 0 "memory_operand" "m"))
-+  [(call (mem:QI (match_operand:SI 0 "memory_operand" "Bs"))
- 	 (match_operand 1))
-    (set (reg:SI SP_REG)
- 	(plus:SI (reg:SI SP_REG)
-@@ -12166,7 +12170,9 @@
-   [(set (match_operand:W 0 "register_operand")
-         (match_operand:W 1 "memory_operand"))
-    (set (pc) (match_dup 0))]
--  "!TARGET_X32 && peep2_reg_dead_p (2, operands[0])"
-+  "!TARGET_X32
-+   && !ix86_indirect_branch_register
-+   && peep2_reg_dead_p (2, operands[0])"
-   [(set (pc) (match_dup 1))])
- 
- ;; Call subroutine, returning value in operand 0
-@@ -12244,7 +12250,7 @@
-  	(call (mem:QI (match_operand:W 1 "memory_operand" "m"))
- 	      (match_operand 2)))
-    (unspec [(const_int 0)] UNSPEC_PEEPSIB)]
--  "!TARGET_X32"
-+  "!TARGET_X32 && !ix86_indirect_branch_register"
-   "* return ix86_output_call_insn (insn, operands[1]);"
-   [(set_attr "type" "callv")])
- 
-@@ -12254,7 +12260,9 @@
-    (set (match_operand 2)
-    (call (mem:QI (match_dup 0))
- 		 (match_operand 3)))]
--  "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
-+  "!TARGET_X32
-+   && !ix86_indirect_branch_register
-+   && SIBLING_CALL_P (peep2_next_insn (1))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
-   [(parallel [(set (match_dup 2)
-@@ -12269,7 +12277,9 @@
-    (set (match_operand 2)
- 	(call (mem:QI (match_dup 0))
- 	      (match_operand 3)))]
--  "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
-+  "!TARGET_X32
-+   && !ix86_indirect_branch_register
-+   && SIBLING_CALL_P (peep2_next_insn (2))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
-   [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
-@@ -12294,7 +12304,7 @@
- 
- (define_insn "*call_value_pop"
-   [(set (match_operand 0)
--	(call (mem:QI (match_operand:SI 1 "call_insn_operand" "lmBz"))
-+	(call (mem:QI (match_operand:SI 1 "call_insn_operand" "lBwBz"))
- 	      (match_operand 2)))
-    (set (reg:SI SP_REG)
- 	(plus:SI (reg:SI SP_REG)
-diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
-index ad5916f..a97f84f 100644
---- a/gcc/config/i386/i386.opt
-+++ b/gcc/config/i386/i386.opt
-@@ -921,3 +921,7 @@ Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline)
- 
- EnumValue
- Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
-+
-+mindirect-branch-register
-+Target Report Var(ix86_indirect_branch_register) Init(0)
-+Force indirect call and jump via register.
-diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
-index 93dda7b..d1f0a7d 100644
---- a/gcc/config/i386/predicates.md
-+++ b/gcc/config/i386/predicates.md
-@@ -593,7 +593,8 @@
- ;; Test for a valid operand for indirect branch.
- (define_predicate "indirect_branch_operand"
-   (ior (match_operand 0 "register_operand")
--       (and (not (match_test "TARGET_X32"))
-+       (and (not (match_test "ix86_indirect_branch_register"))
-+	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "memory_operand"))))
- 
- ;; Return true if OP is a memory operands that can be used in sibcalls.
-@@ -636,20 +637,22 @@
-   (ior (match_test "constant_call_address_operand
- 		     (op, mode == VOIDmode ? mode : Pmode)")
-        (match_operand 0 "call_register_no_elim_operand")
--       (ior (and (not (match_test "TARGET_X32"))
--		 (match_operand 0 "memory_operand"))
--	    (and (match_test "TARGET_X32 && Pmode == DImode")
--		 (match_operand 0 "GOT_memory_operand")))))
-+       (and (not (match_test "ix86_indirect_branch_register"))
-+	    (ior (and (not (match_test "TARGET_X32"))
-+		      (match_operand 0 "memory_operand"))
-+		 (and (match_test "TARGET_X32 && Pmode == DImode")
-+		      (match_operand 0 "GOT_memory_operand"))))))
- 
- ;; Similarly, but for tail calls, in which we cannot allow memory references.
- (define_special_predicate "sibcall_insn_operand"
-   (ior (match_test "constant_call_address_operand
- 		     (op, mode == VOIDmode ? mode : Pmode)")
-        (match_operand 0 "register_no_elim_operand")
--       (ior (and (not (match_test "TARGET_X32"))
--		 (match_operand 0 "sibcall_memory_operand"))
--	    (and (match_test "TARGET_X32 && Pmode == DImode")
--		 (match_operand 0 "GOT_memory_operand")))))
-+       (and (not (match_test "ix86_indirect_branch_register"))
-+	    (ior (and (not (match_test "TARGET_X32"))
-+		      (match_operand 0 "sibcall_memory_operand"))
-+		 (and (match_test "TARGET_X32 && Pmode == DImode")
-+		      (match_operand 0 "GOT_memory_operand"))))))
- 
- ;; Return true if OP is a 32-bit GOT symbol operand.
- (define_predicate "GOT32_symbol_operand"
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index fa63dc5..ad9f295 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -1170,7 +1170,7 @@ See RS/6000 and PowerPC Options.
- -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
- -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
- -mmitigate-rop -mindirect-branch=@var{choice} @gol
---mfunction-return=@var{choice}}
-+-mfunction-return=@var{choice} -mindirect-branch-register}
- 
- @emph{x86 Windows Options}
- @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -24241,6 +24241,10 @@ object file.  You can control this behavior for a specific function by
- using the function attribute @code{function_return}.
- @xref{Function Attributes}.
- 
-+@item -mindirect-branch-register
-+@opindex -mindirect-branch-register
-+Force indirect call and jump via register.
-+
- @end table
- 
- These @samp{-m} switches are supported in addition to the above
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-index e365ef5..60d0988 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-index 05a51ad..aac7516 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-index 3c0d4c3..9e24a38 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-index 14d4ef6..127b5d9 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-index b4836c3..fcaa18d 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-index 1f06bd1..e464928 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-index bc6b47a..17c2d0f 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-index 2257be3..9194ccf 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-index e9cfdc5..e51f261 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-index f938db0..4aeec18 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-index 4e58599..ac0e599 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-index b8d5024..573cf1e 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-index 455adab..b2b37fc 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-index 4595b84..4a43e19 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-index 5e3e118..ac84ab6 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { ! x32 } } } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
- 
- void (*dispatch) (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-index 2801aa4..ce655e8 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { ! x32 } } } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
- 
- void (*dispatch) (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-index 70b4fb3..d34485a 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
- 
- void bar (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-index 3baf03e..0e19830 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
- 
- void bar (char *);
- char buf[10];
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-index edeb264..579441f 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-index 1d00413..c92e6f2 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-index 06ebf1c..d9964c2 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-index 1c8f944..d4dca4d 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-index 21740ac..5c07e02 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-index a77c1f4..3eb4406 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-index 86e9fd1..aece938 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-index 3ecde87..3aba5e8 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-index df32a19..0f0181d 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-index 9540996..2eef6f3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-index f3db6e2..e825a10 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- typedef void (*dispatch_t)(long offset);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-index 0f687c3..c6d77e1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-index b27c6fc..6454827 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile { target *-*-linux* } } */
--/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
- 
- extern void bar (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-index 764a375..c67066c 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- void func0 (void);
- void func1 (void);
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
-new file mode 100644
-index 0000000..7d396a3
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
-@@ -0,0 +1,22 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -mindirect-branch-register -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch"  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk\n" } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk_bnd\n" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
-new file mode 100644
-index 0000000..e7e616b
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
-@@ -0,0 +1,20 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mindirect-branch-register -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch"  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
-new file mode 100644
-index 0000000..5320e92
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
-@@ -0,0 +1,19 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mindirect-branch-register -fno-pic" } */
-+
-+typedef void (*dispatch_t)(long offset);
-+
-+dispatch_t dispatch;
-+
-+void
-+male_indirect_jump (long offset)
-+{
-+  dispatch(offset);
-+}
-+
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch"  } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-+/* { dg-final { scan-assembler-not {\t(pause|pause|nop)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-index 3a6727b..e6fea84 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */
- 
- extern void (*bar) (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-index b8f6818..e239ec4 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */
- 
- extern void (*bar) (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-index 01b0a02..fa31813 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
- 
- extern void (*bar) (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-index 4b497b5..fd5b41f 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
- 
- extern void (*bar) (void);
- extern int foo (void) __attribute__ ((function_return("thunk")));
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-index 4ae4c44..d606373 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
- 
- extern void (*bar) (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-index 5b5bc76..75e45e2 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */
- 
- extern void (*bar) (void);
- 
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-index fa24a1f..d1db41c 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-@@ -1,5 +1,5 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */
-+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */
- 
- extern void (*bar) (void);
- 
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch
deleted file mode 100644
index cec84fe..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From 8f0efd692eb8db06d6c00b759c872bd2170b7f7b Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 6 Jan 2018 22:29:56 -0800
-Subject: [PATCH 07/12] x86: Add 'V' register operand modifier
-
-Add 'V', a special modifier which prints the name of the full integer
-register without '%'.  For
-
-extern void (*func_p) (void);
-
-void
-foo (void)
-{
-  asm ("call __x86_indirect_thunk_%V0" : : "a" (func_p));
-}
-
-it generates:
-
-foo:
-	movq	func_p(%rip), %rax
-	call	__x86_indirect_thunk_rax
-	ret
-
-gcc/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/i386.c (print_reg): Print the name of the full
-	integer register without '%'.
-	(ix86_print_operand): Handle 'V'.
-	 * doc/extend.texi: Document 'V' modifier.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* gcc.target/i386/indirect-thunk-register-4.c: New test.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c                                    | 13 ++++++++++++-
- gcc/doc/extend.texi                                       |  3 +++
- gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c | 13 +++++++++++++
- 3 files changed, 28 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 34e26a3..eeca7e5 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -16869,6 +16869,7 @@ put_condition_code (enum rtx_code code, machine_mode mode, bool reverse,
-    If CODE is 'h', pretend the reg is the 'high' byte register.
-    If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.
-    If CODE is 'd', duplicate the operand for AVX instruction.
-+   If CODE is 'V', print naked full integer register name without %.
-  */
- 
- void
-@@ -16879,7 +16880,7 @@ print_reg (rtx x, int code, FILE *file)
-   unsigned int regno;
-   bool duplicated;
- 
--  if (ASSEMBLER_DIALECT == ASM_ATT)
-+  if (ASSEMBLER_DIALECT == ASM_ATT && code != 'V')
-     putc ('%', file);
- 
-   if (x == pc_rtx)
-@@ -16922,6 +16923,14 @@ print_reg (rtx x, int code, FILE *file)
- 	      && regno != FPSR_REG
- 	      && regno != FPCR_REG);
- 
-+  if (code == 'V')
-+    {
-+      if (GENERAL_REGNO_P (regno))
-+	msize = GET_MODE_SIZE (word_mode);
-+      else
-+	error ("'V' modifier on non-integer register");
-+    }
-+
-   duplicated = code == 'd' && TARGET_AVX;
- 
-   switch (msize)
-@@ -17035,6 +17044,7 @@ print_reg (rtx x, int code, FILE *file)
-    & -- print some in-use local-dynamic symbol name.
-    H -- print a memory address offset by 8; used for sse high-parts
-    Y -- print condition for XOP pcom* instruction.
-+   V -- print naked full integer register name without %.
-    + -- print a branch hint as 'cs' or 'ds' prefix
-    ; -- print a semicolon (after prefixes due to bug in older gas).
-    ~ -- print "i" if TARGET_AVX2, "f" otherwise.
-@@ -17259,6 +17269,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
- 	case 'X':
- 	case 'P':
- 	case 'p':
-+	case 'V':
- 	  break;
- 
- 	case 's':
-diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
-index 2cb6bd1..76ba1d4 100644
---- a/gcc/doc/extend.texi
-+++ b/gcc/doc/extend.texi
-@@ -8511,6 +8511,9 @@ The table below shows the list of supported modifiers and their effects.
- @tab @code{2}
- @end multitable
- 
-+@code{V} is a special modifier which prints the name of the full integer
-+register without @code{%}.
-+
- @anchor{x86floatingpointasmoperands}
- @subsubsection x86 Floating-Point @code{asm} Operands
- 
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
-new file mode 100644
-index 0000000..f0cd9b7
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
-@@ -0,0 +1,13 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -mindirect-branch=keep -fno-pic" } */
-+
-+extern void (*func_p) (void);
-+
-+void
-+foo (void)
-+{
-+  asm("call __x86_indirect_thunk_%V0" : : "a" (func_p));
-+}
-+
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_eax" { target ia32 } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_rax" { target { ! ia32 } } } } */
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch
deleted file mode 100644
index d8a5810..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-From 8e0d9bf93e2e2ec03c544572aef4b03a8e7090f3 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 13 Jan 2018 18:01:54 -0800
-Subject: [PATCH 08/12] x86: Disallow -mindirect-branch=/-mfunction-return=
- with -mcmodel=large
-
-Since the thunk function may not be reachable in large code model,
--mcmodel=large is incompatible with -mindirect-branch=thunk,
--mindirect-branch=thunk-extern, -mfunction-return=thunk and
--mfunction-return=thunk-extern.  Issue an error when they are used with
--mcmodel=large.
-
-gcc/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
-	-mcmodel=large with -mindirect-branch=thunk,
-	-mindirect-branch=thunk-extern, -mfunction-return=thunk and
-	-mfunction-return=thunk-extern.
-	* doc/invoke.texi: Document -mcmodel=large is incompatible with
-	-mindirect-branch=thunk, -mindirect-branch=thunk-extern,
-	-mfunction-return=thunk and -mfunction-return=thunk-extern.
-
-gcc/testsuite/
-
-	Backport from mainline
-	2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* gcc.target/i386/indirect-thunk-10.c: New test.
-	* gcc.target/i386/indirect-thunk-8.c: Likewise.
-	* gcc.target/i386/indirect-thunk-9.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-10.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-11.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-9.c: Likewise.
-	* gcc.target/i386/ret-thunk-17.c: Likewise.
-	* gcc.target/i386/ret-thunk-18.c: Likewise.
-	* gcc.target/i386/ret-thunk-19.c: Likewise.
-	* gcc.target/i386/ret-thunk-20.c: Likewise.
-	* gcc.target/i386/ret-thunk-21.c: Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c                             | 26 ++++++++++++++++++++++
- gcc/doc/invoke.texi                                | 11 +++++++++
- gcc/testsuite/gcc.target/i386/indirect-thunk-10.c  |  7 ++++++
- gcc/testsuite/gcc.target/i386/indirect-thunk-8.c   |  7 ++++++
- gcc/testsuite/gcc.target/i386/indirect-thunk-9.c   |  7 ++++++
- .../gcc.target/i386/indirect-thunk-attr-10.c       |  9 ++++++++
- .../gcc.target/i386/indirect-thunk-attr-11.c       |  9 ++++++++
- .../gcc.target/i386/indirect-thunk-attr-9.c        |  9 ++++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-17.c       |  7 ++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-18.c       |  8 +++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-19.c       |  8 +++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-20.c       |  9 ++++++++
- gcc/testsuite/gcc.target/i386/ret-thunk-21.c       |  9 ++++++++
- 13 files changed, 126 insertions(+)
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
- create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-17.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-18.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-19.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-20.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-21.c
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index eeca7e5..9c038be 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -6389,6 +6389,19 @@ ix86_set_indirect_branch_type (tree fndecl)
- 	}
-       else
- 	cfun->machine->indirect_branch_type = ix86_indirect_branch;
-+
-+      /* -mcmodel=large is not compatible with -mindirect-branch=thunk
-+	 nor -mindirect-branch=thunk-extern.  */
-+      if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
-+	  && ((cfun->machine->indirect_branch_type
-+	       == indirect_branch_thunk_extern)
-+	      || (cfun->machine->indirect_branch_type
-+		  == indirect_branch_thunk)))
-+	error ("%<-mindirect-branch=%s%> and %<-mcmodel=large%> are not "
-+	       "compatible",
-+	       ((cfun->machine->indirect_branch_type
-+		 == indirect_branch_thunk_extern)
-+		? "thunk-extern" : "thunk"));
-     }
- 
-   if (cfun->machine->function_return_type == indirect_branch_unset)
-@@ -6414,6 +6427,19 @@ ix86_set_indirect_branch_type (tree fndecl)
- 	}
-       else
- 	cfun->machine->function_return_type = ix86_function_return;
-+
-+      /* -mcmodel=large is not compatible with -mfunction-return=thunk
-+	 nor -mfunction-return=thunk-extern.  */
-+      if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
-+	  && ((cfun->machine->function_return_type
-+	       == indirect_branch_thunk_extern)
-+	      || (cfun->machine->function_return_type
-+		  == indirect_branch_thunk)))
-+	error ("%<-mfunction-return=%s%> and %<-mcmodel=large%> are not "
-+	       "compatible",
-+	       ((cfun->machine->function_return_type
-+		 == indirect_branch_thunk_extern)
-+		? "thunk-extern" : "thunk"));
-     }
- }
- 
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index ad9f295..48e827f 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -24230,6 +24230,11 @@ to external call and return thunk provided in a separate object file.
- You can control this behavior for a specific function by using the
- function attribute @code{indirect_branch}.  @xref{Function Attributes}.
- 
-+Note that @option{-mcmodel=large} is incompatible with
-+@option{-mindirect-branch=thunk} nor
-+@option{-mindirect-branch=thunk-extern} since the thunk function may
-+not be reachable in large code model.
-+
- @item -mfunction-return=@var{choice}
- @opindex -mfunction-return
- Convert function return with @var{choice}.  The default is @samp{keep},
-@@ -24241,6 +24246,12 @@ object file.  You can control this behavior for a specific function by
- using the function attribute @code{function_return}.
- @xref{Function Attributes}.
- 
-+Note that @option{-mcmodel=large} is incompatible with
-+@option{-mfunction-return=thunk} nor
-+@option{-mfunction-return=thunk-extern} since the thunk function may
-+not be reachable in large code model.
-+
-+
- @item -mindirect-branch-register
- @opindex -mindirect-branch-register
- Force indirect call and jump via register.
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
-new file mode 100644
-index 0000000..a0674bd
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mfunction-return=keep -mcmodel=large" } */
-+
-+void
-+bar (void)
-+{
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
-new file mode 100644
-index 0000000..7a80a89
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk -mfunction-return=keep -mcmodel=large" } */
-+
-+void
-+bar (void)
-+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
-new file mode 100644
-index 0000000..d4d45c5
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mfunction-return=keep -mcmodel=large" } */
-+
-+void
-+bar (void)
-+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
-new file mode 100644
-index 0000000..3a2aead
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+__attribute__ ((indirect_branch("thunk-extern")))
-+void
-+bar (void)
-+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
-new file mode 100644
-index 0000000..8e52f03
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+__attribute__ ((indirect_branch("thunk-inline")))
-+void
-+bar (void)
-+{
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
-new file mode 100644
-index 0000000..bdaa4f6
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+__attribute__ ((indirect_branch("thunk")))
-+void
-+bar (void)
-+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-17.c b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
-new file mode 100644
-index 0000000..0605e2c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=keep -mcmodel=large" } */
-+
-+void
-+bar (void)
-+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-18.c b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
-new file mode 100644
-index 0000000..307019d
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+void
-+bar (void)
-+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-19.c b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
-new file mode 100644
-index 0000000..772617f
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
-+
-+__attribute__ ((function_return("thunk")))
-+void
-+bar (void)
-+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-20.c b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
-new file mode 100644
-index 0000000..1e9f9bd
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+__attribute__ ((function_return("thunk-extern")))
-+void
-+bar (void)
-+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */
-+}
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-21.c b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
-new file mode 100644
-index 0000000..eea07f7
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { lp64 } } } */
-+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
-+/* { dg-additional-options "-fPIC" { target fpic } } */
-+
-+__attribute__ ((function_return("thunk-inline")))
-+void
-+bar (void)
-+{
-+}
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch
deleted file mode 100644
index 7364a2c..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From 3eff2adada2b1667b0e76496fa559e0c248ecd84 Mon Sep 17 00:00:00 2001
-From: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu, 25 Jan 2018 19:39:01 +0000
-Subject: [PATCH 09/12] Use INVALID_REGNUM in indirect thunk processing
-
-	Backport from mainline
-	2018-01-17  Uros Bizjak  <ubizjak@gmail.com>
-
-	* config/i386/i386.c (indirect_thunk_name): Declare regno
-	as unsigned int.  Compare regno with INVALID_REGNUM.
-	(output_indirect_thunk): Ditto.
-	(output_indirect_thunk_function): Ditto.
-	(ix86_code_end): Declare regno as unsigned int.  Use INVALID_REGNUM
-	in the call to output_indirect_thunk_function.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257067 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c | 30 +++++++++++++++---------------
- 1 file changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 9c038be..4012657 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -11087,16 +11087,16 @@ static int indirect_thunks_bnd_used;
- /* Fills in the label name that should be used for the indirect thunk.  */
- 
- static void
--indirect_thunk_name (char name[32], int regno, bool need_bnd_p,
--		     bool ret_p)
-+indirect_thunk_name (char name[32], unsigned int regno,
-+		     bool need_bnd_p, bool ret_p)
- {
--  if (regno >= 0 && ret_p)
-+  if (regno != INVALID_REGNUM && ret_p)
-     gcc_unreachable ();
- 
-   if (USE_HIDDEN_LINKONCE)
-     {
-       const char *bnd = need_bnd_p ? "_bnd" : "";
--      if (regno >= 0)
-+      if (regno != INVALID_REGNUM)
- 	{
- 	  const char *reg_prefix;
- 	  if (LEGACY_INT_REGNO_P (regno))
-@@ -11114,7 +11114,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p,
-     }
-   else
-     {
--      if (regno >= 0)
-+      if (regno != INVALID_REGNUM)
- 	{
- 	  if (need_bnd_p)
- 	    ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno);
-@@ -11166,7 +11166,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p,
-  */
- 
- static void
--output_indirect_thunk (bool need_bnd_p, int regno)
-+output_indirect_thunk (bool need_bnd_p, unsigned int regno)
- {
-   char indirectlabel1[32];
-   char indirectlabel2[32];
-@@ -11196,7 +11196,7 @@ output_indirect_thunk (bool need_bnd_p, int regno)
- 
-   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
- 
--  if (regno >= 0)
-+  if (regno != INVALID_REGNUM)
-     {
-       /* MOV.  */
-       rtx xops[2];
-@@ -11220,12 +11220,12 @@ output_indirect_thunk (bool need_bnd_p, int regno)
- }
- 
- /* Output a funtion with a call and return thunk for indirect branch.
--   If BND_P is true, the BND prefix is needed.   If REGNO != -1,  the
--   function address is in REGNO.  Otherwise, the function address is
-+   If BND_P is true, the BND prefix is needed.  If REGNO != INVALID_REGNUM,
-+   the function address is in REGNO.  Otherwise, the function address is
-    on the top of stack.  */
- 
- static void
--output_indirect_thunk_function (bool need_bnd_p, int regno)
-+output_indirect_thunk_function (bool need_bnd_p, unsigned int regno)
- {
-   char name[32];
-   tree decl;
-@@ -11274,7 +11274,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno)
- 	ASM_OUTPUT_LABEL (asm_out_file, name);
-       }
- 
--  if (regno < 0)
-+  if (regno == INVALID_REGNUM)
-     {
-       /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd.  */
-       char alias[32];
-@@ -11348,16 +11348,16 @@ static void
- ix86_code_end (void)
- {
-   rtx xops[2];
--  int regno;
-+  unsigned int regno;
- 
-   if (indirect_thunk_needed)
--    output_indirect_thunk_function (false, -1);
-+    output_indirect_thunk_function (false, INVALID_REGNUM);
-   if (indirect_thunk_bnd_needed)
--    output_indirect_thunk_function (true, -1);
-+    output_indirect_thunk_function (true, INVALID_REGNUM);
- 
-   for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++)
-     {
--      int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1;
-+      unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1;
-       if ((indirect_thunks_used & (1 << i)))
- 	output_indirect_thunk_function (false, regno);
- 
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch
deleted file mode 100644
index 080d741..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From c4300d9ad683e693c90d02d4f1b13183bf2d4acc Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Fri, 2 Feb 2018 16:47:02 +0000
-Subject: [PATCH 10/12] i386: Pass INVALID_REGNUM as invalid register number
-
-	Backport from mainline
-	* config/i386/i386.c (ix86_output_function_return): Pass
-	INVALID_REGNUM, instead of -1, as invalid register number to
-	indirect_thunk_name and output_indirect_thunk.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257341 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 4012657..66502ee 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -28056,7 +28056,8 @@ ix86_output_function_return (bool long_p)
- 	{
- 	  bool need_thunk = (cfun->machine->function_return_type
- 			     == indirect_branch_thunk);
--	  indirect_thunk_name (thunk_name, -1, need_bnd_p, true);
-+	  indirect_thunk_name (thunk_name, INVALID_REGNUM, need_bnd_p,
-+			       true);
- 	  if (need_bnd_p)
- 	    {
- 	      indirect_thunk_bnd_needed |= need_thunk;
-@@ -28069,7 +28070,7 @@ ix86_output_function_return (bool long_p)
- 	    }
- 	}
-       else
--	output_indirect_thunk (need_bnd_p, -1);
-+	output_indirect_thunk (need_bnd_p, INVALID_REGNUM);
- 
-       return "";
-     }
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0011-i386-Update-mfunction-return-for-return-with-pop.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0011-i386-Update-mfunction-return-for-return-with-pop.patch
deleted file mode 100644
index 3b036fb..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0011-i386-Update-mfunction-return-for-return-with-pop.patch
+++ /dev/null
@@ -1,453 +0,0 @@
-From b3a2269c7884378a9afd394ac7e669aab0443b57 Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 26 Feb 2018 15:29:30 +0000
-Subject: [PATCH 11/12] i386: Update -mfunction-return= for return with pop
-
-When -mfunction-return= is used, simple_return_pop_internal should pop
-return address into ECX register, adjust stack by bytes to pop from stack
-and jump to the return thunk via ECX register.
-
-Revision 257992 removed the bool argument from ix86_output_indirect_jmp.
-Update comments to reflect it.
-
-Tested on i686 and x86-64.
-
-	Backport from mainline
-	* config/i386/i386.c (ix86_output_indirect_jmp): Update comments.
-
-	PR target/84530
-	* config/i386/i386-protos.h (ix86_output_indirect_jmp): Remove
-	the bool argument.
-	(ix86_output_indirect_function_return): New prototype.
-	(ix86_split_simple_return_pop_internal): Likewise.
-	* config/i386/i386.c (indirect_return_via_cx): New.
-	(indirect_return_via_cx_bnd): Likewise.
-	(indirect_thunk_name): Handle return va CX_REG.
-	(output_indirect_thunk_function): Create alias for
-	__x86_return_thunk_[re]cx and __x86_return_thunk_[re]cx_bnd.
-	(ix86_output_indirect_jmp): Remove the bool argument.
-	(ix86_output_indirect_function_return): New function.
-	(ix86_split_simple_return_pop_internal): Likewise.
-	* config/i386/i386.md (*indirect_jump): Don't pass false
-	to ix86_output_indirect_jmp.
-	(*tablejump_1): Likewise.
-	(simple_return_pop_internal): Change it to define_insn_and_split.
-	Call ix86_split_simple_return_pop_internal to split it for
-	-mfunction-return=.
-	(simple_return_indirect_internal): Call
-	ix86_output_indirect_function_return instead of
-	ix86_output_indirect_jmp.
-
-gcc/testsuite/
-
-	Backport from mainline
-	PR target/84530
-	* gcc.target/i386/ret-thunk-22.c: New test.
-	* gcc.target/i386/ret-thunk-23.c: Likewise.
-	* gcc.target/i386/ret-thunk-24.c: Likewise.
-	* gcc.target/i386/ret-thunk-25.c: Likewise.
-	* gcc.target/i386/ret-thunk-26.c: Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/i386-protos.h                |   4 +-
- gcc/config/i386/i386.c                       | 127 +++++++++++++++++++++++----
- gcc/config/i386/i386.md                      |  11 ++-
- gcc/testsuite/gcc.target/i386/ret-thunk-22.c |  15 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-23.c |  15 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-24.c |  15 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-25.c |  15 ++++
- gcc/testsuite/gcc.target/i386/ret-thunk-26.c |  40 +++++++++
- 8 files changed, 222 insertions(+), 20 deletions(-)
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-22.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-23.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-24.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-25.c
- create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-26.c
-
-diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
-index 620d70e..c7a0ccb5 100644
---- a/gcc/config/i386/i386-protos.h
-+++ b/gcc/config/i386/i386-protos.h
-@@ -311,8 +311,10 @@ extern enum attr_cpu ix86_schedule;
- #endif
- 
- extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
--extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p);
-+extern const char * ix86_output_indirect_jmp (rtx call_op);
- extern const char * ix86_output_function_return (bool long_p);
-+extern const char * ix86_output_indirect_function_return (rtx ret_op);
-+extern void ix86_split_simple_return_pop_internal (rtx);
- extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
- 						enum machine_mode mode);
- 
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 66502ee..21c3c18 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -11080,6 +11080,12 @@ static int indirect_thunks_used;
-    by call and return thunks functions with the BND prefix.  */
- static int indirect_thunks_bnd_used;
- 
-+/* True if return thunk function via CX is needed.  */
-+static bool indirect_return_via_cx;
-+/* True if return thunk function via CX with the BND prefix is
-+   needed.  */
-+static bool indirect_return_via_cx_bnd;
-+
- #ifndef INDIRECT_LABEL
- # define INDIRECT_LABEL "LIND"
- #endif
-@@ -11090,12 +11096,13 @@ static void
- indirect_thunk_name (char name[32], unsigned int regno,
- 		     bool need_bnd_p, bool ret_p)
- {
--  if (regno != INVALID_REGNUM && ret_p)
-+  if (regno != INVALID_REGNUM && regno != CX_REG && ret_p)
-     gcc_unreachable ();
- 
-   if (USE_HIDDEN_LINKONCE)
-     {
-       const char *bnd = need_bnd_p ? "_bnd" : "";
-+      const char *ret = ret_p ? "return" : "indirect";
-       if (regno != INVALID_REGNUM)
- 	{
- 	  const char *reg_prefix;
-@@ -11103,14 +11110,11 @@ indirect_thunk_name (char name[32], unsigned int regno,
- 	    reg_prefix = TARGET_64BIT ? "r" : "e";
- 	  else
- 	    reg_prefix = "";
--	  sprintf (name, "__x86_indirect_thunk%s_%s%s",
--		   bnd, reg_prefix, reg_names[regno]);
-+	  sprintf (name, "__x86_%s_thunk%s_%s%s",
-+		   ret, bnd, reg_prefix, reg_names[regno]);
- 	}
-       else
--	{
--	  const char *ret = ret_p ? "return" : "indirect";
--	  sprintf (name, "__x86_%s_thunk%s", ret, bnd);
--	}
-+	sprintf (name, "__x86_%s_thunk%s", ret, bnd);
-     }
-   else
-     {
-@@ -11274,9 +11278,23 @@ output_indirect_thunk_function (bool need_bnd_p, unsigned int regno)
- 	ASM_OUTPUT_LABEL (asm_out_file, name);
-       }
- 
-+  /* Create alias for __x86_return_thunk/__x86_return_thunk_bnd or
-+     __x86_return_thunk_ecx/__x86_return_thunk_ecx_bnd.  */
-+  bool need_alias;
-   if (regno == INVALID_REGNUM)
-+    need_alias = true;
-+  else if (regno == CX_REG)
-+    {
-+      if (need_bnd_p)
-+	need_alias = indirect_return_via_cx_bnd;
-+      else
-+	need_alias = indirect_return_via_cx;
-+    }
-+  else
-+    need_alias = false;
-+
-+  if (need_alias)
-     {
--      /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd.  */
-       char alias[32];
- 
-       indirect_thunk_name (alias, regno, need_bnd_p, true);
-@@ -28019,18 +28037,17 @@ ix86_output_indirect_branch (rtx call_op, const char *xasm,
-   else
-     ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p);
- }
--/* Output indirect jump.  CALL_OP is the jump target.  Jump is a
--   function return if RET_P is true.  */
-+
-+/* Output indirect jump.  CALL_OP is the jump target.  */
- 
- const char *
--ix86_output_indirect_jmp (rtx call_op, bool ret_p)
-+ix86_output_indirect_jmp (rtx call_op)
- {
-   if (cfun->machine->indirect_branch_type != indirect_branch_keep)
-     {
--      /* We can't have red-zone if this isn't a function return since
--	 "call" in the indirect thunk pushes the return address onto
--	 stack, destroying red-zone.  */
--      if (!ret_p && ix86_red_zone_size != 0)
-+      /* We can't have red-zone since "call" in the indirect thunk
-+         pushes the return address onto stack, destroying red-zone.  */
-+      if (ix86_red_zone_size != 0)
- 	gcc_unreachable ();
- 
-       ix86_output_indirect_branch (call_op, "%0", true);
-@@ -28081,6 +28098,86 @@ ix86_output_function_return (bool long_p)
-   return "rep%; ret";
- }
- 
-+/* Output indirect function return.  RET_OP is the function return
-+   target.  */
-+
-+const char *
-+ix86_output_indirect_function_return (rtx ret_op)
-+{
-+  if (cfun->machine->function_return_type != indirect_branch_keep)
-+    {
-+      char thunk_name[32];
-+      bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
-+      unsigned int regno = REGNO (ret_op);
-+      gcc_assert (regno == CX_REG);
-+
-+      if (cfun->machine->function_return_type
-+	  != indirect_branch_thunk_inline)
-+	{
-+	  bool need_thunk = (cfun->machine->function_return_type
-+			     == indirect_branch_thunk);
-+	  indirect_thunk_name (thunk_name, regno, need_bnd_p, true);
-+	  if (need_bnd_p)
-+	    {
-+	      if (need_thunk)
-+		{
-+		  indirect_return_via_cx_bnd = true;
-+		  indirect_thunks_bnd_used |= 1 << CX_REG;
-+		}
-+	      fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-+	    }
-+	  else
-+	    {
-+	      if (need_thunk)
-+		{
-+		  indirect_return_via_cx = true;
-+		  indirect_thunks_used |= 1 << CX_REG;
-+		}
-+	      fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-+	    }
-+	}
-+      else
-+	output_indirect_thunk (need_bnd_p, regno);
-+
-+      return "";
-+    }
-+  else
-+    return "%!jmp\t%A0";
-+}
-+
-+/* Split simple return with popping POPC bytes from stack to indirect
-+   branch with stack adjustment .  */
-+
-+void
-+ix86_split_simple_return_pop_internal (rtx popc)
-+{
-+  struct machine_function *m = cfun->machine;
-+  rtx ecx = gen_rtx_REG (SImode, CX_REG);
-+  rtx_insn *insn;
-+
-+  /* There is no "pascal" calling convention in any 64bit ABI.  */
-+  gcc_assert (!TARGET_64BIT);
-+
-+  insn = emit_insn (gen_pop (ecx));
-+  m->fs.cfa_offset -= UNITS_PER_WORD;
-+  m->fs.sp_offset -= UNITS_PER_WORD;
-+
-+  rtx x = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD);
-+  x = gen_rtx_SET (stack_pointer_rtx, x);
-+  add_reg_note (insn, REG_CFA_ADJUST_CFA, x);
-+  add_reg_note (insn, REG_CFA_REGISTER, gen_rtx_SET (ecx, pc_rtx));
-+  RTX_FRAME_RELATED_P (insn) = 1;
-+
-+  x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, popc);
-+  x = gen_rtx_SET (stack_pointer_rtx, x);
-+  insn = emit_insn (x);
-+  add_reg_note (insn, REG_CFA_ADJUST_CFA, x);
-+  RTX_FRAME_RELATED_P (insn) = 1;
-+
-+  /* Now return address is in ECX.  */
-+  emit_jump_insn (gen_simple_return_indirect_internal (ecx));
-+}
-+
- /* Output the assembly for a call instruction.  */
- 
- const char *
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index 05a88ff..857466a 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -11813,7 +11813,7 @@
- (define_insn "*indirect_jump"
-   [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))]
-   ""
--  "* return ix86_output_indirect_jmp (operands[0], false);"
-+  "* return ix86_output_indirect_jmp (operands[0]);"
-   [(set (attr "type")
-      (if_then_else (match_test "(cfun->machine->indirect_branch_type
- 				 != indirect_branch_keep)")
-@@ -11868,7 +11868,7 @@
-   [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))
-    (use (label_ref (match_operand 1)))]
-   ""
--  "* return ix86_output_indirect_jmp (operands[0], false);"
-+  "* return ix86_output_indirect_jmp (operands[0]);"
-   [(set (attr "type")
-      (if_then_else (match_test "(cfun->machine->indirect_branch_type
- 				 != indirect_branch_keep)")
-@@ -12520,11 +12520,14 @@
-    (set_attr "prefix_rep" "1")
-    (set_attr "modrm" "0")])
- 
--(define_insn "simple_return_pop_internal"
-+(define_insn_and_split "simple_return_pop_internal"
-   [(simple_return)
-    (use (match_operand:SI 0 "const_int_operand"))]
-   "reload_completed"
-   "%!ret\t%0"
-+  "&& cfun->machine->function_return_type != indirect_branch_keep"
-+  [(const_int 0)]
-+  "ix86_split_simple_return_pop_internal (operands[0]); DONE;"
-   [(set_attr "length" "3")
-    (set_attr "atom_unit" "jeu")
-    (set_attr "length_immediate" "2")
-@@ -12535,7 +12538,7 @@
-   [(simple_return)
-    (use (match_operand:SI 0 "register_operand" "r"))]
-   "reload_completed"
--  "* return ix86_output_indirect_jmp (operands[0], true);"
-+  "* return ix86_output_indirect_function_return (operands[0]);"
-   [(set (attr "type")
-      (if_then_else (match_test "(cfun->machine->indirect_branch_type
- 				 != indirect_branch_keep)")
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-22.c b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c
-new file mode 100644
-index 0000000..89e086d
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c
-@@ -0,0 +1,15 @@
-+/* PR target/r84530 */
-+/* { dg-do compile { target ia32 } } */
-+/* { dg-options "-O2 -mfunction-return=thunk" } */
-+
-+struct s { _Complex unsigned short x; };
-+struct s gs = { 100 + 200i };
-+struct s __attribute__((noinline)) foo (void) { return gs; }
-+
-+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
-+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-23.c b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c
-new file mode 100644
-index 0000000..43f0cca
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c
-@@ -0,0 +1,15 @@
-+/* PR target/r84530 */
-+/* { dg-do compile { target ia32 } } */
-+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */
-+
-+struct s { _Complex unsigned short x; };
-+struct s gs = { 100 + 200i };
-+struct s __attribute__((noinline)) foo (void) { return gs; }
-+
-+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
-+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not {\tpause} } } */
-+/* { dg-final { scan-assembler-not {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-24.c b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c
-new file mode 100644
-index 0000000..8729e35
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c
-@@ -0,0 +1,15 @@
-+/* PR target/r84530 */
-+/* { dg-do compile { target ia32 } } */
-+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
-+
-+struct s { _Complex unsigned short x; };
-+struct s gs = { 100 + 200i };
-+struct s __attribute__((noinline)) foo (void) { return gs; }
-+
-+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
-+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-25.c b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c
-new file mode 100644
-index 0000000..f73553c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c
-@@ -0,0 +1,15 @@
-+/* PR target/r84530 */
-+/* { dg-do compile { target ia32 } } */
-+/* { dg-options "-O2 -mfunction-return=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
-+
-+struct s { _Complex unsigned short x; };
-+struct s gs = { 100 + 200i };
-+struct s __attribute__((noinline)) foo (void) { return gs; }
-+
-+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
-+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_bnd_ecx" } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler {\tpause} } } */
-+/* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
-new file mode 100644
-index 0000000..9144e98
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
-@@ -0,0 +1,40 @@
-+/* PR target/r84530 */
-+/* { dg-do run } */
-+/* { dg-options "-Os -mfunction-return=thunk" } */
-+
-+struct S { int i; };
-+__attribute__((const, noinline, noclone))
-+struct S foo (int x)
-+{
-+  struct S s;
-+  s.i = x;
-+  return s;
-+}
-+
-+int a[2048], b[2048], c[2048], d[2048];
-+struct S e[2048];
-+
-+__attribute__((noinline, noclone)) void
-+bar (void)
-+{
-+  int i;
-+  for (i = 0; i < 1024; i++)
-+    {
-+      e[i] = foo (i);
-+      a[i+2] = a[i] + a[i+1];
-+      b[10] = b[10] + i;
-+      c[i] = c[2047 - i];
-+      d[i] = d[i + 1];
-+    }
-+}
-+
-+int
-+main ()
-+{
-+  int i;
-+  bar ();
-+  for (i = 0; i < 1024; i++)
-+    if (e[i].i != i)
-+      __builtin_abort ();
-+  return 0;
-+}
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch
deleted file mode 100644
index b50ac5c..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch
+++ /dev/null
@@ -1,1004 +0,0 @@
-From 7ba192d11a43d24ce427a3dfce0ad0592bd52830 Mon Sep 17 00:00:00 2001
-From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 26 Feb 2018 17:00:46 +0000
-Subject: [PATCH 12/12] i386: Add TARGET_INDIRECT_BRANCH_REGISTER
-
-For
-
----
-struct C {
-  virtual ~C();
-  virtual void f();
-};
-
-void
-f (C *p)
-{
-  p->f();
-  p->f();
-}
----
-
--mindirect-branch=thunk-extern -O2 on x86-64 GNU/Linux generates:
-
-_Z1fP1C:
-.LFB0:
-        .cfi_startproc
-        pushq   %rbx
-        .cfi_def_cfa_offset 16
-        .cfi_offset 3, -16
-        movq    (%rdi), %rax
-        movq    %rdi, %rbx
-        jmp     .LIND1
-.LIND0:
-        pushq   16(%rax)
-        jmp     __x86_indirect_thunk
-.LIND1:
-        call    .LIND0
-        movq    (%rbx), %rax
-        movq    %rbx, %rdi
-        popq    %rbx
-        .cfi_def_cfa_offset 8
-        movq    16(%rax), %rax
-        jmp     __x86_indirect_thunk_rax
-        .cfi_endproc
-
-x86-64 is supposed to have asynchronous unwind tables by default, but
-there is nothing that reflects the change in the (relative) frame
-address after .LIND0.  That region really has to be moved outside of
-the .cfi_startproc/.cfi_endproc bracket.
-
-This patch adds TARGET_INDIRECT_BRANCH_REGISTER to force indirect
-branch via register whenever -mindirect-branch= is used.  Now,
--mindirect-branch=thunk-extern -O2 on x86-64 GNU/Linux generates:
-
-_Z1fP1C:
-.LFB0:
-	.cfi_startproc
-	pushq	%rbx
-	.cfi_def_cfa_offset 16
-	.cfi_offset 3, -16
-	movq	(%rdi), %rax
-	movq	%rdi, %rbx
-	movq	16(%rax), %rax
-	call	__x86_indirect_thunk_rax
-	movq	(%rbx), %rax
-	movq	%rbx, %rdi
-	popq	%rbx
-	.cfi_def_cfa_offset 8
-	movq	16(%rax), %rax
-	jmp	__x86_indirect_thunk_rax
-	.cfi_endproc
-
-so that "-mindirect-branch=thunk-extern" is equivalent to
-"-mindirect-branch=thunk-extern -mindirect-branch-register", which is
-used by Linux kernel.
-
-gcc/
-
-	Backport from mainline
-	PR target/84039
-	* config/i386/constraints.md (Bs): Replace
-	ix86_indirect_branch_register with
-	TARGET_INDIRECT_BRANCH_REGISTER.
-	(Bw): Likewise.
-	* config/i386/i386.md (indirect_jump): Likewise.
-	(tablejump): Likewise.
-	(*sibcall_memory): Likewise.
-	(*sibcall_value_memory): Likewise.
-	Peepholes of indirect call and jump via memory: Likewise.
-	(*sibcall_GOT_32): Disallowed for TARGET_INDIRECT_BRANCH_REGISTER.
-	(*sibcall_value_GOT_32): Likewise.
-	* config/i386/predicates.md (indirect_branch_operand): Likewise.
-	(GOT_memory_operand): Likewise.
-	(call_insn_operand): Likewise.
-	(sibcall_insn_operand): Likewise.
-	(GOT32_symbol_operand): Likewise.
-	* config/i386/i386.h (TARGET_INDIRECT_BRANCH_REGISTER): New.
-
-gcc/testsuite/
-
-	Backport from mainline
-	PR target/84039
-	* gcc.target/i386/indirect-thunk-1.c: Updated.
-	* gcc.target/i386/indirect-thunk-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
-	* gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
-	* gcc.target/i386/ret-thunk-9.c: Likewise.
-	* gcc.target/i386/ret-thunk-10.c: Likewise.
-	* gcc.target/i386/ret-thunk-11.c: Likewise.
-	* gcc.target/i386/ret-thunk-12.c: Likewise.
-	* gcc.target/i386/ret-thunk-13.c: Likewise.
-	* gcc.target/i386/ret-thunk-14.c: Likewise.
-	* gcc.target/i386/ret-thunk-15.c: Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
----
- gcc/config/i386/constraints.md                     |  4 ++--
- gcc/config/i386/i386.h                             |  5 ++++
- gcc/config/i386/i386.md                            | 28 +++++++++++++---------
- gcc/config/i386/predicates.md                      |  6 ++---
- gcc/testsuite/gcc.target/i386/indirect-thunk-1.c   |  5 ++--
- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c   |  5 ++--
- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c   |  5 ++--
- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c   |  5 ++--
- gcc/testsuite/gcc.target/i386/indirect-thunk-5.c   |  6 +++--
- gcc/testsuite/gcc.target/i386/indirect-thunk-6.c   | 12 ++++++----
- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c   |  5 ++--
- .../gcc.target/i386/indirect-thunk-attr-1.c        |  5 ++--
- .../gcc.target/i386/indirect-thunk-attr-2.c        |  5 ++--
- .../gcc.target/i386/indirect-thunk-attr-3.c        |  3 +--
- .../gcc.target/i386/indirect-thunk-attr-4.c        |  3 +--
- .../gcc.target/i386/indirect-thunk-attr-5.c        |  9 ++++---
- .../gcc.target/i386/indirect-thunk-attr-6.c        |  9 ++++---
- .../gcc.target/i386/indirect-thunk-attr-7.c        |  5 ++--
- .../gcc.target/i386/indirect-thunk-bnd-1.c         |  6 ++---
- .../gcc.target/i386/indirect-thunk-bnd-2.c         |  6 ++---
- .../gcc.target/i386/indirect-thunk-bnd-3.c         |  5 ++--
- .../gcc.target/i386/indirect-thunk-bnd-4.c         |  7 +++---
- .../gcc.target/i386/indirect-thunk-extern-1.c      |  5 ++--
- .../gcc.target/i386/indirect-thunk-extern-2.c      |  5 ++--
- .../gcc.target/i386/indirect-thunk-extern-3.c      |  9 ++++---
- .../gcc.target/i386/indirect-thunk-extern-4.c      |  6 ++---
- .../gcc.target/i386/indirect-thunk-extern-5.c      |  6 +++--
- .../gcc.target/i386/indirect-thunk-extern-6.c      |  8 +++----
- .../gcc.target/i386/indirect-thunk-extern-7.c      |  5 ++--
- .../gcc.target/i386/indirect-thunk-inline-1.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-2.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-3.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-4.c      |  2 +-
- .../gcc.target/i386/indirect-thunk-inline-5.c      |  3 ++-
- .../gcc.target/i386/indirect-thunk-inline-6.c      |  3 ++-
- .../gcc.target/i386/indirect-thunk-inline-7.c      |  4 ++--
- gcc/testsuite/gcc.target/i386/ret-thunk-10.c       |  9 +++----
- gcc/testsuite/gcc.target/i386/ret-thunk-11.c       |  9 +++----
- gcc/testsuite/gcc.target/i386/ret-thunk-12.c       |  8 +++----
- gcc/testsuite/gcc.target/i386/ret-thunk-13.c       |  5 ++--
- gcc/testsuite/gcc.target/i386/ret-thunk-14.c       |  7 +++---
- gcc/testsuite/gcc.target/i386/ret-thunk-15.c       |  7 +++---
- gcc/testsuite/gcc.target/i386/ret-thunk-9.c        | 13 ++++------
- 43 files changed, 128 insertions(+), 141 deletions(-)
-
-diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
-index 9204c8e..ef684a9 100644
---- a/gcc/config/i386/constraints.md
-+++ b/gcc/config/i386/constraints.md
-@@ -172,7 +172,7 @@
- 
- (define_constraint "Bs"
-   "@internal Sibcall memory operand."
--  (ior (and (not (match_test "ix86_indirect_branch_register"))
-+  (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
- 	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "sibcall_memory_operand"))
-        (and (match_test "TARGET_X32 && Pmode == DImode")
-@@ -180,7 +180,7 @@
- 
- (define_constraint "Bw"
-   "@internal Call memory operand."
--  (ior (and (not (match_test "ix86_indirect_branch_register"))
-+  (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
- 	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "memory_operand"))
-        (and (match_test "TARGET_X32 && Pmode == DImode")
-diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
-index b34bc11..1816d71 100644
---- a/gcc/config/i386/i386.h
-+++ b/gcc/config/i386/i386.h
-@@ -2676,6 +2676,11 @@ extern void debug_dispatch_window (int);
- #define TARGET_RECIP_VEC_DIV	((recip_mask & RECIP_MASK_VEC_DIV) != 0)
- #define TARGET_RECIP_VEC_SQRT	((recip_mask & RECIP_MASK_VEC_SQRT) != 0)
- 
-+
-+#define TARGET_INDIRECT_BRANCH_REGISTER \
-+  (ix86_indirect_branch_register \
-+   || cfun->machine->indirect_branch_type != indirect_branch_keep)
-+
- #define IX86_HLE_ACQUIRE (1 << 16)
- #define IX86_HLE_RELEASE (1 << 17)
- 
-diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
-index 857466a..6a6dc26 100644
---- a/gcc/config/i386/i386.md
-+++ b/gcc/config/i386/i386.md
-@@ -11805,7 +11805,7 @@
-   [(set (pc) (match_operand 0 "indirect_branch_operand"))]
-   ""
- {
--  if (TARGET_X32 || ix86_indirect_branch_register)
-+  if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-   cfun->machine->has_local_indirect_jump = true;
- })
-@@ -11859,7 +11859,7 @@
- 					 OPTAB_DIRECT);
-     }
- 
--  if (TARGET_X32 || ix86_indirect_branch_register)
-+  if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
-     operands[0] = convert_memory_address (word_mode, operands[0]);
-   cfun->machine->has_local_indirect_jump = true;
- })
-@@ -12029,7 +12029,10 @@
- 		     (match_operand:SI 0 "register_no_elim_operand" "U")
- 		     (match_operand:SI 1 "GOT32_symbol_operand"))))
- 	 (match_operand 2))]
--  "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)"
-+  "!TARGET_MACHO
-+  && !TARGET_64BIT
-+  && !TARGET_INDIRECT_BRANCH_REGISTER
-+  && SIBLING_CALL_P (insn)"
- {
-   rtx fnaddr = gen_rtx_PLUS (Pmode, operands[0], operands[1]);
-   fnaddr = gen_const_mem (Pmode, fnaddr);
-@@ -12048,7 +12051,7 @@
-   [(call (mem:QI (match_operand:W 0 "memory_operand" "m"))
- 	 (match_operand 1))
-    (unspec [(const_int 0)] UNSPEC_PEEPSIB)]
--  "!TARGET_X32 && !ix86_indirect_branch_register"
-+  "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
-   "* return ix86_output_call_insn (insn, operands[0]);"
-   [(set_attr "type" "call")])
- 
-@@ -12058,7 +12061,7 @@
-    (call (mem:QI (match_dup 0))
- 	 (match_operand 3))]
-   "!TARGET_X32
--   && !ix86_indirect_branch_register
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-    && SIBLING_CALL_P (peep2_next_insn (1))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
-@@ -12073,7 +12076,7 @@
-    (call (mem:QI (match_dup 0))
- 	 (match_operand 3))]
-   "!TARGET_X32
--   && !ix86_indirect_branch_register
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-    && SIBLING_CALL_P (peep2_next_insn (2))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
-@@ -12171,7 +12174,7 @@
-         (match_operand:W 1 "memory_operand"))
-    (set (pc) (match_dup 0))]
-   "!TARGET_X32
--   && !ix86_indirect_branch_register
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-    && peep2_reg_dead_p (2, operands[0])"
-   [(set (pc) (match_dup 1))])
- 
-@@ -12229,7 +12232,10 @@
- 			  (match_operand:SI 1 "register_no_elim_operand" "U")
- 			  (match_operand:SI 2 "GOT32_symbol_operand"))))
- 	 (match_operand 3)))]
--  "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)"
-+  "!TARGET_MACHO
-+   && !TARGET_64BIT
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-+   && SIBLING_CALL_P (insn)"
- {
-   rtx fnaddr = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
-   fnaddr = gen_const_mem (Pmode, fnaddr);
-@@ -12250,7 +12256,7 @@
-  	(call (mem:QI (match_operand:W 1 "memory_operand" "m"))
- 	      (match_operand 2)))
-    (unspec [(const_int 0)] UNSPEC_PEEPSIB)]
--  "!TARGET_X32 && !ix86_indirect_branch_register"
-+  "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
-   "* return ix86_output_call_insn (insn, operands[1]);"
-   [(set_attr "type" "callv")])
- 
-@@ -12261,7 +12267,7 @@
-    (call (mem:QI (match_dup 0))
- 		 (match_operand 3)))]
-   "!TARGET_X32
--   && !ix86_indirect_branch_register
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-    && SIBLING_CALL_P (peep2_next_insn (1))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
-@@ -12278,7 +12284,7 @@
- 	(call (mem:QI (match_dup 0))
- 	      (match_operand 3)))]
-   "!TARGET_X32
--   && !ix86_indirect_branch_register
-+   && !TARGET_INDIRECT_BRANCH_REGISTER
-    && SIBLING_CALL_P (peep2_next_insn (2))
-    && !reg_mentioned_p (operands[0],
- 			CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
-diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
-index d1f0a7d..5f8a98f 100644
---- a/gcc/config/i386/predicates.md
-+++ b/gcc/config/i386/predicates.md
-@@ -593,7 +593,7 @@
- ;; Test for a valid operand for indirect branch.
- (define_predicate "indirect_branch_operand"
-   (ior (match_operand 0 "register_operand")
--       (and (not (match_test "ix86_indirect_branch_register"))
-+       (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
- 	    (not (match_test "TARGET_X32"))
- 	    (match_operand 0 "memory_operand"))))
- 
-@@ -637,7 +637,7 @@
-   (ior (match_test "constant_call_address_operand
- 		     (op, mode == VOIDmode ? mode : Pmode)")
-        (match_operand 0 "call_register_no_elim_operand")
--       (and (not (match_test "ix86_indirect_branch_register"))
-+       (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
- 	    (ior (and (not (match_test "TARGET_X32"))
- 		      (match_operand 0 "memory_operand"))
- 		 (and (match_test "TARGET_X32 && Pmode == DImode")
-@@ -648,7 +648,7 @@
-   (ior (match_test "constant_call_address_operand
- 		     (op, mode == VOIDmode ? mode : Pmode)")
-        (match_operand 0 "register_no_elim_operand")
--       (and (not (match_test "ix86_indirect_branch_register"))
-+       (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
- 	    (ior (and (not (match_test "TARGET_X32"))
- 		      (match_operand 0 "sibcall_memory_operand"))
- 		 (and (match_test "TARGET_X32 && Pmode == DImode")
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-index 60d0988..6e94d2c 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-index aac7516..3c46707 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-index 9e24a38..2c7fb52 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
-@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-index 127b5d9..0d3f895 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
-@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-index fcaa18d..fb26c00 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-@@ -9,8 +9,10 @@ foo (void)
-   bar ();
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-index e464928..aa03fbd 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-@@ -10,9 +10,13 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 { target x32 } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler {\tpause} } } */
- /* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-index 17c2d0f..3c72036 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-@@ -35,9 +35,8 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-index 9194ccf..7106407 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-@@ -14,9 +14,8 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-index e51f261..27c7e5b 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-index 4aeec18..89a2bac 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-@@ -14,10 +14,9 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler {\tpause} } } */
- /* { dg-final { scan-assembler {\tlfence} } } */
- /* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-index ac0e599..3eb83c3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-@@ -13,10 +13,9 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler {\tpause} } } */
- /* { dg-final { scan-assembler {\tlfence} } } */
- /* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-index 573cf1e..0098dd1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
-@@ -14,9 +14,8 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-index b2b37fc..ece8de1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
-@@ -13,9 +13,8 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-index 4a43e19..d53fc88 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
-@@ -36,9 +36,8 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-index ac84ab6..73d16ba 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-@@ -10,9 +10,9 @@ foo (void)
-   dispatch (buf);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "bnd ret" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-index ce655e8..856751a 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
-@@ -11,10 +11,8 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */
- /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "bnd ret" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-index d34485a..42312f6 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-@@ -10,8 +10,9 @@ foo (void)
-   bar (buf);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "bnd ret" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-index 0e19830..c8ca102 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
-@@ -11,10 +11,9 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk" } } */
--/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
--/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 2 } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 1 } } */
- /* { dg-final { scan-assembler "bnd ret" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
- /* { dg-final { scan-assembler {\tlfence} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-index 579441f..c09dd0a 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
-@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-index c92e6f2..826425a 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
-@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-index d9964c2..3856268 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
-@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-index d4dca4d..1ae49b1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
-@@ -12,9 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-index 5c07e02..5328239 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
-@@ -9,8 +9,10 @@ foo (void)
-   bar ();
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-index 3eb4406..8ae4348 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
-@@ -10,8 +10,8 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
--/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 } } */
--/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-index aece938..2b9a33e 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
-@@ -35,9 +35,8 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
- /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-index 3aba5e8..869d904 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch(offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-index 0f0181d..c5c16ed 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
-   dispatch[offset](offset);
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-index 2eef6f3..4a63ebe 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-index e825a10..a395ffc 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-index c6d77e1..21cbfd3 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-@@ -9,7 +9,8 @@ foo (void)
-   bar ();
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-index 6454827..d1300f1 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-@@ -10,7 +10,8 @@ foo (void)
-   return 0;
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
-diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-index c67066c..ea00924 100644
---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-@@ -35,8 +35,8 @@ bar (int i)
-     }
- }
- 
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%(r|e)ax" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler {\tpause} } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-index e6fea84..af9023a 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
-@@ -15,9 +15,6 @@ foo (void)
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
- /* { dg-final { scan-assembler-times {\tpause} 2 } } */
- /* { dg-final { scan-assembler-times {\tlfence} 2 } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } }  } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-index e239ec4..ba467c5 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
-@@ -15,9 +15,6 @@ foo (void)
- /* { dg-final { scan-assembler-times {\tlfence} 1 } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-index fa31813..43e57ca 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
-@@ -15,8 +15,6 @@ foo (void)
- /* { dg-final { scan-assembler-times {\tlfence} 1 } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } }  } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
--/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } }  } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-index fd5b41f..55f156c 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
-@@ -14,9 +14,8 @@ foo (void)
- /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
- /* { dg-final { scan-assembler-times {\tpause} 2 } } */
- /* { dg-final { scan-assembler-times {\tlfence} 2 } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
- /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */
- /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */
--/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-index d606373..1c79043 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
-@@ -16,7 +16,6 @@ foo (void)
- /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } }  } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-index 75e45e2..58aba31 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
-@@ -16,7 +16,6 @@ foo (void)
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler-times {\tpause} 1 } } */
- /* { dg-final { scan-assembler-times {\tlfence} 1 } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
-diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-index d1db41c..d2df8b8 100644
---- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
-@@ -14,11 +14,8 @@ foo (void)
- /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
- /* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */
--/* { dg-final { scan-assembler-times {\tpause} 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times {\tlfence} 1 { target { ! x32 } } } } */
--/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
--/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
--/* { dg-final { scan-assembler-times {\tpause} 2 { target { x32 } } } } */
--/* { dg-final { scan-assembler-times {\tlfence} 2 { target { x32 } } } } */
--/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
--/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
-+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
-+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
-+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
-+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0013-gcc-sanitizers.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0013-gcc-sanitizers.patch
deleted file mode 100644
index 47bcd8e..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/0013-gcc-sanitizers.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 0fa7102d76376b27ae4bbc10848600aac6ed71d2 Mon Sep 17 00:00:00 2001
-From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 17 Jul 2017 19:41:08 +0000
-Subject: [PATCH] 	Backported from mainline 	2017-07-14  Jakub
- Jelinek  <jakub@redhat.com>
-
-	PR sanitizer/81066
-	* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
-	* sanitizer_common/sanitizer_linux.cc: Likewise.
-	* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
-	* tsan/tsan_platform_linux.cc: Likewise.
-
-[Romain cherry-pick on gcc-6-branch from gcc-7-branch]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250287 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Upstream-Status: Backport
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
----
- libsanitizer/sanitizer_common/sanitizer_linux.cc                      | 3 +--
- libsanitizer/sanitizer_common/sanitizer_linux.h                       | 4 +---
- libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +-
- libsanitizer/tsan/tsan_platform_linux.cc                              | 2 +-
- 4 files changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
-index 2cefa20..223d9c6 100644
---- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
-+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
-@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
- }
- #endif
- 
--uptr internal_sigaltstack(const struct sigaltstack *ss,
--                         struct sigaltstack *oss) {
-+uptr internal_sigaltstack(const void *ss, void *oss) {
-   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
- }
- 
-diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
-index 4497702..1594058 100644
---- a/libsanitizer/sanitizer_common/sanitizer_linux.h
-+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
-@@ -19,7 +19,6 @@
- #include "sanitizer_platform_limits_posix.h"
- 
- struct link_map;  // Opaque type returned by dlopen().
--struct sigaltstack;
- 
- namespace __sanitizer {
- // Dirent structure for getdents(). Note that this structure is different from
-@@ -28,8 +27,7 @@ struct linux_dirent;
- 
- // Syscall wrappers.
- uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
--uptr internal_sigaltstack(const struct sigaltstack* ss,
--                          struct sigaltstack* oss);
-+uptr internal_sigaltstack(const void* ss, void* oss);
- uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
-     __sanitizer_sigset_t *oldset);
- void internal_sigfillset(__sanitizer_sigset_t *set);
-diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-index c919e4f..014162af 100644
---- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-@@ -267,7 +267,7 @@ static int TracerThread(void* argument) {
- 
-   // Alternate stack for signal handling.
-   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
--  struct sigaltstack handler_stack;
-+  stack_t handler_stack;
-   internal_memset(&handler_stack, 0, sizeof(handler_stack));
-   handler_stack.ss_sp = handler_stack_memory.data();
-   handler_stack.ss_size = kHandlerStackSize;
-diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
-index 09cec5f..908f4fe 100644
---- a/libsanitizer/tsan/tsan_platform_linux.cc
-+++ b/libsanitizer/tsan/tsan_platform_linux.cc
-@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) {
- int ExtractResolvFDs(void *state, int *fds, int nfd) {
- #if SANITIZER_LINUX
-   int cnt = 0;
--  __res_state *statp = (__res_state*)state;
-+  struct __res_state *statp = (struct __res_state*)state;
-   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
-     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
-       fds[cnt++] = statp->_u._ext.nssocks[i];
--- 
-2.9.4
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/CVE-2016-6131.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/CVE-2016-6131.patch
deleted file mode 100644
index 3cdbb2d..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-6.4/backport/CVE-2016-6131.patch
+++ /dev/null
@@ -1,223 +0,0 @@
-From 59a0e4bd8391962f62600ae3ac95ab0fba74d464 Mon Sep 17 00:00:00 2001
-From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu, 4 Aug 2016 16:53:18 +0000
-Subject: [PATCH] Fix for PR71696 in Libiberty Demangler
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-[BZ #71696] -- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71696
-
-2016-08-04  Marcel Böhme  <boehme.marcel@gmail.com>
-
-	PR c++/71696
-	* cplus-dem.c: Prevent infinite recursion when there is a cycle
-	in the referencing of remembered mangled types.
-	(work_stuff): New stack to keep track of the remembered mangled
-	types that are currently being processed.
-	(push_processed_type): New method to push currently processed
-	remembered type onto the stack.
-	(pop_processed_type): New method to pop currently processed
-	remembered type from the stack.
-	(work_stuff_copy_to_from): Copy values of new variables.
-	(delete_non_B_K_work_stuff): Free stack memory.
-	(demangle_args): Push/Pop currently processed remembered type.
-	(do_type): Do not demangle a cyclic reference and push/pop
-	referenced remembered type.
-
-cherry-picked from commit of
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239143 138bc75d-0d04-0410-961f-82ee72b054a4
-
-Upstream-Status: Backport [master]
-CVE: CVE-2016-6131
-Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
----
- libiberty/ChangeLog                   | 17 ++++++++
- libiberty/cplus-dem.c                 | 78 ++++++++++++++++++++++++++++++++---
- libiberty/testsuite/demangle-expected | 18 ++++++++
- 3 files changed, 108 insertions(+), 5 deletions(-)
-
-Index: gcc-6.4.0/libiberty/cplus-dem.c
-===================================================================
---- gcc-6.4.0.orig/libiberty/cplus-dem.c
-+++ gcc-6.4.0/libiberty/cplus-dem.c
-@@ -144,6 +144,9 @@ struct work_stuff
-   string* previous_argument; /* The last function argument demangled.  */
-   int nrepeats;         /* The number of times to repeat the previous
- 			   argument.  */
-+  int *proctypevec;     /* Indices of currently processed remembered typevecs.  */
-+  int proctypevec_size;
-+  int nproctypes;
- };
- 
- #define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
-@@ -435,6 +438,10 @@ iterate_demangle_function (struct work_s
- 
- static void remember_type (struct work_stuff *, const char *, int);
- 
-+static void push_processed_type (struct work_stuff *, int);
-+
-+static void pop_processed_type (struct work_stuff *);
-+
- static void remember_Btype (struct work_stuff *, const char *, int, int);
- 
- static int register_Btype (struct work_stuff *);
-@@ -1301,6 +1308,10 @@ work_stuff_copy_to_from (struct work_stu
-       memcpy (to->btypevec[i], from->btypevec[i], len);
-     }
- 
-+  if (from->proctypevec)
-+    to->proctypevec =
-+      XDUPVEC (int, from->proctypevec, from->proctypevec_size);
-+
-   if (from->ntmpl_args)
-     to->tmpl_argvec = XNEWVEC (char *, from->ntmpl_args);
- 
-@@ -1329,11 +1340,17 @@ delete_non_B_K_work_stuff (struct work_s
-   /* Discard the remembered types, if any.  */
- 
-   forget_types (work);
--  if (work -> typevec != NULL)
-+  if (work->typevec != NULL)
-     {
--      free ((char *) work -> typevec);
--      work -> typevec = NULL;
--      work -> typevec_size = 0;
-+      free ((char *) work->typevec);
-+      work->typevec = NULL;
-+      work->typevec_size = 0;
-+    }
-+  if (work->proctypevec != NULL)
-+    {
-+      free (work->proctypevec);
-+      work->proctypevec = NULL;
-+      work->proctypevec_size = 0;
-     }
-   if (work->tmpl_argvec)
-     {
-@@ -3552,6 +3569,8 @@ static int
- do_type (struct work_stuff *work, const char **mangled, string *result)
- {
-   int n;
-+  int i;
-+  int is_proctypevec;
-   int done;
-   int success;
-   string decl;
-@@ -3564,6 +3583,7 @@ do_type (struct work_stuff *work, const
- 
-   done = 0;
-   success = 1;
-+  is_proctypevec = 0;
-   while (success && !done)
-     {
-       int member;
-@@ -3616,8 +3636,15 @@ do_type (struct work_stuff *work, const
- 	      success = 0;
- 	    }
- 	  else
-+	    for (i = 0; i < work->nproctypes; i++)
-+	      if (work -> proctypevec [i] == n)
-+	        success = 0;
-+
-+	  if (success)
- 	    {
--	      remembered_type = work -> typevec[n];
-+	      is_proctypevec = 1;
-+	      push_processed_type (work, n);
-+	      remembered_type = work->typevec[n];
- 	      mangled = &remembered_type;
- 	    }
- 	  break;
-@@ -3840,6 +3867,9 @@ do_type (struct work_stuff *work, const
-     string_delete (result);
-   string_delete (&decl);
- 
-+  if (is_proctypevec)
-+    pop_processed_type (work);
-+
-   if (success)
-     /* Assume an integral type, if we're not sure.  */
-     return (int) ((tk == tk_none) ? tk_integral : tk);
-@@ -4252,6 +4282,41 @@ do_arg (struct work_stuff *work, const c
- }
- 
- static void
-+push_processed_type (struct work_stuff *work, int typevec_index)
-+{
-+  if (work->nproctypes >= work->proctypevec_size)
-+    {
-+      if (!work->proctypevec_size)
-+	{
-+	  work->proctypevec_size = 4;
-+	  work->proctypevec = XNEWVEC (int, work->proctypevec_size);
-+	}
-+      else
-+	{
-+	  if (work->proctypevec_size < 16)
-+	    /* Double when small.  */
-+	    work->proctypevec_size *= 2;
-+	  else
-+	    {
-+	      /* Grow slower when large.  */
-+	      if (work->proctypevec_size > (INT_MAX / 3) * 2)
-+                xmalloc_failed (INT_MAX);
-+              work->proctypevec_size = (work->proctypevec_size * 3 / 2);
-+	    }
-+          work->proctypevec
-+            = XRESIZEVEC (int, work->proctypevec, work->proctypevec_size);
-+	}
-+    }
-+    work->proctypevec [work->nproctypes++] = typevec_index;
-+}
-+
-+static void
-+pop_processed_type (struct work_stuff *work)
-+{
-+  work->nproctypes--;
-+}
-+
-+static void
- remember_type (struct work_stuff *work, const char *start, int len)
- {
-   char *tem;
-@@ -4515,10 +4580,13 @@ demangle_args (struct work_stuff *work,
- 		{
- 		  string_append (declp, ", ");
- 		}
-+	      push_processed_type (work, t);
- 	      if (!do_arg (work, &tem, &arg))
- 		{
-+		  pop_processed_type (work);
- 		  return (0);
- 		}
-+	      pop_processed_type (work);
- 	      if (PRINT_ARG_TYPES)
- 		{
- 		  string_appends (declp, &arg);
-Index: gcc-6.4.0/libiberty/testsuite/demangle-expected
-===================================================================
---- gcc-6.4.0.orig/libiberty/testsuite/demangle-expected
-+++ gcc-6.4.0/libiberty/testsuite/demangle-expected
-@@ -4491,3 +4491,21 @@ void eat<int*, Foo()::{lambda(auto:1*, a
- 
- _Z3eatIPiZ3BarIsEvvEUlPsPT_PT0_E0_EvRS3_RS5_
- void eat<int*, void Bar<short>()::{lambda(short*, auto:1*, auto:2*)#2}>(int*&, void Bar<short>()::{lambda(short*, auto:1*, auto:2*)#2}&)
-+#
-+# Tests write access violation PR70926
-+
-+0__Ot2m02R5T0000500000
-+0__Ot2m02R5T0000500000
-+#
-+
-+0__GT50000000000_
-+0__GT50000000000_
-+#
-+
-+__t2m05B500000000000000000_
-+__t2m05B500000000000000000_
-+#
-+# Tests stack overflow PR71696
-+
-+__10%0__S4_0T0T0
-+%0<>::%0(%0<>)
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc
index 2dc3db8..d968c32 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc
@@ -10,8 +10,8 @@
 
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-7.3:${FILE_DIRNAME}/gcc-7.3/backport:"
 
-DEPENDS =+ "mpfr gmp libmpc zlib"
-NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
+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"
 
@@ -73,12 +73,12 @@
            file://0047-sync-gcc-stddef.h-with-musl.patch \
            file://0048-gcc-Enable-static-PIE.patch \
            file://fix-segmentation-fault-precompiled-hdr.patch \
-           file://0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch \
            file://no-sse-fix-test-case-failures.patch \
            ${BACKPORTS} \
 "
 BACKPORTS = "\
            file://0001-Fix-internal-compiler-error-in-testcase.patch \
+           file://0001-PR-rtl-optimization-83030.patch \
 "
 
 SRC_URI[md5sum] = "be2da21680f27624f3a87055c4ba5af2"
@@ -101,7 +101,7 @@
     --disable-bootstrap \
     --disable-libmudflap \
     --with-system-zlib \
-    --with-linker-hash-style=${LINKER_HASH_STYLE} \
+    ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
     --enable-linker-build-id \
     --with-ppl=no \
     --with-cloog=no \
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-rtl-optimization-83030.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-rtl-optimization-83030.patch
new file mode 100644
index 0000000..71f7988
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-rtl-optimization-83030.patch
@@ -0,0 +1,272 @@
+From f5c4a9440f15ccf6775659910a2014a5494ee86e Mon Sep 17 00:00:00 2001
+From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 22 Nov 2017 21:43:22 +0000
+Subject: [PATCH] 	PR rtl-optimization/83030 	* doc/rtl.texi (Flags
+ in an RTL Expression): Alphabetize, add entry 	for CROSSING_JUMP_P and
+ mention usage of 'jump' for JUMP_INSNs. 	(Insns): Delete entry for
+ REG_CROSSING_JUMP in register notes. 	* bb-reorder.c
+ (update_crossing_jump_flags): Do not test whether the 	CROSSING_JUMP_P flag
+ is already set before setting it. 	* cfgrtl.c (fixup_partition_crossing):
+ Likewise. 	* reorg.c (relax_delay_slots): Do not consider a
+ CROSSING_JUMP_P insn 	as useless.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255083 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Upstream-Status: Backport
+
+This patch removes changes to Changelog from the original upstream patch.
+This will help us avoid conflicts.
+
+Original backport to GCC 7.x by Amruta Pawar <Amruta.Pawar@kpit.com>
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+---
+ gcc/bb-reorder.c |   5 +--
+ gcc/cfgrtl.c     |   3 +-
+ gcc/doc/rtl.texi | 129 ++++++++++++++++++++++++++++---------------------------
+ gcc/reorg.c      |   7 +--
+ 5 files changed, 84 insertions(+), 72 deletions(-)
+
+diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
+index 55e6dc6..794283c 100644
+--- a/gcc/bb-reorder.c
++++ b/gcc/bb-reorder.c
+@@ -2236,10 +2236,7 @@ update_crossing_jump_flags (void)
+     FOR_EACH_EDGE (e, ei, bb->succs)
+       if (e->flags & EDGE_CROSSING)
+ 	{
+-	  if (JUMP_P (BB_END (bb))
+-	      /* Some flags were added during fix_up_fall_thru_edges, via
+-		 force_nonfallthru_and_redirect.  */
+-	      && !CROSSING_JUMP_P (BB_END (bb)))
++	  if (JUMP_P (BB_END (bb)))
+ 	    CROSSING_JUMP_P (BB_END (bb)) = 1;
+ 	  break;
+ 	}
+diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
+index d6e5ac0..a2ad075 100644
+--- a/gcc/cfgrtl.c
++++ b/gcc/cfgrtl.c
+@@ -1334,8 +1334,7 @@ fixup_partition_crossing (edge e)
+   if (BB_PARTITION (e->src) != BB_PARTITION (e->dest))
+     {
+       e->flags |= EDGE_CROSSING;
+-      if (JUMP_P (BB_END (e->src))
+-	  && !CROSSING_JUMP_P (BB_END (e->src)))
++      if (JUMP_P (BB_END (e->src)))
+ 	CROSSING_JUMP_P (BB_END (e->src)) = 1;
+     }
+   else if (BB_PARTITION (e->src) == BB_PARTITION (e->dest))
+diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
+index 21524f5..a58eedc 100644
+--- a/gcc/doc/rtl.texi
++++ b/gcc/doc/rtl.texi
+@@ -565,6 +565,16 @@ that are used in certain types of expression.  Most often they
+ are accessed with the following macros, which expand into lvalues.
+ 
+ @table @code
++@findex CROSSING_JUMP_P
++@cindex @code{jump_insn} and @samp{/j}
++@item CROSSING_JUMP_P (@var{x})
++Nonzero in a @code{jump_insn} if it crosses between hot and cold sections,
++which could potentially be very far apart in the executable.  The presence
++of this flag indicates to other optimizations that this branching instruction
++should not be ``collapsed'' into a simpler branching construct.  It is used
++when the optimization to partition basic blocks into hot and cold sections
++is turned on.
++
+ @findex CONSTANT_POOL_ADDRESS_P
+ @cindex @code{symbol_ref} and @samp{/u}
+ @cindex @code{unchanging}, in @code{symbol_ref}
+@@ -577,37 +587,6 @@ In either case GCC assumes these addresses can be addressed directly,
+ perhaps with the help of base registers.
+ Stored in the @code{unchanging} field and printed as @samp{/u}.
+ 
+-@findex RTL_CONST_CALL_P
+-@cindex @code{call_insn} and @samp{/u}
+-@cindex @code{unchanging}, in @code{call_insn}
+-@item RTL_CONST_CALL_P (@var{x})
+-In a @code{call_insn} indicates that the insn represents a call to a
+-const function.  Stored in the @code{unchanging} field and printed as
+-@samp{/u}.
+-
+-@findex RTL_PURE_CALL_P
+-@cindex @code{call_insn} and @samp{/i}
+-@cindex @code{return_val}, in @code{call_insn}
+-@item RTL_PURE_CALL_P (@var{x})
+-In a @code{call_insn} indicates that the insn represents a call to a
+-pure function.  Stored in the @code{return_val} field and printed as
+-@samp{/i}.
+-
+-@findex RTL_CONST_OR_PURE_CALL_P
+-@cindex @code{call_insn} and @samp{/u} or @samp{/i}
+-@item RTL_CONST_OR_PURE_CALL_P (@var{x})
+-In a @code{call_insn}, true if @code{RTL_CONST_CALL_P} or
+-@code{RTL_PURE_CALL_P} is true.
+-
+-@findex RTL_LOOPING_CONST_OR_PURE_CALL_P
+-@cindex @code{call_insn} and @samp{/c}
+-@cindex @code{call}, in @code{call_insn}
+-@item RTL_LOOPING_CONST_OR_PURE_CALL_P (@var{x})
+-In a @code{call_insn} indicates that the insn represents a possibly
+-infinite looping call to a const or pure function.  Stored in the
+-@code{call} field and printed as @samp{/c}.  Only true if one of
+-@code{RTL_CONST_CALL_P} or @code{RTL_PURE_CALL_P} is true.
+-
+ @findex INSN_ANNULLED_BRANCH_P
+ @cindex @code{jump_insn} and @samp{/u}
+ @cindex @code{call_insn} and @samp{/u}
+@@ -702,6 +681,29 @@ Stored in the @code{call} field and printed as @samp{/c}.
+ Nonzero in a @code{mem} if the memory reference holds a pointer.
+ Stored in the @code{frame_related} field and printed as @samp{/f}.
+ 
++@findex MEM_READONLY_P
++@cindex @code{mem} and @samp{/u}
++@cindex @code{unchanging}, in @code{mem}
++@item MEM_READONLY_P (@var{x})
++Nonzero in a @code{mem}, if the memory is statically allocated and read-only.
++
++Read-only in this context means never modified during the lifetime of the
++program, not necessarily in ROM or in write-disabled pages.  A common
++example of the later is a shared library's global offset table.  This
++table is initialized by the runtime loader, so the memory is technically
++writable, but after control is transferred from the runtime loader to the
++application, this memory will never be subsequently modified.
++
++Stored in the @code{unchanging} field and printed as @samp{/u}.
++
++@findex PREFETCH_SCHEDULE_BARRIER_P
++@cindex @code{prefetch} and @samp{/v}
++@cindex @code{volatile}, in @code{prefetch}
++@item PREFETCH_SCHEDULE_BARRIER_P (@var{x})
++In a @code{prefetch}, indicates that the prefetch is a scheduling barrier.
++No other INSNs will be moved over it.
++Stored in the @code{volatil} field and printed as @samp{/v}.
++
+ @findex REG_FUNCTION_VALUE_P
+ @cindex @code{reg} and @samp{/i}
+ @cindex @code{return_val}, in @code{reg}
+@@ -731,6 +733,37 @@ The same hard register may be used also for collecting the values of
+ functions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero
+ in this kind of use.
+ 
++@findex RTL_CONST_CALL_P
++@cindex @code{call_insn} and @samp{/u}
++@cindex @code{unchanging}, in @code{call_insn}
++@item RTL_CONST_CALL_P (@var{x})
++In a @code{call_insn} indicates that the insn represents a call to a
++const function.  Stored in the @code{unchanging} field and printed as
++@samp{/u}.
++
++@findex RTL_PURE_CALL_P
++@cindex @code{call_insn} and @samp{/i}
++@cindex @code{return_val}, in @code{call_insn}
++@item RTL_PURE_CALL_P (@var{x})
++In a @code{call_insn} indicates that the insn represents a call to a
++pure function.  Stored in the @code{return_val} field and printed as
++@samp{/i}.
++
++@findex RTL_CONST_OR_PURE_CALL_P
++@cindex @code{call_insn} and @samp{/u} or @samp{/i}
++@item RTL_CONST_OR_PURE_CALL_P (@var{x})
++In a @code{call_insn}, true if @code{RTL_CONST_CALL_P} or
++@code{RTL_PURE_CALL_P} is true.
++
++@findex RTL_LOOPING_CONST_OR_PURE_CALL_P
++@cindex @code{call_insn} and @samp{/c}
++@cindex @code{call}, in @code{call_insn}
++@item RTL_LOOPING_CONST_OR_PURE_CALL_P (@var{x})
++In a @code{call_insn} indicates that the insn represents a possibly
++infinite looping call to a const or pure function.  Stored in the
++@code{call} field and printed as @samp{/c}.  Only true if one of
++@code{RTL_CONST_CALL_P} or @code{RTL_PURE_CALL_P} is true.
++
+ @findex RTX_FRAME_RELATED_P
+ @cindex @code{insn} and @samp{/f}
+ @cindex @code{call_insn} and @samp{/f}
+@@ -765,21 +798,6 @@ computation performed by this instruction, i.e., one that
+ This flag is required for exception handling support on targets with RTL
+ prologues.
+ 
+-@findex MEM_READONLY_P
+-@cindex @code{mem} and @samp{/u}
+-@cindex @code{unchanging}, in @code{mem}
+-@item MEM_READONLY_P (@var{x})
+-Nonzero in a @code{mem}, if the memory is statically allocated and read-only.
+-
+-Read-only in this context means never modified during the lifetime of the
+-program, not necessarily in ROM or in write-disabled pages.  A common
+-example of the later is a shared library's global offset table.  This
+-table is initialized by the runtime loader, so the memory is technically
+-writable, but after control is transferred from the runtime loader to the
+-application, this memory will never be subsequently modified.
+-
+-Stored in the @code{unchanging} field and printed as @samp{/u}.
+-
+ @findex SCHED_GROUP_P
+ @cindex @code{insn} and @samp{/s}
+ @cindex @code{call_insn} and @samp{/s}
+@@ -879,14 +897,6 @@ Stored in the @code{volatil} field and printed as @samp{/v}.
+ Most uses of @code{SYMBOL_REF_FLAG} are historic and may be subsumed
+ by @code{SYMBOL_REF_FLAGS}.  Certainly use of @code{SYMBOL_REF_FLAGS}
+ is mandatory if the target requires more than one bit of storage.
+-
+-@findex PREFETCH_SCHEDULE_BARRIER_P
+-@cindex @code{prefetch} and @samp{/v}
+-@cindex @code{volatile}, in @code{prefetch}
+-@item PREFETCH_SCHEDULE_BARRIER_P (@var{x})
+-In a @code{prefetch}, indicates that the prefetch is a scheduling barrier.
+-No other INSNs will be moved over it.
+-Stored in the @code{volatil} field and printed as @samp{/v}.
+ @end table
+ 
+ These are the fields to which the above macros refer:
+@@ -974,6 +985,8 @@ In a @code{set}, 1 means it is for a return.
+ 
+ In a @code{call_insn}, 1 means it is a sibling call.
+ 
++In a @code{jump_insn}, 1 means it is a crossing jump.
++
+ In an RTL dump, this flag is represented as @samp{/j}.
+ 
+ @findex unchanging
+@@ -3887,16 +3900,6 @@ multiple targets; the last label in the insn (in the highest numbered
+ insn-field) goes into the @code{JUMP_LABEL} field and does not have a
+ @code{REG_LABEL_TARGET} note.  @xref{Insns, JUMP_LABEL}.
+ 
+-@findex REG_CROSSING_JUMP
+-@item REG_CROSSING_JUMP
+-This insn is a branching instruction (either an unconditional jump or
+-an indirect jump) which crosses between hot and cold sections, which
+-could potentially be very far apart in the executable.  The presence
+-of this note indicates to other optimizations that this branching
+-instruction should not be ``collapsed'' into a simpler branching
+-construct.  It is used when the optimization to partition basic blocks
+-into hot and cold sections is turned on.
+-
+ @findex REG_SETJMP
+ @item REG_SETJMP
+ Appears attached to each @code{CALL_INSN} to @code{setjmp} or a
+diff --git a/gcc/reorg.c b/gcc/reorg.c
+index 5914af6..77f3fe7 100644
+--- a/gcc/reorg.c
++++ b/gcc/reorg.c
+@@ -3360,10 +3360,11 @@ relax_delay_slots (rtx_insn *first)
+ 	}
+ 
+       /* See if we have a simple (conditional) jump that is useless.  */
+-      if (! INSN_ANNULLED_BRANCH_P (delay_jump_insn)
+-	  && ! condjump_in_parallel_p (delay_jump_insn)
++      if (!CROSSING_JUMP_P (delay_jump_insn)
++	  && !INSN_ANNULLED_BRANCH_P (delay_jump_insn)
++	  && !condjump_in_parallel_p (delay_jump_insn)
+ 	  && prev_active_insn (as_a<rtx_insn *> (target_label)) == insn
+-	  && ! BARRIER_P (prev_nonnote_insn (as_a<rtx_insn *> (target_label)))
++	  && !BARRIER_P (prev_nonnote_insn (as_a<rtx_insn *> (target_label)))
+ 	  /* If the last insn in the delay slot sets CC0 for some insn,
+ 	     various code assumes that it is in a delay slot.  We could
+ 	     put it back where it belonged and delete the register notes,
+-- 
+1.8.5.6
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
deleted file mode 100644
index 5a14d04..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 16210e6270e200cd4892a90ecef608906be3a130 Mon Sep 17 00:00:00 2001
-From: Kito Cheng <kito.cheng@gmail.com>
-Date: Thu, 4 May 2017 02:11:13 +0800
-Subject: [PATCH] RISC-V: Handle non-legitimate address in
- riscv_legitimize_move
-
-GCC may generate non-legitimate address due to we allow some
-load/store with non-legitimate address in pic.md.
-
-  2017-05-12  Kito Cheng  <kito.cheng@gmail.com>
-
-      * config/riscv/riscv.c (riscv_legitimize_move): Handle
-      non-legitimate address.
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- gcc/ChangeLog            |  5 +++++
- gcc/config/riscv/riscv.c | 16 ++++++++++++++++
- 2 files changed, 21 insertions(+)
-
-diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
-index f7fec4bfcf8..d519be1659a 100644
---- a/gcc/config/riscv/riscv.c
-+++ b/gcc/config/riscv/riscv.c
-@@ -1385,6 +1385,22 @@ riscv_legitimize_move (enum machine_mode mode, rtx dest, rtx src)
-       return true;
-     }
- 
-+  /* RISC-V GCC may generate non-legitimate address due to we provide some
-+     pattern for optimize access PIC local symbol and it's make GCC generate
-+     unrecognizable instruction during optmizing.  */
-+
-+  if (MEM_P (dest) && !riscv_legitimate_address_p (mode, XEXP (dest, 0),
-+						   reload_completed))
-+    {
-+      XEXP (dest, 0) = riscv_force_address (XEXP (dest, 0), mode);
-+    }
-+
-+  if (MEM_P (src) && !riscv_legitimate_address_p (mode, XEXP (src, 0),
-+						  reload_completed))
-+    {
-+      XEXP (src, 0) = riscv_force_address (XEXP (src, 0), mode);
-+    }
-+
-   return false;
- }
- 
--- 
-2.14.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index 6d77620..bdd6f7e 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -3,7 +3,7 @@
 SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
 PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
 
-DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext flex-native"
 
 GCCMULTILIB = "--enable-multilib"
 
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian_6.4.bb
deleted file mode 100644
index bf53c5c..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-canadian_6.4.bb
+++ /dev/null
@@ -1,5 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require gcc-cross-canadian.inc
-
-
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-initial_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-initial_6.4.bb
deleted file mode 100644
index 4c73e5c..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross-initial_6.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require recipes-devtools/gcc/gcc-cross_${PV}.bb
-require gcc-cross-initial.inc
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross_6.4.bb
deleted file mode 100644
index b43cca0..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-cross_6.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require gcc-cross.inc
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk-initial_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk-initial_6.4.bb
deleted file mode 100644
index fd90e11..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk-initial_6.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
-require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
-require gcc-crosssdk-initial.inc
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk_6.4.bb
deleted file mode 100644
index 40a6c4f..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-crosssdk_6.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require recipes-devtools/gcc/gcc-cross_${PV}.bb
-require gcc-crosssdk.inc
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime.inc
index d3d4bd3..7629fa5 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -34,6 +34,18 @@
 # libmudflap
 # libgfortran needs separate recipe due to libquadmath dependency
 
+SLIB = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+SLIB_NEW = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+
+DEBUG_PREFIX_MAP_class-target = " \
+   -fdebug-prefix-map=${WORKDIR}/recipe-sysroot= \
+   -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
+   -fdebug-prefix-map=${SLIB}=${SLIB_NEW} \
+   -fdebug-prefix-map=${SLIB}/include=${SLIB_NEW}/libstdc++-v3/../include \
+   -fdebug-prefix-map=${SLIB}/libiberty=${SLIB_NEW}/libstdc++-v3/../libiberty \
+   -fdebug-prefix-map=${B}=${SLIB_NEW} \
+   "
+
 do_configure () {
 	export CXX="${CXX} -nostdinc++ -nostdlib++"
 	for d in libgcc ${RUNTIMETARGET}; do
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime_6.4.bb
deleted file mode 100644
index 8f31e77..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-runtime_6.4.bb
+++ /dev/null
@@ -1,7 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require gcc-runtime.inc
-
-FILES_libgomp-dev += "\
-    ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/openacc.h \
-"
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers.inc
index 3183b29..3b7e002 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -61,15 +61,19 @@
 RDEPENDS_liblsan-dev += "${PN}"
 RDEPENDS_libtsan-dev += "${PN}"
 RRECOMMENDS_${PN} += "libasan libubsan"
-RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
 RRECOMMENDS_${PN}_append_x86 = " liblsan"
+RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
+RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan"
+RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan"
 
 do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
 do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
 do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
 
-# MIPS, aarch64, and SPARC are broken.
-COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm).*-linux'
+# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
+COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
+# musl is currently broken entirely
+COMPATIBLE_HOST_libc-musl = 'null'
 
 FILES_libasan += "${libdir}/libasan.so.*"
 FILES_libasan-dev += "\
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers_6.4.bb
deleted file mode 100644
index 601f666..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-sanitizers_6.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require gcc-sanitizers.inc
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-source_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-source_6.4.bb
deleted file mode 100644
index b890fa3..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-source_6.4.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require recipes-devtools/gcc/gcc-source.inc
-
-EXCLUDE_FROM_WORLD = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc_6.4.bb
deleted file mode 100644
index 2c618df..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc_6.4.bb
+++ /dev/null
@@ -1,9 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require gcc-target.inc
-
-# Building with thumb enabled on armv4t fails with
-# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
-# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
-ARM_INSTRUCTION_SET_armv4 = "arm"
-
-BBCLASSEXTEND = "nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc-initial_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc-initial_6.4.bb
deleted file mode 100644
index 19f253f..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc-initial_6.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require libgcc-initial.inc
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc.inc
index 1500fb5..5f1dff6 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc.inc
@@ -28,7 +28,7 @@
 
 FILES_${PN}-dev = "\
     ${base_libdir}/libgcc*.so \
-    ${@base_conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
+    ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
     ${libdir}/${TARGET_SYS}/${BINV}* \
     ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
 "
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc_6.4.bb
deleted file mode 100644
index a5152f2..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgcc_6.4.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require libgcc.inc
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran.inc
index 5f5d4af..0523764 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran.inc
@@ -6,22 +6,28 @@
 "
 
 do_configure () {
-	rm -rf ${B}/${TARGET_SYS}/libgfortran/
-	mkdir -p ${B}/${TARGET_SYS}/libgfortran/
-	cd ${B}/${TARGET_SYS}/libgfortran/
-	chmod a+x ${S}/libgfortran/configure
-	relpath=${@os.path.relpath("${S}/libgfortran", "${B}/${TARGET_SYS}/libgfortran")}
-	$relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
-	# Easiest way to stop bad RPATHs getting into the library since we have a
-	# broken libtool here
-	sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libgfortran/libtool
+	for target in libbacktrace libgfortran
+	do
+		rm -rf ${B}/${TARGET_SYS}/$target/
+		mkdir -p ${B}/${TARGET_SYS}/$target/
+		cd ${B}/${TARGET_SYS}/$target/
+		chmod a+x ${S}/$target/configure
+		relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
+		../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+		# Easiest way to stop bad RPATHs getting into the library since we have a
+		# broken libtool here
+		sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
+	done
 }
 EXTRACONFFUNCS += "extract_stashed_builddir"
 do_configure[depends] += "${COMPILERDEP}"
 
 do_compile () {
-	cd ${B}/${TARGET_SYS}/libgfortran/
-	oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/
+	for target in libbacktrace libgfortran
+	do
+		cd ${B}/${TARGET_SYS}/$target/
+		oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
+	done
 }
 
 do_install () {
@@ -67,5 +73,5 @@
 python __anonymous () {
     f = d.getVar("FORTRAN")
     if "fortran" not in f:
-        raise bb.parse.SkipPackage("libgfortran needs fortran support to be enabled in the compiler")
+        raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
 }
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran_6.4.bb b/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran_6.4.bb
deleted file mode 100644
index 71dd8b4..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/libgfortran_6.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
-require recipes-devtools/gcc/gcc-${PV}.inc
-require libgfortran.inc
-