]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config.gcc
AVR: target/115065 - Tweak __clzhi2.
[thirdparty/gcc.git] / gcc / config.gcc
index b8aea73a9e0b2c1c063d834f9c946e4359455e42..cfc2db545d010c3755dd64548a5d40943f34fc82 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-3.0-or-later
 # GCC target-specific configuration file.
-# Copyright (C) 1997-2023 Free Software Foundation, Inc.
+# Copyright (C) 1997-2024 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
@@ -90,6 +90,9 @@
 #  tm_d_file           A list of headers with definitions of target hook
 #                      macros for the D compiler.
 #
+#  tm_rust_file                list of headers with definitions of target hook
+#                      macros for the Rust compiler.
+#
 #  out_file            The name of the machine description C support
 #                      file, if different from "$cpu_type/$cpu_type.c".
 #
 #  fortran_target_objs List of extra target-dependent objects that be
 #                      linked into the fortran compiler only.
 #
+#  rust_target_objs    List of extra target-dependent objects that be
+#                      linked into the Rust compiler only.
+#
 #  target_gtfiles       List of extra source files with type information.
 #
 #  xm_defines          List of macros to define when compiling for the
 #
 #  target_has_targetdm Set to yes or no depending on whether the target
 #                      has its own definition of targetdm.
+#
+#  target_has_targetrustm      Set to yes or no depending on whether the target
+#                      has its own definition of targetrustm.
 
 out_file=
 common_out_file=
@@ -218,9 +227,11 @@ c_target_objs=
 cxx_target_objs=
 d_target_objs=
 fortran_target_objs=
+rust_target_objs=
 target_has_targetcm=no
 target_has_targetm_common=yes
 target_has_targetdm=no
+target_has_targetrustm=no
 tm_defines=
 xm_defines=
 # Set this to force installation and use of collect2.
@@ -260,8 +271,9 @@ case ${target}:`uname -v` in
 esac
 
 # Obsolete configurations.
-case ${target}${target_min} in
-    *-*-solaris2.11.[0-3]*             \
+case ${target} in
+     ia64*-*-*                         \
+   | nios2*-*-*                                \
  )
     if test "x$enable_obsolete" != xyes; then
       echo "*** Configuration ${target}${target_min} is obsolete." >&2
@@ -275,7 +287,7 @@ esac
 # Unsupported targets list.  Do not put an entry in this list unless
 # it would otherwise be caught by a more permissive pattern.  The list
 # should be in alphabetical order.
-case ${target} in
+case ${target}${target_min} in
  # Avoid special cases that are not obsolete
    arm*-*-*eabi*                       \
  )
@@ -312,6 +324,7 @@ case ${target} in
  | *-*-solaris2.[0-9]                  \
  | *-*-solaris2.[0-9].*                        \
  | *-*-solaris2.10*                    \
+ | *-*-solaris2.11.[0-3]*              \
  | *-*-sysv*                           \
  | vax-*-vms*                          \
  )
@@ -334,12 +347,12 @@ m32c*-*-*)
         ;;
 aarch64*-*-*)
        cpu_type=aarch64
-       extra_headers="arm_fp16.h arm_neon.h arm_bf16.h arm_acle.h arm_sve.h"
+       extra_headers="arm_fp16.h arm_neon.h arm_bf16.h arm_acle.h arm_sve.h arm_sme.h arm_neon_sve_bridge.h"
        c_target_objs="aarch64-c.o"
        cxx_target_objs="aarch64-c.o"
        d_target_objs="aarch64-d.o"
-       extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o"
-       target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
+       extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o aarch64-sve-builtins-sme.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o aarch64-early-ra.o aarch64-ldp-fusion.o"
+       target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.h \$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
        target_has_targetm_common=yes
        ;;
 alpha*-*-*)
@@ -381,6 +394,8 @@ bfin*-*)
        ;;
 bpf-*-*)
        cpu_type=bpf
+       c_target_objs="bpf-c.o"
+       cxx_target_objs="bpf-c.o"
        ;;
 frv*)  cpu_type=frv
        extra_options="${extra_options} g.opt"
