On Wed, Feb 06, 2019 at 04:43:18PM +1030, Alan Modra wrote:
> Segher, you'll recognize these as your patches from pr88343.  All I've
> done here is give you a testcase for the legitimize_tls_address change
> (which you said you had no idea what the patch was for!)

I don't see a testcase, and the rs6000_legitimize_tls_address part is new
to me.  Oh you mean the stuff in the commit message below here :-)

I'll make real testcases from that, let's see if things are fixed.  Do you
know if it helps the glibs libm stuff?

Another question below:

> ----
> Fixes lack of r30 save/restore on powerpc-linux.
> 
> // -m32 -fpic -ftls-model=initial-exec
> __thread char* p;
> char** f1 (void) { return &p; }
> 
> and
> 
> // -m32 -fpic -msecure-plt
> extern int foo (int);
> int f1 (int x) { return foo (x); }
> 
>       PR target/88343
>       * config/rs6000/rs6000.c (rs6000_legitimize_tls_address),
>       (rs6000_call_sysv): Set uses_pic_offset_table.
> 
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 883361cabbe..ab01dee9b68 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -8705,7 +8705,10 @@ rs6000_legitimize_tls_address (rtx addr, enum 
> tls_model model)
>        else
>       {
>         if (flag_pic == 1)
> -         got = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
> +         {
> +           crtl->uses_pic_offset_table = 1;
> +           got = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);

This is the same as just

  got = pic_offset_table_rtx;

or am I missing something?

> +         }
>         else
>           {
>             rtx gsym = rs6000_got_sym ();
> @@ -38068,7 +38071,10 @@ rs6000_call_sysv (rtx value, rtx func_desc, rtx 
> tlsarg, rtx cookie)
>        && (!SYMBOL_REF_LOCAL_P (func_addr)
>         || SYMBOL_REF_EXTERNAL_P (func_addr)
>         || SYMBOL_REF_WEAK (func_addr)))
> -    call[n++] = gen_rtx_USE (VOIDmode, pic_offset_table_rtx);
> +    {
> +      crtl->uses_pic_offset_table = 1;
> +      call[n++] = gen_rtx_USE (VOIDmode, pic_offset_table_rtx);
> +    }
>  
>    call[n++] = gen_hard_reg_clobber (Pmode, LR_REGNO);
>  


Segher

Reply via email to