This is the mail archive of the binutils@sourceware.cygnus.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]

Re: Reloc changes to bfd/elf32-mips.c



I'm confused on a couple of points.

  @@ -6557,6 +6556,7 @@ _bfd_mips_elf_relocate_section (output_b
	 int r_type = ELF32_R_TYPE (rel->r_info);

	 /* Find the relocation howto for this relocation.  */
  +#ifndef BFD64
	 if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
	  /* Some 32-bit code uses R_MIPS_64.  In particular, people use
	     64-bit code, but make sure all their addresses are in the 
  @@ -6566,6 +6566,7 @@ _bfd_mips_elf_relocate_section (output_b
	     stored value is sign-extended to 64 bits.  */
	  howto = elf_mips_howto_table + R_MIPS_32;
	 else
  +#endif
	  howto = mips_rtype_to_howto (r_type);

That's fine by me, in that I never understood exactly what was going
on there.  But, I don't think it's right.  The idea here is that
32-bit object code can still use R_MIPS_64, according to Ian.  So, I
don't think BFD64 (which says something about how many bits you have
when you're compiling BFD) is the right thing.

  @@ -6628,26 +6629,11 @@ _bfd_mips_elf_relocate_section (output_b
		    l &= lo16_howto->src_mask;
		    l = mips_elf_sign_extend (l, 16);

  -		  /* Save the high-order bit for later.  When we
  -		     encounter the R_MIPS_LO16 relocation we will need
  -		     them again.  */
		    addend <<= 16;
  -		  last_hi16_addend = addend;
  -		  last_hi16_addend_valid_p = true;

		    /* Compute the combined addend.  */
		    addend += l;
		  }
  -	      else if (r_type == R_MIPS_LO16) 
  -		{
  -		  /* Used the saved HI16 addend.  */
  -		  if (!last_hi16_addend_valid_p)
  -		    {
  -		      bfd_set_error (bfd_error_bad_value);
  -		      return false;
  -		    }
  -		  addend |= last_hi16_addend;
  -		}
		else if (r_type == R_MIPS16_GPREL)
		  {
		    /* The addend is scrambled in the object file.  See

Why is all this code going away?  This looks like it will make
R_MIPS_LO16 not work in .rel sections.  The addend for the LO16
relocation is the combination of bits in the HI16 and LO16 relocs, I
think.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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