@@ -425,18 +440,20 @@ i[34567]86-*-* | x86_64-*-*)
                       avx512vbmi2vlintrin.h avx512vnniintrin.h
                       avx512vnnivlintrin.h vaesintrin.h vpclmulqdqintrin.h
                       avx512vpopcntdqvlintrin.h avx512bitalgintrin.h
-                      pconfigintrin.h wbnoinvdintrin.h movdirintrin.h
-                      waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h
-                      avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
-                      avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
-                      tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
-                      amxbf16intrin.h x86gprintrin.h uintrintrin.h
-                      hresetintrin.h keylockerintrin.h avxvnniintrin.h
-                      mwaitintrin.h avx512fp16intrin.h avx512fp16vlintrin.h
-                      avxifmaintrin.h avxvnniint8intrin.h avxneconvertintrin.h
+                      avx512bitalgvlintrin.h pconfigintrin.h wbnoinvdintrin.h
+                      movdirintrin.h waitpkgintrin.h cldemoteintrin.h
+                      avx512bf16vlintrin.h avx512bf16intrin.h enqcmdintrin.h
+                      serializeintrin.h avx512vp2intersectintrin.h
+                      avx512vp2intersectvlintrin.h tsxldtrkintrin.h
+                      amxtileintrin.h amxint8intrin.h amxbf16intrin.h
+                      x86gprintrin.h uintrintrin.h hresetintrin.h
+                      keylockerintrin.h avxvnniintrin.h mwaitintrin.h
+                      avx512fp16intrin.h avx512fp16vlintrin.h avxifmaintrin.h
+                      avxvnniint8intrin.h avxneconvertintrin.h
                       cmpccxaddintrin.h amxfp16intrin.h prfchiintrin.h
                       raointintrin.h amxcomplexintrin.h avxvnniint16intrin.h
-                      sm3intrin.h sha512intrin.h sm4intrin.h"
+                      sm3intrin.h sha512intrin.h sm4intrin.h
+                      usermsrintrin.h"
        ;;
 ia64-*-*)
        extra_headers=ia64intrin.h
@@ -469,8 +486,9 @@ mips*-*-*)
        ;;
 loongarch*-*-*)
        cpu_type=loongarch
-       extra_headers="larchintrin.h"
-       extra_objs="loongarch-c.o loongarch-builtins.o loongarch-cpu.o loongarch-opts.o loongarch-def.o"
+       d_target_objs="loongarch-d.o"
+       extra_headers="larchintrin.h lsxintrin.h lasxintrin.h"
+       extra_objs="loongarch-c.o loongarch-builtins.o loongarch-cpu.o loongarch-opts.o loongarch-def.o loongarch-evolution.o"
        extra_gcc_objs="loongarch-driver.o loongarch-cpu.o loongarch-opts.o loongarch-def.o"
        extra_options="${extra_options} g.opt fused-madd.opt"
        ;;
@@ -530,11 +548,12 @@ pru-*-*)
        ;;
 riscv*)
        cpu_type=riscv
-       extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o riscv-selftests.o riscv-v.o riscv-vsetvl.o riscv-vector-costs.o"
+       extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o riscv-selftests.o riscv-string.o"
+       extra_objs="${extra_objs} riscv-v.o riscv-vsetvl.o riscv-vector-costs.o riscv-avlprop.o"
        extra_objs="${extra_objs} riscv-vector-builtins.o riscv-vector-builtins-shapes.o riscv-vector-builtins-bases.o"
-       extra_objs="${extra_objs} thead.o"
+       extra_objs="${extra_objs} thead.o riscv-target-attr.o"
        d_target_objs="riscv-d.o"
-       extra_headers="riscv_vector.h"
+       extra_headers="riscv_vector.h riscv_crypto.h riscv_bitmanip.h riscv_th_vector.h"
        target_gtfiles="$target_gtfiles \$(srcdir)/config/riscv/riscv-vector-builtins.cc"
        target_gtfiles="$target_gtfiles \$(srcdir)/config/riscv/riscv-vector-builtins.h"
        ;;
@@ -557,6 +576,7 @@ s390*-*-*)
        d_target_objs="s390-d.o"
        extra_options="${extra_options} fused-madd.opt"
        extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
+       target_gtfiles="./s390-gen-builtins.h"
        ;;
 # Note the 'l'; we need to be able to match e.g. "shle" or "shl".
 sh[123456789lbe]*-*-* | sh-*-*)
