[PATCH] x86: Add tls check in gas

Cui, Lili lili.cui@intel.com
Thu Sep 5 00:40:01 GMT 2024


> On Wed, Sep 4, 2024 at 12:46 AM Cui, Lili <lili.cui@intel.com> wrote:
> >
> > > > static bool
> > > > x86_check_tls_relocation (unsigned int r_type)
> > > >
> > > > > > +{
> > > > > > +  switch (r_type)
> > > > > > +    {
> > > > > > +    case BFD_RELOC_386_TLS_GOTDESC:
> > > > > > +      /* Check transition from GDesc access model:
> > > > > > +    leal x@tlsdesc(%ebx), %eax
> > > > > > +    call *x@tlsdesc(%eax)
> > > > > > +       */
> > > > > > +      if (i.tm.mnem_off == MN_call)
> > > > > > +   return true;
> > > > >
> > > > > There are two forms of CALL - I doubt both are allowed.
> >
> > H.J, I am confused about "call *x@tlsdesc(%eax)", I don’t know how to
> handle it in the current patch.
> >
> > For current gas, we bind it with BFD_RELOC_386_TLS_GOTDESC/
> BFD_RELOC_X86_64_GOTPC32_TLSDESC. I also see it in the abi
> documentation.
> > But for the linker, R_386_TLS_GOTDESC/ R_X86_64_GOTPC32_TLSDESC only
> allow lea. It seems that the linker does not support "call *x@tlsdesc(%eax)".
> 
> See:
> 
> https://sourceware.org/git/?p=binutils-
> gdb.git;a=commit;h=5a655b5291b3f56088409d34e9077e98af63de60
> 

Ok, I will also remove "call *x@tlsdesc(%eax)" from my patch. Thanks.

Lili.




More information about the Binutils mailing list