[RFC] powerpc: restore TOC when static longjmp to shared object

Rogerio Alves rcardoso@linux.vnet.ibm.com
Tue May 15 19:15:00 GMT 2018



Em 15-05-2018 15:50, Florian Weimer escreveu:
> * Rogerio Alves:
> 
>> One simple solution would be always restore the TOC pointer by uncomment
>> the line bellow:
>>
>> /*     std r2,FRAME_TOC_SAVE(r1)       Restore the TOC save area.  */
>>
>> Or maybe we can check if we have a valid TOC pointer before restore it,
>> instead #if defined SHARED.
> 
> Is the register reserved for the TOC pointer in static builds, too?
> Then I suggest to unconditionally save nad restore it; not doing so
> looks like a pointless micro-optimization.
> 

Yes. And, I agree with you: it's kinda pointless micro-optimization.

> Another problem with sharing jump buffers across static dlopen is that
> you might not have identical pointer guard values.
> 
>> I would like to request for comments on this matter: Should we fix/work
>> this? Is feasible to change longjmp to always restore TOC pointer?
> 
> Does setjmp already save it unonditionally?

Yes it saves. But the only difference it retrieves from the caller when 
shared:

#if defined SHARED && !IS_IN (rtld) 

     ld   r5,FRAME_TOC_SAVE(r1)  /* Retrieve the callers TOC.  */ 

     std  r5,(JB_GPR2*8)(3) 

#else 

     std  r2,(JB_GPR2*8)(3)

> 
> Removal of static dlopen is still some time away; it's likely not
> going to happen in this cycle, and the fix looks simple enough.
> 

Yes. In fact I am already working on a patch here just in case.

Thank you

Regards



More information about the Libc-alpha mailing list