@@ -590,6 +610,16 @@ then
        tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-d.h"
 fi
 
+tm_rust_file=
+if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.h
+then
+       tm_rust_file="${cpu_type}/${cpu_type}-rust.h"
+fi
+if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.cc
+then
+       rust_target_objs="${rust_target_objs} ${cpu_type}-rust.o"
+fi
+
 extra_modes=
 if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def
 then
@@ -676,15 +706,15 @@ c7 esther"
 # 64-bit x86 processors supported by --with-arch=.  Each processor
 # MUST be separated by exactly one space.
 x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
-bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 k8 k8-sse3 opteron \
-opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom \
-slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
+bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 k8 k8-sse3 \
+opteron opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i core-avx2 \
+atom slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
 silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
 skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
 sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
-nano-x2 eden-x4 nano-x4 lujiazui x86-64 x86-64-v2 x86-64-v3 x86-64-v4 \
+nano-x2 eden-x4 nano-x4 lujiazui yongfeng x86-64 x86-64-v2 x86-64-v3 x86-64-v4 \
 sierraforest graniterapids graniterapids-d grandridge arrowlake arrowlake-s \
-native"
+clearwaterforest pantherlake native"
 
 # Additional x86 processors supported by --with-cpu=.  Each processor
 # MUST be separated by exactly one space.
@@ -758,8 +788,10 @@ case ${target} in
   cxx_target_objs="${cxx_target_objs} darwin-c.o"
   d_target_objs="${d_target_objs} darwin-d.o"
   fortran_target_objs="darwin-f.o"
+  rust_target_objs="${rust_target_objs} darwin-rust.o"
   target_has_targetcm=yes
   target_has_targetdm=yes
+  target_has_targetrustm=yes
   extra_objs="${extra_objs} darwin.o"
   extra_gcc_objs="darwin-driver.o"
   default_use_cxa_atexit=yes
@@ -790,6 +822,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 +875,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"
@@ -914,6 +953,8 @@ case ${target} in
     *-*-*linux*)
       d_target_objs="${d_target_objs} linux-d.o"
       target_has_targetdm=yes
+      rust_target_objs="${rust_target_objs} linux-rust.o"
+      target_has_targetrustm=yes
       ;;
     *-*-kfreebsd*-gnu)
       d_target_objs="${d_target_objs} kfreebsd-d.o"
@@ -948,6 +989,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"
@@ -963,6 +1006,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
@@ -1001,12 +1046,8 @@ case ${target} in
   sol2_tm_file_head="elfos.h ${cpu_type}/sysv4.h"
   sol2_tm_file_tail="${cpu_type}/sol2.h sol2.h"
   sol2_tm_file="${sol2_tm_file_head} ${sol2_tm_file_tail}"
-  case ${target} in
-    *-*-solaris2.1[1-9]*)
-      # __cxa_atexit was introduced in Solaris 11.4.
-      default_use_cxa_atexit=yes
-      ;;
-  esac
+  # __cxa_atexit was introduced in Solaris 11.4.
+  default_use_cxa_atexit=yes
   use_gcc_stdint=wrap
   if test x$gnu_ld = xyes; then
     tm_file="usegld.h ${tm_file}"
@@ -1027,6 +1068,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"
@@ -1059,6 +1102,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
+
   extra_gcc_objs="vxworks-driver.o"
 
   # This private header exposes a consistent interface for checks on
@@ -1127,6 +1173,17 @@ case ${target} in
   ;;
 esac
 
+# Figure out if we need to enable heap trampolines by default
+case ${target} in
+*-*-darwin2*)
+  # Currently, we do this for macOS 11 and above.
+  tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1"
+  ;;
+*)
+  tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=0"
+  ;;
+esac
+
 case ${target} in
 aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
        tm_file="${tm_file} elfos.h newlib-stdint.h"
@@ -1141,6 +1198,7 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
                 ;;
        aarch64-*-rtems*)
                tm_file="${tm_file} aarch64/rtems.h rtems.h"
+               tmake_file="${tmake_file} aarch64/t-aarch64-rtems"
                ;;
        esac
        case $target in
@@ -1206,6 +1264,37 @@ aarch64*-*-linux*)
        done
        TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
        ;;
