This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: TLS support for MIPS


Daniel Jacobowitz wrote:
[snip]
> @@ -237,6 +284,21 @@ struct mips_elf_link_hash_table
>    bfd_boolean mips16_stubs_seen;
>  };
>  
> +#define IS_TLS_RELOC(r_type) \

Other places use _P convention, so TLS_RELOC_P is probably better.

[snip]
> +      if (need_relocs)
> +	{
> +	  memset (rel, 0, sizeof (rel));
> +	  if (ABI_64_P (abfd))
> +	    rel[0].r_info = ELF_R_INFO (abfd, (unsigned long) indx,
> +					R_MIPS_TLS_DTPMOD64);
> +	  else
> +	    rel[0].r_info = ELF_R_INFO (abfd, (unsigned long) indx,
> +					R_MIPS_TLS_DTPMOD32);
> +	  rel[0].r_offset = rel[1].r_offset = rel[2].r_offset
> +	    = sgot->output_offset + sgot->output_section->vma + offset;
> +	  rel[1].r_info = ELF_R_INFO (abfd, 0, R_MIPS_NONE);
> +	  rel[2].r_info = ELF_R_INFO (abfd, 0, R_MIPS_NONE);

Clearing the r_info was already done with memset().

[snip]
> Index: binutils/gas/config/tc-mips.c
> ===================================================================
> --- binutils.orig/gas/config/tc-mips.c	2005-02-01 17:00:04.000000000 -0500
> +++ binutils/gas/config/tc-mips.c	2005-02-07 16:25:18.556720211 -0500
> @@ -1,6 +1,6 @@
>  /* tc-mips.c -- assemble code for a MIPS chip.
>     Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
> -   2003, 2004 Free Software Foundation, Inc.
> +   2003, 2004, 2005 Free Software Foundation, Inc.
>     Contributed by the OSF and Ralph Campbell.
>     Written by Keith Knowles and Ralph Campbell, working independently.
>     Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
> @@ -9819,6 +9819,13 @@ static const struct percent_op_match
>    {"%highest", BFD_RELOC_MIPS_HIGHEST},
>    {"%higher", BFD_RELOC_MIPS_HIGHER},
>    {"%neg", BFD_RELOC_MIPS_SUB},
> +  {"%tlsgd", BFD_RELOC_MIPS_TLS_GD},
> +  {"%tlsldm", BFD_RELOC_MIPS_TLS_LDM},
> +  /* These must always be used with %lo or %hi (for now).  */
> +  {"%dtpoff", BFD_RELOC_MIPS_TLS_LDO_LO16},
> +  {"%tpoff", BFD_RELOC_MIPS_TLS_TPOFF_LO16},
> +  /* This one must be used without %lo or %hi (for now).  */
> +  {"%gottpoff", BFD_RELOC_MIPS_TLS_TPOFF},

As already mentioned, explcit _lo, _hi suffixes are better.

Otherwise, great work! (And a special thanks for adding decent comments
to the multigot handling :-)


Thiemo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]