]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: wire up --with-tls to control -mtls-dialect= default master trunk
authorSam James <sam@gentoo.org>
Fri, 22 Aug 2025 23:54:01 +0000 (00:54 +0100)
committerSam James <sam@gentoo.org>
Sat, 23 Aug 2025 10:13:50 +0000 (11:13 +0100)
Allow passing --with-tls= at configure-time to control the default value
of -mtls-dialect= for i386 and x86_64. The default itself (gnu) is not changed
unless --with-tls= is passed.

--with-tls= is already wired up for ARM and RISC-V.

gcc/ChangeLog:
PR target/120933

* config.gcc (supported_defaults): Add tls for i386, x86_64.
* config/i386/i386.h (host_detect_local_cpu): Add tls.
* doc/install.texi: Document --with-tls= for i386, x86_64.

gcc/config.gcc
gcc/config/i386/i386.h
gcc/doc/install.texi

index db813a7b561c4576b4a2f1b23e071514986bd9ad..04e88cce00d50cad49a9865970e2ac5425e9c970 100644 (file)
@@ -4658,7 +4658,7 @@ case "${target}" in
                ;;
 
        i[34567]86-*-* | x86_64-*-*)
                ;;
 
        i[34567]86-*-* | x86_64-*-*)
-               supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
+               supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64 tls"
                for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
                        eval "val=\$with_$which"
                        case " $x86_archs " in
                for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
                        eval "val=\$with_$which"
                        case " $x86_archs " in
@@ -4717,6 +4717,17 @@ case "${target}" in
                                ;;
                        esac
                done
                                ;;
                        esac
                done
+
+               # Handle --with-tls.
+               case "$with_tls" in
+               ""|gnu|gnu2)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2
+                       exit 1
+                       ;;
+               esac
                ;;
 
        riscv*-*-*)
                ;;
 
        riscv*-*-*)
index 2fbc1f6e98268c2fd9508edf7c3ecc7b154541b8..2d53db683176266cd9905a04b61e0204e6172183 100644 (file)
@@ -644,7 +644,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
   {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
   {"arch", "%{!march=*:-march=%(VALUE)}"},                        \
   {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"},           \
   {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
   {"arch", "%{!march=*:-march=%(VALUE)}"},                        \
   {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"},           \
-  {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"},
+  {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"},    \
+  {"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"},
 
 /* Specs for the compiler proper */
 
 
 /* Specs for the compiler proper */
 
index 74232247d8b7522ed709395bf1170818bfd26e50..6913035b5966a3569021df9ed6ed67bcff9efb08 100644 (file)
@@ -1254,6 +1254,9 @@ descriptor-based dialect.
 For RISC-V targets, possible values for @var{dialect} are @code{trad} or
 @code{desc}, which select between the traditional GNU dialect and the GNU TLS
 descriptor-based dialect.
 For RISC-V targets, possible values for @var{dialect} are @code{trad} or
 @code{desc}, which select between the traditional GNU dialect and the GNU TLS
 descriptor-based dialect.
+For i386, x86-64 targets, possible values for @var{dialect} are @code{gnu} or
+@code{gnu2}, which select between the original GNU dialect and the GNU TLS
+descriptor-based dialect.
 
 @item --enable-multiarch
 Specify whether to enable or disable multiarch support.  The default is
 
 @item --enable-multiarch
 Specify whether to enable or disable multiarch support.  The default is