+aarch64*-*-gnu*)
+        tm_file="${tm_file} elfos.h gnu-user.h gnu.h glibc-stdint.h"
+        tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-gnu.h"
+        tmake_file="${tmake_file} aarch64/t-aarch64"
+        tm_defines="${tm_defines}  TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
+       ;;
+aarch64-*-mingw*)
+       tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
+       tm_file="${tm_file} aarch64/aarch64-coff.h"
+       tm_file="${tm_file} aarch64/cygming.h"
+       tm_file="${tm_file} mingw/mingw32.h"
+       tm_file="${tm_file} mingw/mingw-stdint.h"
+       tmake_file="${tmake_file} aarch64/t-aarch64"
+       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+       extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
+       extra_objs="${extra_objs} winnt.o"
+       c_target_objs="${c_target_objs} msformat-c.o"
+       d_target_objs="${d_target_objs} winnt-d.o"
+       tmake_file="${tmake_file} mingw/t-cygming"
+       case ${enable_threads} in
+         "" | yes | win32)
+           thread_file='win32'
+           ;;
+         posix)
+           thread_file='posix'
+           ;;
+       esac
+       default_use_cxa_atexit=yes
+       user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
+       tm_defines="${tm_defines} TARGET_AARCH64_MS_ABI=1"
+       ;;
 aarch64*-wrs-vxworks*)
         tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
         tm_file="${tm_file} vx-common.h vxworks.h aarch64/aarch64-vxworks.h"
@@ -1595,10 +1684,9 @@ bpf-*-*)
         tm_file="elfos.h ${tm_file}"
         tmake_file="${tmake_file} bpf/t-bpf"
         use_collect2=no
-        extra_headers="bpf-helpers.h"
         use_gcc_stdint=provide
-        extra_objs="coreout.o core-builtins.o"
-        target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/coreout.cc \$(srcdir)/config/bpf/core-builtins.cc"
+        extra_objs="btfext-out.o core-builtins.o"
+        target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/btfext-out.cc \$(srcdir)/config/bpf/core-builtins.cc"
         ;;
 cris-*-elf | cris-*-none)
        tm_file="elfos.h newlib-stdint.h ${tm_file}"
@@ -1715,7 +1803,6 @@ amdgcn-*-amdhsa)
        native_system_header_dir=/include
        extra_modes=gcn/gcn-modes.def
        extra_objs="${extra_objs} gcn-tree.o"
-       extra_gcc_objs="driver-gcn.o"
        case "$host" in
        x86_64*-*-linux-gnu )
                if test "$ac_cv_search_dlopen" != no; then
@@ -2090,9 +2177,9 @@ i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
 i[34567]86-*-cygwin*)
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
        xm_file=i386/xm-cygwin.h
-       tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-       target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-       extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+       tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+       extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
        extra_objs="${extra_objs} winnt.o winnt-stubs.o"
        c_target_objs="${c_target_objs} msformat-c.o"
        cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
@@ -2108,9 +2195,9 @@ x86_64-*-cygwin*)
        need_64bit_isa=yes
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
        xm_file=i386/xm-cygwin.h
-       tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-       target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-       extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+       tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+       extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
        extra_objs="${extra_objs} winnt.o winnt-stubs.o"
        c_target_objs="${c_target_objs} msformat-c.o"
        cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
@@ -2131,6 +2218,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
@@ -2144,7 +2233,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
        if test x$enable_threads = xmcf ; then
                tm_file="${tm_file} i386/mingw-mcfgthread.h"
        fi
-       tm_file="${tm_file} i386/mingw32.h"
+       tm_file="${tm_file} mingw/mingw32.h"
        # This makes the logic if mingw's or the w64 feature set has to be used
        case ${target} in
                *-w64-*)
@@ -2173,8 +2262,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
                *)
                        ;;
        esac
-       tm_file="${tm_file} i386/mingw-stdint.h"
-       tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
+       tm_file="${tm_file} mingw/mingw-stdint.h"
+       tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
                                tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -2184,8 +2273,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
                        ;;
        esac
         native_system_header_dir=/mingw/include
-       target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-       extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+       extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
        case ${target} in
                *-w64-*)
                        extra_options="${extra_options} i386/mingw-w64.opt"
