This is the mail archive of the binutils@sourceware.org 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: Relocations against STN_UNDEF


On Fri, Sep 24, 2010 at 11:45:42AM +0200, Thomas Schwinge wrote:
> 	* elflink.c (bfd_elf_reloc_symbol_deleted_p): Compare the symbol index
> 	to STN_UNDEF, not SHN_UNDEF.

OK.

The other changelog is probably best written as

	* elf32-arm.c, * elf32-cris.c, * elf32-hppa.c, * elf32-i370.c,
	* elf32-m32r.c, * elf32-m68k.c, * elf32-microblaze.c, * elf32-ppc.c,
	* elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-vax.c,
	* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-mips.c,
	* elf64-ppc.c, * elf64-sparc.c, * elfcode.h, * elflink.c,
	* elfxx-ia64.c, * elfxx-mips.c: Use STN_UNDEF when referring to the
	zero symbol index.


> -		      for (r_symndx = 0;
> +		      for (r_symndx = STN_UNDEF;
>  			   r_symndx < symtab_hdr->sh_info;
>  			   r_symndx++)

Please leave this, and the other 3 instances like it in elf32-ppc.c and
elf64-ppc.c as zeros.

I think it's also best to leave the struct mips_got_entry symndx
valuse as zeros here and in later comparisons, because the comparisons
probably ought to be "!= -1" rather than ">= 0".  Similaryly
mips16_stub_symndx is using 0 as an error return so I think that
should be left alone too.

So of the elfxx-mipx.c changes I'll OK the following.  The rest you'll
need to argue with a mips maintainer if you want to push your patch.  ;-)

> @@ -5282,7 +5284,7 @@ mips_elf_calculate_relocation (bfd *abfd
>  	       && h->root.def_dynamic
>  	       && !h->root.def_regular
>  	       && !h->has_static_relocs))
> -	  && r_symndx != 0
> +	  && r_symndx != STN_UNDEF
>  	  && (h == NULL
>  	      || h->root.root.type != bfd_link_hash_undefweak
>  	      || ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)

> @@ -7752,7 +7754,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s
>  	case R_MIPS_TLS_LDM:
>  	  if (r_type == R_MIPS_TLS_LDM)
>  	    {
> -	      r_symndx = 0;
> +	      r_symndx = STN_UNDEF;
>  	      h = NULL;
>  	    }
>  	  /* Fall through */
> @@ -7778,7 +7780,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s
>  	      }
>  	    else
>  	      {
> -		BFD_ASSERT (flag == GOT_TLS_LDM || r_symndx != 0);
> +		BFD_ASSERT (flag == GOT_TLS_LDM || r_symndx != STN_UNDEF);
>  
>  		if (!mips_elf_record_local_got_symbol (abfd, r_symndx,
>  						       rel->r_addend,
> @@ -7918,7 +7920,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s
>  	    case R_MIPS_HIGHEST:
>  	      /* Don't refuse a high part relocation if it's against
>  		 no symbol (e.g. part of a compound relocation).  */
> -	      if (r_symndx == 0)
> +	      if (r_symndx == STN_UNDEF)
>  		break;
>  
>  	      /* R_MIPS_HI16 against _gp_disp is used for $gp setup,

-- 
Alan Modra
Australia Development Lab, IBM


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