> On 6 Feb 2019, at 11:45, Segher Boessenkool <seg...@kernel.crashing.org> 
> wrote:
> 
> 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?

I don’t know the answer to this ^ …
… but was attempting a manual audit of other possible places and saw that
rs6000_emit_toc_load_table() for pic code also uses the picbase without
setting  crtl->uses_pic_offset_table.  However, that’s quite late on - and I
wasn’t sure if something should be setting the use in that circumstance
earlier on.

Iain

> 
> 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