@@ -2434,6 +2523,7 @@ riscv*-*-linux*)
        # Force .init_array support.  The configure script cannot always
        # automatically detect that GAS supports it, yet we require it.
        gcc_cv_initfini_array=yes
+       with_tls=${with_tls:-trad}
        ;;
 riscv*-*-elf* | riscv*-*-rtems*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
@@ -2476,13 +2566,17 @@ riscv*-*-freebsd*)
        # Force .init_array support.  The configure script cannot always
        # automatically detect that GAS supports it, yet we require it.
        gcc_cv_initfini_array=yes
+       with_tls=${with_tls:-trad}
        ;;
 
 loongarch*-*-linux*)
        tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}"
-       tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h"
+       case ${target} in
+         *-linux-musl*) tm_file="${tm_file} loongarch/musl.h"
+       esac
+       tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h loongarch/loongarch-driver.h"
        extra_options="${extra_options} linux-android.opt"
-       tmake_file="${tmake_file} loongarch/t-linux"
+       tmake_file="${tmake_file} loongarch/t-multilib loongarch/t-linux"
        gnu_ld=yes
        gas=yes
 
@@ -2493,8 +2587,8 @@ loongarch*-*-linux*)
 
 loongarch*-*-elf*)
        tm_file="elfos.h newlib-stdint.h ${tm_file}"
-       tm_file="${tm_file} loongarch/elf.h loongarch/linux.h"
-       tmake_file="${tmake_file} loongarch/t-linux"
+       tm_file="${tm_file} loongarch/elf.h loongarch/linux.h loongarch/loongarch-driver.h"
+       tmake_file="${tmake_file} loongarch/t-multilib loongarch/t-linux"
        gnu_ld=yes
        gas=yes
 
@@ -2624,22 +2718,22 @@ mips*-sde-elf*)
        esac
        case ${target} in
          mipsisa32r6*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6 MIPS_ABI_DEFAULT=ABI_32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6 MIPS_ABI_DEFAULT=ABI_32"
            ;;
          mipsisa32r2*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2 MIPS_ABI_DEFAULT=ABI_32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2 MIPS_ABI_DEFAULT=ABI_32"
            ;;
          mipsisa32*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32 MIPS_ABI_DEFAULT=ABI_32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32 MIPS_ABI_DEFAULT=ABI_32"
            ;;
          mipsisa64r6*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R6 MIPS_ABI_DEFAULT=ABI_N32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R6 MIPS_ABI_DEFAULT=ABI_N32"
            ;;
          mipsisa64r2*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R2 MIPS_ABI_DEFAULT=ABI_N32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R2 MIPS_ABI_DEFAULT=ABI_N32"
            ;;
          mipsisa64*)
-           tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64 MIPS_ABI_DEFAULT=ABI_N32"
+           tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64 MIPS_ABI_DEFAULT=ABI_N32"
            ;;
        esac
        ;;
@@ -3606,6 +3700,10 @@ if [ "$target_has_targetdm" = "no" ]; then
   d_target_objs="$d_target_objs default-d.o"
 fi
 
+if [ "$target_has_targetrustm" = "no" ]; then
+  rust_target_objs="$rust_target_objs default-rust.o"
+fi
+
 # Support for --with-cpu and related options (and a few unrelated options,
 # too).
 case ${with_cpu} in
@@ -3694,6 +3792,10 @@ case ${target} in
        arch=znver4
        cpu=znver4
        ;;
+      znver5-*)
+       arch=znver5
+       cpu=znver5
+       ;;
       bdver4-*)
         arch=bdver4
         cpu=bdver4
@@ -3750,6 +3852,10 @@ case ${target} in
        arch=lujiazui
        cpu=lujiazui
        ;;
+      yongfeng-*)
+       arch=yongfeng
+       cpu=yongfeng
+       ;;
       pentium2-*)
        arch=pentium2
        cpu=pentium2
@@ -3827,6 +3933,10 @@ case ${target} in
        arch=znver4
        cpu=znver4
        ;;
+      znver5-*)
+       arch=znver5
+       cpu=znver5
+       ;;
       bdver4-*)
         arch=bdver4
         cpu=bdver4
@@ -3863,10 +3973,14 @@ case ${target} in
        arch=k8
        cpu=k8
        ;;
