From: Sam James Date: Fri, 22 Aug 2025 23:54:01 +0000 (+0100) Subject: i386: wire up --with-tls to control -mtls-dialect= default X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;ds=inline;p=thirdparty%2Fgcc.git i386: wire up --with-tls to control -mtls-dialect= default 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. --- diff --git a/gcc/config.gcc b/gcc/config.gcc index db813a7b561..04e88cce00d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4658,7 +4658,7 @@ case "${target}" in ;; 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 @@ -4717,6 +4717,17 @@ case "${target}" in ;; 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*-*-*) diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 2fbc1f6e982..2d53db68317 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -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)}}"}, \ - {"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 */ diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 74232247d8b..6913035b596 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -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 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