aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config.gcc24
-rw-r--r--gcc/config/dragonfly-rust.cc40
-rw-r--r--gcc/config/freebsd-rust.cc40
-rw-r--r--gcc/config/fuchsia-rust.cc40
-rw-r--r--gcc/config/linux-rust.cc57
-rw-r--r--gcc/config/netbsd-rust.cc40
-rw-r--r--gcc/config/openbsd-rust.cc40
-rw-r--r--gcc/config/sol2-rust.cc40
-rw-r--r--gcc/config/t-dragonfly4
-rw-r--r--gcc/config/t-freebsd4
-rw-r--r--gcc/config/t-fuchsia21
-rw-r--r--gcc/config/t-linux4
-rw-r--r--gcc/config/t-netbsd4
-rw-r--r--gcc/config/t-openbsd5
-rw-r--r--gcc/config/t-sol25
-rw-r--r--gcc/config/t-vxworks4
-rw-r--r--gcc/config/t-winnt4
-rw-r--r--gcc/config/vxworks-rust.cc40
-rw-r--r--gcc/config/winnt-rust.cc40
19 files changed, 456 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 4cd81c8..7a2daa9 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -790,6 +790,8 @@ case ${target} in
d_target_objs="${d_target_objs} dragonfly-d.o"
tmake_file="${tmake_file} t-dragonfly"
target_has_targetdm=yes
+ rust_target_objs="${rust_target_objs} dragonfly-rust.o"
+ target_has_targetrustm=yes
;;
*-*-freebsd*)
# This is the generic ELF configuration of FreeBSD. Later
@@ -841,9 +843,14 @@ case ${target} in
d_target_objs="${d_target_objs} freebsd-d.o"
tmake_file="${tmake_file} t-freebsd"
target_has_targetdm=yes
+ rust_target_objs="${rust_target_objs} freebsd-rust.o"
+ target_has_targetrustm=yes
;;
*-*-fuchsia*)
native_system_header_dir=/include
+ tmake_file="t-fuchsia"
+ rust_target_objs="${rust_target_objs} fuchsia-rust.o"
+ target_has_targetrustm=yes
;;
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
extra_options="$extra_options gnu-user.opt"
@@ -912,6 +919,12 @@ case ${target} in
gcc_cv_initfini_array=yes
;;
esac
+ case $target in
+ *linux*)
+ rust_target_objs="${rust_target_objs} linux-rust.o"
+ target_has_targetrustm=yes
+ ;;
+ esac
;;
*-*-netbsd*)
tm_p_file="${tm_p_file} netbsd-protos.h"
@@ -932,6 +945,8 @@ case ${target} in
default_gnu_indirect_function=yes
;;
esac
+ rust_target_objs="${rust_target_objs} netbsd-rust.o"
+ target_has_targetrustm=yes
;;
*-*-openbsd*)
tmake_file="t-openbsd"
@@ -947,6 +962,8 @@ case ${target} in
esac
d_target_objs="${d_target_objs} openbsd-d.o"
target_has_targetdm=yes
+ rust_target_objs="${rust_target_objs} openbsd-rust.o"
+ target_has_targetrustm=yes
;;
*-*-phoenix*)
gas=yes
@@ -1011,6 +1028,8 @@ case ${target} in
;;
esac
target_has_targetdm=yes
+ rust_target_objs="${rust_target_objs} sol2-rust.o"
+ target_has_targetrustm=yes
;;
*-*-*vms*)
extra_options="${extra_options} vms/vms.opt"
@@ -1043,6 +1062,9 @@ case ${target} in
extra_headers="${extra_headers} ../vxworks/vxworks-predef.h"
target_has_targetcm="yes"
+ rust_target_objs="${rust_target_objs} vxworks-rust.o"
+ target_has_targetrustm=yes
+
# This private header exposes a consistent interface for checks on
# the VxWorks version our runtime header files need to perform, based on
# what the system headers adverstise:
@@ -2100,6 +2122,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
d_target_objs="${d_target_objs} winnt-d.o"
target_has_targetcm="yes"
target_has_targetdm="yes"
+ rust_target_objs="${rust_target_objs} winnt-rust.o"
+ target_has_targetrustm="yes"
case ${target} in
x86_64-*-* | *-w64-*)
need_64bit_isa=yes
diff --git a/gcc/config/dragonfly-rust.cc b/gcc/config/dragonfly-rust.cc
new file mode 100644
index 0000000..ce501d1
--- /dev/null
+++ b/gcc/config/dragonfly-rust.cc
@@ -0,0 +1,40 @@
+/* DragonFly support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for DragonFly targets. */
+
+static void
+dragonfly_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "dragonfly");
+ rust_add_target_info ("target_vendor", "unknown");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO dragonfly_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/freebsd-rust.cc b/gcc/config/freebsd-rust.cc
new file mode 100644
index 0000000..1dbf2ed
--- /dev/null
+++ b/gcc/config/freebsd-rust.cc
@@ -0,0 +1,40 @@
+/* FreeBSD support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for FreeBSD targets. */
+
+static void
+freebsd_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "freebsd");
+ rust_add_target_info ("target_vendor", "unknown");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO freebsd_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/fuchsia-rust.cc b/gcc/config/fuchsia-rust.cc
new file mode 100644
index 0000000..8626250
--- /dev/null
+++ b/gcc/config/fuchsia-rust.cc
@@ -0,0 +1,40 @@
+/* Fuchsia support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for Fuchsia targets. */
+
+static void
+fushsia_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "fushsia");
+ rust_add_target_info ("target_vendor", "unknown");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO fushsia_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/linux-rust.cc b/gcc/config/linux-rust.cc
new file mode 100644
index 0000000..3eaa918
--- /dev/null
+++ b/gcc/config/linux-rust.cc
@@ -0,0 +1,57 @@
+/* Linux support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* `-mandroid' is not available as an command-line option. */
+#ifndef TARGET_ANDROID
+#define TARGET_ANDROID 0
+#endif
+
+/* Implement TARGET_RUST_OS_INFO for Linux targets. */
+
+static void
+linux_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_vendor", "unknown");
+
+ if (TARGET_ANDROID)
+ rust_add_target_info ("target_os", "android");
+ else
+ rust_add_target_info ("target_os", "linux");
+
+ if (OPTION_GLIBC)
+ rust_add_target_info ("target_env", "gnu");
+ else if (OPTION_MUSL)
+ rust_add_target_info ("target_env", "musl");
+ else if (OPTION_UCLIBC)
+ rust_add_target_info ("target_env", "uclibc");
+ else
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO linux_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/netbsd-rust.cc b/gcc/config/netbsd-rust.cc
new file mode 100644
index 0000000..9395466
--- /dev/null
+++ b/gcc/config/netbsd-rust.cc
@@ -0,0 +1,40 @@
+/* NetBSD support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for NetBSD targets. */
+
+static void
+netbsd_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "netbsd");
+ rust_add_target_info ("target_vendor", "unknown");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO netbsd_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/openbsd-rust.cc b/gcc/config/openbsd-rust.cc
new file mode 100644
index 0000000..c4721ea
--- /dev/null
+++ b/gcc/config/openbsd-rust.cc
@@ -0,0 +1,40 @@
+/* OpenBSD support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for OpenBSD targets. */
+
+static void
+openbsd_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "openbsd");
+ rust_add_target_info ("target_vendor", "unknown");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO openbsd_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/sol2-rust.cc b/gcc/config/sol2-rust.cc
new file mode 100644
index 0000000..e36bd45
--- /dev/null
+++ b/gcc/config/sol2-rust.cc
@@ -0,0 +1,40 @@
+/* Solaris support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for Solaris targets. */
+
+static void
+solaris_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "solaris");
+ rust_add_target_info ("target_vendor", "sun");
+ rust_add_target_info ("target_env", "");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO solaris_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/t-dragonfly b/gcc/config/t-dragonfly
index a282579..1eee293 100644
--- a/gcc/config/t-dragonfly
+++ b/gcc/config/t-dragonfly
@@ -19,3 +19,7 @@
dragonfly-d.o: $(srcdir)/config/dragonfly-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+dragonfly-rust.o: $(srcdir)/config/dragonfly-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-freebsd b/gcc/config/t-freebsd
index 37049f7..dd5dfdd 100644
--- a/gcc/config/t-freebsd
+++ b/gcc/config/t-freebsd
@@ -19,3 +19,7 @@
freebsd-d.o: $(srcdir)/config/freebsd-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+freebsd-rust.o: $(srcdir)/config/freebsd-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-fuchsia b/gcc/config/t-fuchsia
new file mode 100644
index 0000000..55c884b
--- /dev/null
+++ b/gcc/config/t-fuchsia
@@ -0,0 +1,21 @@
+# Copyright (C) 2022 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
+# <http://www.gnu.org/licenses/>.
+
+fuchsia-rust.o: $(srcdir)/config/fuchsia-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
index d9bc9b8..8404e14 100644
--- a/gcc/config/t-linux
+++ b/gcc/config/t-linux
@@ -19,3 +19,7 @@
linux.o: $(srcdir)/config/linux.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+linux-rust.o: $(srcdir)/config/linux-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd
index 77f850f..b9546da 100644
--- a/gcc/config/t-netbsd
+++ b/gcc/config/t-netbsd
@@ -23,3 +23,7 @@ netbsd.o: $(srcdir)/config/netbsd.cc
netbsd-d.o: $(srcdir)/config/netbsd-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+netbsd-rust.o: $(srcdir)/config/netbsd-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-openbsd b/gcc/config/t-openbsd
index 69643f5..3b625d6 100644
--- a/gcc/config/t-openbsd
+++ b/gcc/config/t-openbsd
@@ -5,3 +5,8 @@ USER_H = $(EXTRA_HEADERS)
openbsd-d.o: $(srcdir)/config/openbsd-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+# OpenBSD-specific Rust support.
+openbsd-rust.o: $(srcdir)/config/openbsd-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2
index 8732e2e..e207534 100644
--- a/gcc/config/t-sol2
+++ b/gcc/config/t-sol2
@@ -31,6 +31,11 @@ sol2-d.o: $(srcdir)/config/sol2-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+# Solaris-specific Rust support.
+sol2-rust.o: $(srcdir)/config/sol2-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
# Corresponding stub routines.
sol2-stubs.o: $(srcdir)/config/sol2-stubs.cc
$(COMPILE) $<
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index 40c6cc4..7fb2adf 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -24,6 +24,10 @@ vxworks-c.o: $(srcdir)/config/vxworks-c.cc
$(COMPILE) $<
$(POSTCOMPILE)
+vxworks-rust.o: $(srcdir)/config/vxworks-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
# We leverage $sysroot to find target system headers only, distributed
# in a VxWorks (a)typical fashion with a different set of headers for
# rtp vs kernel mode. We setup SYSROOT_HEADERS_SUFFIX_SPEC to handle
diff --git a/gcc/config/t-winnt b/gcc/config/t-winnt
index c44e9bf..3c7c953 100644
--- a/gcc/config/t-winnt
+++ b/gcc/config/t-winnt
@@ -20,3 +20,7 @@ winnt-c.o: config/winnt-c.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(C_TARGET_H) $(C_TARGET_DEF_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$< $(OUTPUT_OPTION)
+
+winnt-rust.o: $(srcdir)/config/winnt-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/vxworks-rust.cc b/gcc/config/vxworks-rust.cc
new file mode 100644
index 0000000..76d618c
--- /dev/null
+++ b/gcc/config/vxworks-rust.cc
@@ -0,0 +1,40 @@
+/* VxWorks support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for VxWorks targets. */
+
+static void
+vxworks_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "unix");
+ rust_add_target_info ("target_os", "vxworks");
+ rust_add_target_info ("target_vendor", "wrs");
+ rust_add_target_info ("target_env", "gnu");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO vxworks_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;
diff --git a/gcc/config/winnt-rust.cc b/gcc/config/winnt-rust.cc
new file mode 100644
index 0000000..190584d
--- /dev/null
+++ b/gcc/config/winnt-rust.cc
@@ -0,0 +1,40 @@
+/* Windows support needed only by Rust front-end.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+
+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
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_rust.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_OS_INFO for Windows targets. */
+
+static void
+winnt_rust_target_os_info (void)
+{
+ rust_add_target_info ("target_family", "windows");
+ rust_add_target_info ("target_os", "windows");
+ rust_add_target_info ("target_vendor", "pc");
+ rust_add_target_info ("target_env", "gnu");
+}
+
+#undef TARGET_RUST_OS_INFO
+#define TARGET_RUST_OS_INFO winnt_rust_target_os_info
+
+struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER;