Hi Julian,

On Fri, 2025-05-02 09:59:13 +0000, Julian Waters <tanksherma...@gmail.com> 
wrote:
> After a long hiatus, I've returned to address review comments on the
> Windows TLS patch. Attached here is the final patch from this
> effort. Ok for merge? Will need help from Windows maintainers to
> commit once this is approved.
[...]
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 2f840338138..2b40a203a61 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
[...]
> @@ -12363,6 +12390,26 @@ legitimize_tls_address (rtx x, enum tls_model model, 
> bool for_mov)
>    machine_mode tp_mode = Pmode;
>    int type;
>  
> +#if TARGET_WIN32_TLS
> +  off = gen_const_mem (SImode, ix86_tls_index ());
> +  set_mem_alias_set (off, GOT_ALIAS_SET);
> +
> +  tp = gen_const_mem (Pmode, GEN_INT (TARGET_64BIT ? 88 : 44));
> +  set_mem_addr_space (tp, DEFAULT_TLS_SEG_REG);
> +
> +  if (TARGET_64BIT)
> +    off = convert_to_mode (Pmode, off, 1);
> +
> +  base = force_reg (Pmode, off);
> +  tp = copy_to_mode_reg (Pmode, tp);
> +
> +  tp = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, tp, gen_rtx_MULT (Pmode, 
> base, GEN_INT (UNITS_PER_WORD))));
> +  set_mem_alias_set (tp, GOT_ALIAS_SET);
> +
> +  base = force_reg (Pmode, tp);
> +
> +  return gen_rtx_PLUS (Pmode, base, gen_rtx_CONST (Pmode, gen_rtx_UNSPEC 
> (SImode, gen_rtvec (1, x), UNSPEC_SECREL32)));
> +#else
>    /* Fall back to global dynamic model if tool chain cannot support local
>       dynamic.  */
>    if (TARGET_SUN_TLS && !TARGET_64BIT

With automated builds (configured with --enable-languages=all
--enable-languages=c,c++ --disable-gcov --disable-shared
--disable-threads --target=i686-mingw32crt --without-headers), I see
new warnings about unused parameters (`model` and `for_mov`) and
variables (`dest`, `pic`, `tp_mode` and `type`), which are all only
used in the #else part. That would be nice to cover (which would again
allow to configure with --enable-werror-always .)

Thanks,
  Jan-Benedict

-- 

Attachment: signature.asc
Description: PGP signature

Reply via email to