[patch] TLS support for hppa-linux

Richard Henderson rth@redhat.com
Wed Jun 29 18:03:00 GMT 2005


On Wed, Jun 29, 2005 at 06:54:25AM -0700, Randolph Chung wrote:
> +hppa_tls_call (rtx arg)
> +{
> +  rtx ret, r26, r28;
> +
> +  r26 = gen_rtx_REG (Pmode, 26);
> +  r28 = gen_rtx_REG (Pmode, 28);
> +  ret = gen_reg_rtx (Pmode);
> +
> +  emit_move_insn (r26, arg);
> +  emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
> +		  	   LCT_CONST, Pmode, 1, r26, Pmode);
> +  emit_move_insn (ret, r28);

This seems very wrong.  Either r26 and r28 are part of the normal
function call sequence and you don't have to create hard registers
here yourself, or using emit_library_call_value is wrong because
it'll force the values into incorrect registers.

> +	emit_libcall_block (insn, ret, r28, addr);

emit_libcall_block should be redundant with the block emitted by
emit_library_call_value.

> +/* Non-TLS symbolic references.  */
> +#define PA_SYMBOL_REF_TLS_P(RTX) \
> +  (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0)

Either in legitimize address or in your move expanders, you must
handle (const (plus (symbol_ref "tlssym") (const_int))).  There 
should be an existing test for this.



r~



More information about the Gcc-patches mailing list