-    lujiazui-*)
+      lujiazui-*)
        arch=lujiazui
        cpu=lujiazui
        ;;
+      yongfeng-*)
+       arch=yongfeng
+       cpu=yongfeng
+       ;;
       nocona-*)
        arch=nocona
        cpu=nocona
@@ -4138,8 +4252,8 @@ case "${target}" in
                fi
                for which in cpu arch tune; do
                        eval "val=\$with_$which"
-                       base_val=`echo $val | sed -e 's/\+.*//'`
-                       ext_val=`echo $val | sed -e 's/[a-z0-9.-]\+//'`
+                       base_val=`echo $val | sed -E -e 's/\+.*//'`
+                       ext_val=`echo $val | sed -E -e 's/[a-z0-9.-]+//'`
 
                        if [ $which = arch ]; then
                          def=aarch64-arches.def
@@ -4171,9 +4285,9 @@ case "${target}" in
 
                          while [ x"$ext_val" != x ]
                          do
-                               ext_val=`echo $ext_val | sed -e 's/\+//'`
-                               ext=`echo $ext_val | sed -e 's/\+.*//'`
-                               base_ext=`echo $ext | sed -e 's/^no//'`
+                               ext_val=`echo $ext_val | sed -E -e 's/\+//'`
+                               ext=`echo $ext_val | sed -E -e 's/\+.*//'`
+                               base_ext=`echo $ext | sed -E -e 's/^no//'`
                                opt_line=`echo -e "$options_parsed" | \
                                        grep "^\"$base_ext\""`
 
@@ -4184,7 +4298,7 @@ case "${target}" in
                                  echo "Unknown extension used in --with-$which=$val" 1>&2
                                  exit 1
                                fi
-                               ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'`
+                               ext_val=`echo $ext_val | sed -E -e 's/[a-z0-9]+//'`
                          done
 
                          true
@@ -4479,7 +4593,7 @@ case "${target}" in
                for which in arch tune; do
                        eval "val=\$with_$which"
                        case ${val} in
-                       "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a)
+                       "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx90c | gfx1030 | gfx1036 | gfx1100 | gfx1103)
                                # OK
                                ;;
                        *)
@@ -4488,7 +4602,19 @@ case "${target}" in
                                ;;
                        esac
                done
-               [ "x$with_arch" = x ] && with_arch=fiji
+               [ "x$with_arch" = x ] && with_arch=gfx900
+
+               case "x${with_multilib_list}" in
+               x | xno)
+                       TM_MULTILIB_CONFIG=
+                       ;;
+               xdefault | xyes)
+                       TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx90c,gfx1030,gfx1036,gfx1100,gfx1103" | sed "s/${with_arch},\?//;s/,$//"`
+                       ;;
+               *)
+                       TM_MULTILIB_CONFIG="${with_multilib_list}"
+                       ;;
+               esac
                ;;
 
        hppa*-*-*)
@@ -4578,7 +4704,7 @@ case "${target}" in
                ;;
 
        riscv*-*-*)
-               supported_defaults="abi arch tune riscv_attribute isa_spec"
+               supported_defaults="abi arch tune riscv_attribute isa_spec tls"
 
                case "${target}" in
                riscv-* | riscv32*) xlen=32 ;;
@@ -4622,7 +4748,7 @@ case "${target}" in
 
                # Infer arch from --with-arch, --target, and --with-abi.
                case "${with_arch}" in
-               rv32e* | rv32i* | rv32g* | rv64i* | rv64g*)
+               rv32e* | rv32i* | rv32g* | rv64e* | rv64i* | rv64g*)
                        # OK.
                        ;;
                "")
@@ -4631,11 +4757,12 @@ case "${target}" in
                        ilp32e) with_arch="rv32e" ;;
                        ilp32 | ilp32f | ilp32d) with_arch="rv32gc" ;;
                        lp64 | lp64f | lp64d) with_arch="rv64gc" ;;
+                       lp64e) with_arch="rv64e" ;;
                        *) with_arch="rv${xlen}gc" ;;
                        esac
                        ;;
                *)
-                       echo "--with-arch=${with_arch} is not supported.  The argument must begin with rv32e, rv32i, rv32g, rv64i, or rv64g." 1>&2
+                       echo "--with-arch=${with_arch} is not supported.  The argument must begin with rv32e, rv32i, rv32g, rv64e, rv64i, or rv64g." 1>&2
                        exit 1
                        ;;
                esac
