[PATCH] x86: Add tls check in gas

Cui, Lili lili.cui@intel.com
Wed Aug 28 08:19:26 GMT 2024



> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Wednesday, August 28, 2024 3:44 PM
> To: Cui, Lili <lili.cui@intel.com>
> Cc: hjl.tools@gmail.com; binutils@sourceware.org
> Subject: Re: [PATCH] x86: Add tls check in gas
> 
> On 28.08.2024 08:56, Cui, Lili wrote:
> >> On 27.08.2024 08:07, Cui, Lili wrote:
> >>> @@ -6567,6 +6675,18 @@ i386_assemble (char *line)
> >>>  	i.prefix[LOCK_PREFIX] = 0;
> >>>      }
> >>>
> >>> +  if (tls_check)
> >>> +    {
> >>> +      for (j = i.imm_operands; j < i.operands; ++j)
> >>> +	if (!x86_check_tls_relocation (i.reloc[j]))
> >>> +	  {
> >>> +	    as_bad (_("`%s' relocation cannot be used with `%s'"),
> >>> +		    bfd_reloc_code_real_names[i.reloc[j]],
> >>> +		    insn_name (&i.tm));
> >>> +	    return;
> >>> +	  }
> >>> +    }
> >>
> >> Why do you skip immediate operands, which also may have relocations?
> >
> > I think immediate ​​is constant value ​​in instruction, it doesn't involve
> relocation process.
> 
> "Constant" is from a runtime perspective, i.e. after relocation. The simplest
> example is
> 
> 	mov	$sym, %eax
> 
> where a relocation will be produced.
> 

You are right, I also found it in abi doc and linker test: 

addq    $sh2@tpoff+1, %rdx
add      $foo@tpoff, %reg

I will let it start from the first operand.

Thanks,
Lili.

> Jan


More information about the Binutils mailing list