On Sat, Aug 23, 2025 at 2:42 AM Sam James <s...@gentoo.org> wrote:
>
> 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.

OK.

Thanks,
Uros.

> ---
> Bootstrapped on x86_64-pc-linux-gnu. Testing in progress there and on
> i686-pc-linux-gnu. OK?
>
>  gcc/config.gcc         | 13 ++++++++++++-
>  gcc/config/i386/i386.h |  3 ++-
>  gcc/doc/install.texi   |  3 +++
>  3 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index db813a7b561c..04e88cce00d5 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 2fbc1f6e9826..2d53db683176 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 74232247d8b7..6913035b5966 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
> --
> 2.51.0
>

Reply via email to