@@ -4649,7 +4776,7 @@ case "${target}" in
                # pick a default based on the ISA, preferring soft-float
                # unless the D extension is present.
                case "${with_abi}" in
-               ilp32 | ilp32e | ilp32f | ilp32d | lp64 | lp64f | lp64d)
+               ilp32 | ilp32e | ilp32f | ilp32d | lp64 | lp64e | lp64f | lp64d)
                        ;;
                "")
                        case "${with_arch}" in
@@ -4657,6 +4784,7 @@ case "${target}" in
                        rv32e*) with_abi=ilp32e ;;
                        rv32*) with_abi=ilp32 ;;
                        rv64*d* | rv64g*) with_abi=lp64d ;;
+                       rv64e*) with_abi=lp64e ;;
                        rv64*) with_abi=lp64 ;;
                        esac
                        ;;
@@ -4672,7 +4800,7 @@ case "${target}" in
                ilp32,rv32* | ilp32e,rv32e* \
                | ilp32f,rv32*f* | ilp32f,rv32g* \
                | ilp32d,rv32*d* | ilp32d,rv32g* \
-               | lp64,rv64* \
+               | lp64,rv64* | lp64e,rv64e* \
                | lp64f,rv64*f* | lp64f,rv64g* \
                | lp64d,rv64*d* | lp64d,rv64g*)
                        ;;
@@ -4706,6 +4834,17 @@ case "${target}" in
                                ;;
                        esac
                fi
+               # Handle --with-tls.
+               case "$with_tls" in
+               "" \
+               | trad | desc)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2
+                       exit 1
+                       ;;
+               esac
 
                # Handle --with-multilib-list.
                if test "x${with_multilib_list}" != xdefault; then
@@ -4904,7 +5043,7 @@ case "${target}" in
                ;;
 
        loongarch*-*)
-               supported_defaults="abi arch tune fpu simd multilib-default strict-align-lib"
+               supported_defaults="abi arch tune fpu simd multilib-default strict-align-lib tls"
 
                # Local variables
                unset \
@@ -4957,7 +5096,7 @@ case "${target}" in
 
                # Perform initial sanity checks on --with-* options.
                case ${with_arch} in
-               "" | abi-default | loongarch64 | la464) ;; # OK, append here.
+               "" | la64v1.[01] | abi-default | loongarch64 | la[46]64) ;; # OK, append here.
                native)
                        if test x${host} != x${target}; then
                                echo "--with-arch=native is illegal for cross-compiler." 1>&2
@@ -5004,10 +5143,18 @@ case "${target}" in
 
                # Infer ISA-related default options from the ABI: pass 1
                case ${abi_base}/${abi_ext} in
-               lp64*/base)
+               lp64d/base)
                        # architectures that support lp64* ABI
-                       arch_pattern="native|abi-default|loongarch64|la464"
-                       # default architecture for lp64* ABI
+                       arch_pattern="native|abi-default|la64v1.[01]|loongarch64|la[46]64"
+
+                       # default architecture for lp64d ABI
+                       arch_default="la64v1.0"
+                       ;;
+               lp64[fs]/base)
+                       # architectures that support lp64* ABI
+                       arch_pattern="native|abi-default|la64v1.[01]|loongarch64|la[46]64"
+
+                       # default architecture for lp64[fs] ABI
                        arch_default="abi-default"
                        ;;
                *)
@@ -5079,15 +5226,7 @@ case "${target}" in
 
 
                # Check default with_tune configuration using with_arch.
-               case ${with_arch} in
-               loongarch64)
-                       tune_pattern="native|abi-default|loongarch64|la464"
-                       ;;
-               *)
-                       # By default, $with_tune == $with_arch
-                       tune_pattern="*"
-                       ;;
-               esac
+               tune_pattern="native|generic|loongarch64|la[46]64"
 
                case ${with_tune} in
                "") ;; # OK
@@ -5137,7 +5276,7 @@ case "${target}" in
                                        # Fixed: use the default gcc configuration for all multilib
                                        # builds by default.
                                        with_multilib_default="" ;;
