diff --git a/config/dfp.m4 b/config/dfp.m4
index a137ddebf8cde..f726d6992b874 100644
--- a/config/dfp.m4
+++ b/config/dfp.m4
@@ -21,6 +21,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
[
case $1 in
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
+ x86_64-zephyr-* | \
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
i?86*-*-mingw* | x86_64*-*-mingw* | \
i?86*-*-cygwin* | x86_64*-*-cygwin*)
diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index 39ad1139a15f9..79e5beaa08f8f 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -460,6 +460,18 @@ AC_DEFUN([gcc_GAS_FLAGS],
dnl Override the default, which may be incompatible.
gcc_cv_as_flags=--64
;;
+ i[[34567]]86-zephyr*)
+ dnl Override the default, which may be incompatible.
+ gcc_cv_as_flags=--32
+ ;;
+ x86_64-zephyr-elfx32)
+ dnl Override the default, which may be incompatible.
+ gcc_cv_as_flags=--x32
+ ;;
+ x86_64-zephyr*)
+ dnl Override the default, which may be incompatible.
+ gcc_cv_as_flags=--64
+ ;;
powerpc*-*-darwin*)
dnl Always pass -arch ppc to assembler.
gcc_cv_as_flags="-arch ppc"
diff --git a/gcc/config.gcc b/gcc/config.gcc
index c5064dd376660..70d006b3f05ef 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1895,9 +1895,18 @@ x86_64-*-darwin*)
i[34567]86-*-elfiamcu)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/iamcu.h"
;;
+i586-zephyr-elf)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
+ tmake_file="${tmake_file} i386/t-zephyr"
+ ;;
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
;;
+x86_64-zephyr-elf*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
+ tm_file="${tm_file} i386/zephyr64.h"
+ tmake_file="${tmake_file} i386/t-zephyr64"
+ ;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;
@@ -2463,6 +2472,9 @@ riscv*-*-linux*)
riscv*-*-elf* | riscv*-*-rtems*)
tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
case ${target} in
+ *-zephyr*)
+ tmake_file="${tmake_file} riscv/t-zephyr"
+ ;;
*-*-rtems*)
tm_file="${tm_file} riscv/rtems.h rtems.h"
tmake_file="${tmake_file} riscv/t-rtems"
@@ -3363,6 +3375,9 @@ sh-wrs-vxworks)
sparc-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp-elf.h"
case ${target} in
+ sparc-zephyr*)
+ tmake_file="sparc/t-sparc sparc/t-zephyr"
+ ;;
*-leon-*)
tmake_file="sparc/t-sparc sparc/t-leon"
;;
diff --git a/gcc/config/i386/t-zephyr b/gcc/config/i386/t-zephyr
new file mode 100644
index 0000000000000..852e3996f18fa
--- /dev/null
+++ b/gcc/config/i386/t-zephyr
@@ -0,0 +1,23 @@
+# Copyright (C) 2016 Intel Corporation.
+#
+# This file is part of GCC.
+#
+# GCC 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.
+#
+# GCC 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 GCC; see the file COPYING3. If not see
+# .
+#
+
+MULTILIB_OPTIONS += msoft-float
+MULTILIB_DIRNAMES += soft-float
+MULTILIB_MATCHES = msoft-float=mno-80387
+MULTILIB_EXCEPTIONS =
diff --git a/gcc/config/i386/t-zephyr64 b/gcc/config/i386/t-zephyr64
new file mode 100644
index 0000000000000..e73ac6309c147
--- /dev/null
+++ b/gcc/config/i386/t-zephyr64
@@ -0,0 +1,38 @@
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC 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.
+#
+# GCC 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 GCC; see the file COPYING3. If not see
+# .
+
+# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
+# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
+# /lib and /usr/lib, while other distributions install libraries into /lib64
+# and /usr/lib64. The LSB does not enforce the use of /lib64 and /usr/lib64,
+# it doesn't tell anything about the 32bit libraries on those systems. Set
+# MULTILIB_OSDIRNAMES according to what is found on the target.
+
+# To support i386, x86-64 and x32 libraries, the directory structrue
+# should be:
+#
+# /lib has i386 libraries.
+# /lib64 has x86-64 libraries.
+# /libx32 has x32 libraries.
+#
+MULTILIB_OPTIONS = m64/m32 msoft-float
+MULTILIB_DIRNAMES = 64 32 soft-float
+MULTILIB_REQUIRED = m64 m32 m32/msoft-float
+MULTILIB_EXCEPTIONS = msoft-float
+MULTILIB_OSDIRNAMES = m64=!64 m32=!32 m32/msoft-float=!32/soft-float
+MULTILIB_MATCHES = msoft-float=mno-80387
diff --git a/gcc/config/i386/zephyr64.h b/gcc/config/i386/zephyr64.h
new file mode 100644
index 0000000000000..dba11cdf283ef
--- /dev/null
+++ b/gcc/config/i386/zephyr64.h
@@ -0,0 +1,39 @@
+/* Definitions for x86-64 for Zephyr 64-bit toolchain.
+ Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Contributed by Jan Hubicka , based on linux.h.
+ Based on gnu-user64.h.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+. */
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "crtbegin.o%s"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{m32:-m elf_i386} \
+ %{m64:-m elf_x86_64} \
+ %{mx32:-m elf32_x86_64}"
+
+#define MULTILIB_DEFAULTS { "m64" }
diff --git a/gcc/config/nios2/t-nios2 b/gcc/config/nios2/t-nios2
index 1649924c4bb36..b6f0b3e78aef6 100644
--- a/gcc/config/nios2/t-nios2
+++ b/gcc/config/nios2/t-nios2
@@ -18,9 +18,9 @@
# along with GCC; see the file COPYING3. If not see
# .
-# MULTILIB_OPTIONS = mno-hw-mul/mhw-mulx mcustom-fpu-cfg=60-1/mcustom-fpu-cfg=60-2
-# MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
-# MULTILIB_EXCEPTIONS =
+MULTILIB_OPTIONS = mno-hw-mul/mhw-mulx mcustom-fpu-cfg=60-1/mcustom-fpu-cfg=60-2
+MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
+MULTILIB_EXCEPTIONS =
# MULTILIB_OPTIONS += EL/EB
# MULTILIB_DIRNAMES += le be
diff --git a/gcc/config/riscv/t-zephyr b/gcc/config/riscv/t-zephyr
new file mode 100644
index 0000000000000..76d313dd16577
--- /dev/null
+++ b/gcc/config/riscv/t-zephyr
@@ -0,0 +1,62 @@
+# Multilib target configurations
+MULTILIB_SRC_ARCH = rv32im_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32imc_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32imac_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32imafc_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32imafd_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32imafdc_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32g
+MULTILIB_SRC_ARCH += rv32gc
+MULTILIB_SRC_ARCH += rv32em_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32ema_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32emc_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv32emac_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv64imac_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv64imafdc_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv64gc
+MULTILIB_SRC_ARCH += rv64imafd_zicsr_zifencei
+MULTILIB_SRC_ARCH += rv64g
+
+MULTILIB_SRC_ABI = ilp32
+MULTILIB_SRC_ABI += ilp32f
+MULTILIB_SRC_ABI += ilp32d
+MULTILIB_SRC_ABI += ilp32e
+MULTILIB_SRC_ABI += lp64
+MULTILIB_SRC_ABI += lp64d
+
+MULTILIB_SRC_MCMODEL = medany
+
+# Multilib build configurations
+MULTILIB_REQUIRED = \
+march=rv32im_zicsr_zifencei/mabi=ilp32 \
+march=rv32imac_zicsr_zifencei/mabi=ilp32 \
+march=rv32imafc_zicsr_zifencei/mabi=ilp32f \
+march=rv32imafd_zicsr_zifencei/mabi=ilp32d \
+march=rv32em_zicsr_zifencei/mabi=ilp32e \
+march=rv32emc_zicsr_zifencei/mabi=ilp32e \
+march=rv64imac_zicsr_zifencei/mabi=lp64 \
+march=rv64imafdc_zicsr_zifencei/mabi=lp64d \
+march=rv64imafd_zicsr_zifencei/mabi=lp64d \
+march=rv64imac_zicsr_zifencei/mabi=lp64/mcmodel=medany \
+march=rv64imafdc_zicsr_zifencei/mabi=lp64d/mcmodel=medany \
+march=rv64imafd_zicsr_zifencei/mabi=lp64d/mcmodel=medany
+
+# Multilib alternate mapping
+MULTILIB_REUSE = \
+march.rv32im_zicsr_zifencei/mabi.ilp32=march.rv32imc_zicsr_zifencei/mabi.ilp32 \
+march.rv32imafd_zicsr_zifencei/mabi.ilp32d=march.rv32imafdc_zicsr_zifencei/mabi.ilp32d \
+march.rv32imafd_zicsr_zifencei/mabi.ilp32d=march.rv32g/mabi.ilp32d \
+march.rv32imafd_zicsr_zifencei/mabi.ilp32d=march.rv32gc/mabi.ilp32d \
+march.rv32em_zicsr_zifencei/mabi.ilp32e=march.rv32ema_zicsr_zifencei/mabi.ilp32e \
+march.rv32emc_zicsr_zifencei/mabi.ilp32e=march.rv32emac_zicsr_zifencei/mabi.ilp32e \
+march.rv64imafdc_zicsr_zifencei/mabi.lp64d=march.rv64gc/mabi.lp64d \
+march.rv64imafd_zicsr_zifencei/mabi.lp64d=march.rv64g/mabi.lp64d
+
+# Automatically generate multilib options and directory names from the target configurations
+space := $(subst ,, )
+
+MULTILIB_OPTIONS = $(subst $(space),/,$(patsubst %,march=%,$(MULTILIB_SRC_ARCH)))
+MULTILIB_OPTIONS += $(subst $(space),/,$(patsubst %,mabi=%,$(MULTILIB_SRC_ABI)))
+MULTILIB_OPTIONS += $(subst $(space),/,$(patsubst %,mcmodel=%,$(MULTILIB_SRC_MCMODEL)))
+
+MULTILIB_DIRNAMES = $(MULTILIB_SRC_ARCH) $(MULTILIB_SRC_ABI) $(MULTILIB_SRC_MCMODEL)
diff --git a/gcc/config/sparc/t-zephyr b/gcc/config/sparc/t-zephyr
new file mode 100644
index 0000000000000..baaff2f0b77db
--- /dev/null
+++ b/gcc/config/sparc/t-zephyr
@@ -0,0 +1,55 @@
+# Copyright (C) 2012-2014 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC 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.
+#
+# GCC 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 GCC; see the file COPYING3. If not see
+# .
+
+# Multilibs for Zephyr
+MULTILIB_OPTIONS =
+MULTILIB_DIRNAMES =
+
+MULTILIB_OPTIONS += mcpu=leon/mcpu=leon3/mcpu=leon3v7
+MULTILIB_DIRNAMES += leon leon3 leon3v7
+
+MULTILIB_OPTIONS += msoft-float
+MULTILIB_DIRNAMES += soft
+
+MULTILIB_OPTIONS += mflat
+MULTILIB_DIRNAMES += flat
+
+MULTILIB_MATCHES = msoft-float=mno-fpu
+
+
+# This is the complete list of multilibs to build
+MULTILIB_REQUIRED =
+
+
+MULTILIB_REQUIRED += msoft-float
+
+MULTILIB_REQUIRED += mcpu=leon
+MULTILIB_REQUIRED += mcpu=leon/msoft-float
+MULTILIB_REQUIRED += mcpu=leon/mflat
+MULTILIB_REQUIRED += mcpu=leon/msoft-float/mflat
+
+
+MULTILIB_REQUIRED += mcpu=leon3
+MULTILIB_REQUIRED += mcpu=leon3/msoft-float
+MULTILIB_REQUIRED += mcpu=leon3/mflat
+MULTILIB_REQUIRED += mcpu=leon3/msoft-float/mflat
+
+MULTILIB_REQUIRED += mcpu=leon3v7
+MULTILIB_REQUIRED += mcpu=leon3v7/msoft-float
+MULTILIB_REQUIRED += mcpu=leon3v7/mflat
+MULTILIB_REQUIRED += mcpu=leon3v7/msoft-float/mflat
diff --git a/gcc/configure b/gcc/configure
index 5ce0557719a9f..38bec5c80df4a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7897,6 +7897,7 @@ else
case $target in
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
+ x86_64*-zephyr-* | \
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
i?86*-*-mingw* | x86_64*-*-mingw* | \
i?86*-*-cygwin* | x86_64*-*-cygwin*)
@@ -15431,7 +15432,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -15446,7 +15447,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -15475,7 +15476,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
@@ -23724,6 +23725,15 @@ else
x86_64-*-linux*)
gcc_cv_as_flags=--64
;;
+ i[34567]86-zephyr*)
+ gcc_cv_as_flags=--32
+ ;;
+ x86_64-zephyr-elfx32)
+ gcc_cv_as_flags=--x32
+ ;;
+ x86_64-zephyr*)
+ gcc_cv_as_flags=--64
+ ;;
powerpc*-*-darwin*)
gcc_cv_as_flags="-arch ppc"
;;
diff --git a/libatomic/configure b/libatomic/configure
index 92853dd8a4585..d7e506598bc9e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -6872,7 +6872,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6887,7 +6887,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6916,7 +6916,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 17f470a4becb9..c9c1ab4648ec5 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -7268,7 +7268,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7283,7 +7283,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7312,7 +7312,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libcc1/configure b/libcc1/configure
index 01cfb2806da6d..50f80f3e33f4c 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -6535,7 +6535,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6550,7 +6550,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6579,7 +6579,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libdecnumber/configure b/libdecnumber/configure
index da5302f9315e5..93c9c4d87bdfa 100755
--- a/libdecnumber/configure
+++ b/libdecnumber/configure
@@ -4904,6 +4904,7 @@ else
case $target in
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
+ x86_64-zephyr-* | \
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
i?86*-*-mingw* | x86_64*-*-mingw* | \
i?86*-*-cygwin* | x86_64*-*-cygwin*)
diff --git a/libffi/configure b/libffi/configure
index 575641cca1d91..c2607cb2c4810 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -7061,7 +7061,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7076,7 +7076,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7105,7 +7105,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libgcc/config.host b/libgcc/config.host
index 8c56fcae5d2fd..15c64989c7cf8 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -711,9 +711,15 @@ x86_64-*-darwin*)
i[34567]86-*-elfiamcu)
tmake_file="$tmake_file i386/t-crtstuff t-softfp-sfdftf i386/32/t-softfp i386/32/t-iamcu i386/t-softfp t-softfp t-dfprules"
;;
+i586-zephyr-elf)
+ tmake_file="$tmake_file i386/t-crtstuff t-softfp-sfdf i386/32/t-zephyr i386/t-softfp t-softfp t-dfprules"
+ ;;
i[34567]86-*-elf*)
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
;;
+x86_64-zephyr-elf)
+ tmake_file="$tmake_file i386/t-crtstuff i386/64/t-zephyr64"
+ ;;
x86_64-*-elf* | x86_64-*-rtems*)
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
case ${host} in
@@ -1565,7 +1571,14 @@ i[34567]86-*-linux* | x86_64-*-linux* | \
esac
case ${host} in
-i[34567]86-*-elfiamcu | i[34567]86-*-rtems*)
+x86_64-zephyr-elf)
+ tmake_file="${tmake_file} t-softfp-sfdf"
+ if test "${host_address}" = 32; then
+ tmake_file="${tmake_file} i386/${host_address}/t-softfp"
+ fi
+ tmake_file="${tmake_file} i386/64/t-softfp i386/t-softfp t-softfp t-dfprules"
+ ;;
+i[34567]86-*-elfiamcu | i[34567]86-zephyr-elf | i[34567]86-*-rtems*)
# These use soft-fp for SFmode and DFmode, not just TFmode.
;;
i[34567]86-*-* | x86_64-*-*)
diff --git a/libgcc/config/i386/32/t-zephyr b/libgcc/config/i386/32/t-zephyr
new file mode 100644
index 0000000000000..7595cdeed842a
--- /dev/null
+++ b/libgcc/config/i386/32/t-zephyr
@@ -0,0 +1 @@
+HOST_LIBGCC2_CFLAGS += -mlong-double-80
diff --git a/libgcc/config/i386/64/t-softfp b/libgcc/config/i386/64/t-softfp
index 3bec464d7867c..f35d6161b6412 100644
--- a/libgcc/config/i386/64/t-softfp
+++ b/libgcc/config/i386/64/t-softfp
@@ -1,6 +1,2 @@
-softfp_extras := fixhfti fixunshfti floattihf floatuntihf
-
-CFLAGS-fixhfti.c += -msse2
-CFLAGS-fixunshfti.c += -msse2
-CFLAGS-floattihf.c += -msse2
-CFLAGS-floatunstihf.c += -msse2
+softfp_wrap_start := '\#ifndef __x86_64__'
+softfp_wrap_end := '\#endif'
diff --git a/libgcc/config/i386/64/t-zephyr64 b/libgcc/config/i386/64/t-zephyr64
new file mode 100644
index 0000000000000..7595cdeed842a
--- /dev/null
+++ b/libgcc/config/i386/64/t-zephyr64
@@ -0,0 +1 @@
+HOST_LIBGCC2_CFLAGS += -mlong-double-80
diff --git a/libgcc/configure b/libgcc/configure
index 1f9b2ac578be6..aaca51ed1125a 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -4772,6 +4772,7 @@ else
case $host in
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
+ x86_64-zephyr-* | \
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
i?86*-*-mingw* | x86_64*-*-mingw* | \
i?86*-*-cygwin* | x86_64*-*-cygwin*)
diff --git a/libgfortran/configure b/libgfortran/configure
index ae64dca31140e..48104569ddf07 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -8492,7 +8492,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8507,7 +8507,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -8536,7 +8536,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libgomp/configure b/libgomp/configure
index 5ef071ea046d1..000f02f340a6d 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -6921,7 +6921,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6936,7 +6936,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6965,7 +6965,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libitm/configure b/libitm/configure
index 18fc2d3a10a78..d48f4f78432cf 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -7547,7 +7547,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7562,7 +7562,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7591,7 +7591,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libphobos/configure b/libphobos/configure
index 9da06f087d095..f14cfefc51c50 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -7508,7 +7508,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7523,7 +7523,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7552,7 +7552,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libquadmath/configure b/libquadmath/configure
index b3ee64f9c7de7..68ab020466d3a 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -6530,7 +6530,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6545,7 +6545,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6574,7 +6574,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 771b135573a8b..2849f453ddeb7 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -8117,7 +8117,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8132,7 +8132,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -8161,7 +8161,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libssp/configure b/libssp/configure
index 10ba209bde8ef..039140d468872 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -6716,7 +6716,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6731,7 +6731,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6760,7 +6760,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 9b94fd71e4248..0ce74e8202443 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -7787,7 +7787,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7802,7 +7802,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7831,7 +7831,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index ec32980aa0db8..ac34f09d2e81d 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -315,6 +315,15 @@ esac
# Set any OS-dependent and CPU-dependent bits.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
case "${host}" in
+ *-zephyr-elf*)
+ case "${host_cpu}" in
+ i[567]86)
+ abi_baseline_pair=i486-zephyr-elf
+ ;;
+ x86_64)
+ abi_baseline_pair=x86_64-zephyr-elf
+ ;;
+ esac
*-*-linux* | *-*-uclinux*)
case "${host_cpu}" in
i[567]86)
diff --git a/libtool.m4 b/libtool.m4
index 17f8e5f30749d..1d9d0fb33b3c6 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1222,7 +1222,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1233,7 +1233,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -1262,7 +1262,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/libvtv/configure b/libvtv/configure
index d64b4af5c6b1f..628acc09b9fb6 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -8012,7 +8012,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8027,7 +8027,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -8056,7 +8056,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/lto-plugin/configure b/lto-plugin/configure
index b820accfd655c..6ea26a8de9403 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -7838,7 +7838,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7853,7 +7853,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7882,7 +7882,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
diff --git a/zlib/configure b/zlib/configure
index f489f31bc703b..49015c617e9a4 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -6192,7 +6192,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6207,7 +6207,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -6236,7 +6236,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
+ x86_64-*linux*|x86_64-zephyr-*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)