-                               arch,native|arch,loongarch64|arch,la464) # OK, append here.
+                               arch,native|arch,la64v1.[01]|arch,loongarch64|arch,la[46]64) # OK, append here.
                                        with_multilib_default="/march=${component}" ;;
                                arch,*)
                                        with_multilib_default="/march=abi-default"
@@ -5162,12 +5301,24 @@ case "${target}" in
                        with_multilib_list="${abi_base}/${abi_ext}"
                fi
 
+               # Handle --with-tls.
+               case "$with_tls" in
+               "" \
+               | trad | desc)
+                   # OK
+                   ;;
+               *)
+                   echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2
+                   exit 1
+                   ;;
+               esac
+
                # Check if the configured default ABI combination is included in
                # ${with_multilib_list}.
                loongarch_multilib_list_sane=no
 
                # This one goes to TM_MULTILIB_CONFIG, for use in t-linux.
-               loongarch_multilib_list_make=""
+               loongarch_multilib_list_make="${abi_base},"
 
                # This one goes to tm_defines, for use in loongarch-driver.c.
                loongarch_multilib_list_c=""
@@ -5189,7 +5340,7 @@ case "${target}" in
                                if test x${parse_state} = x"abi-base"; then
                                        # Base ABI type
                                        case ${component} in
-                                       lp64d | lp64f | lp64s) elem_tmp="ABI_BASE_$(tr a-z A-Z <<< ${component}),";;
+                                       lp64d | lp64f | lp64s) elem_tmp="ABI_BASE_$(echo ${component} | tr a-z A-Z),";;
                                        *)
                                                echo "Unknown base ABI \"${component}\" in --with-multilib-list." 1>&2
                                                exit 1
@@ -5225,7 +5376,7 @@ case "${target}" in
                                if test x${parse_state} = x"arch"; then
                                        # -march option
                                        case ${component} in
-                                       native | abi-default | loongarch64 | la464) # OK, append here.
+                                       native | abi-default | la64v1.[01] | loongarch64 | la[46]64) # OK, append here.
                                                # Append -march spec for each multilib variant.
                                                loongarch_multilib_list_make="${loongarch_multilib_list_make}/march=${component}"
                                                parse_state="opts"
@@ -5798,7 +5949,7 @@ case ${target} in
                # See macro definitions from loongarch-opts.h and loongarch-cpu.h.
 
                # Architecture
-               tm_defines="${tm_defines} DEFAULT_CPU_ARCH=CPU_$(echo ${with_arch} | tr a-z- A-Z_)"
+               tm_defines="${tm_defines} DEFAULT_CPU_ARCH=ARCH_$(echo ${with_arch} | tr a-z.- A-Z__)"
 
                # Base ABI type
                tm_defines="${tm_defines} DEFAULT_ABI_BASE=ABI_BASE_$(echo ${abi_base} | tr a-z- A-Z_)"
@@ -5810,7 +5961,7 @@ case ${target} in
 
                # Microarchitecture
                if test x${with_tune} != x; then
-                 tm_defines="${tm_defines} DEFAULT_CPU_TUNE=CPU_$(echo ${with_tune} | tr a-z- A-Z_)"
+                 tm_defines="${tm_defines} DEFAULT_CPU_TUNE=TUNE_$(echo ${with_tune} | tr a-z.- A-Z__)"
                fi
 
                # FPU adjustment
@@ -5827,6 +5978,11 @@ case ${target} in
                lasx)    tm_defines="$tm_defines DEFAULT_ISA_EXT_SIMD=ISA_EXT_SIMD_LASX" ;;
                esac
 
+               case ${with_tls} in
+               "" | trad)      tm_defines="$tm_defines DEFAULT_TLS_TYPE=TLS_TRADITIONAL" ;;
+               desc)           tm_defines="$tm_defines DEFAULT_TLS_TYPE=TLS_DESCRIPTORS" ;;
+               esac
+
                tmake_file="loongarch/t-loongarch $tmake_file"
                ;;
 
@@ -5890,6 +6046,9 @@ case ${target} in
        visium-*-*)
                target_cpu_default2="TARGET_CPU_$with_cpu"
                ;;
+       x86_64-*-gnu*)
+               tmake_file="$tmake_file i386/t-gnu64"
+               ;;
 esac
 
 t=