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: MIPS multigot fixes for Linux


Richard Sandiford <rsandifo@redhat.com> writes:
> Daniel Jacobowitz <drow@mvista.com> writes:
> > 	* elfxx-mips.c (mips_elf_set_global_got_offset): Don't set
> > 	no_fn_stub.
> > 	(mips_elf_set_no_stub): New function.
> > 	(mips_elf_multi_got): Call it.
> > 	(_bfd_mips_elf_finish_dynamic_symbol): Fill relocated GOT entries
> > 	with zero for ! SGI_COMPAT.  Simplify calculation of value.
> 
> Looks good to me FWIW.

Just thinking... maybe the _bfd_mips_elf_finish_dynamic_symbol code
could look like this?  Then we wouldn't have any pesky SGI_COMPAT tests.
Haven't tested this at all though.

Richard


Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.81
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.81 elfxx-mips.c
*** bfd/elfxx-mips.c	11 Nov 2003 13:32:38 -0000	1.81
--- bfd/elfxx-mips.c	13 Nov 2003 09:50:03 -0000
*************** _bfd_mips_elf_finish_dynamic_symbol (out
*** 6660,6669 ****
    if (g->next && h->dynindx != -1)
      {
        struct mips_got_entry e, *p;
        bfd_vma offset;
-       bfd_vma value;
        Elf_Internal_Rela rel[3];
-       bfd_vma addend = 0;
  
        gg = g;
  
--- 6685,6693 ----
    if (g->next && h->dynindx != -1)
      {
        struct mips_got_entry e, *p;
+       bfd_vma entry;
        bfd_vma offset;
        Elf_Internal_Rela rel[3];
  
        gg = g;
  
*************** _bfd_mips_elf_finish_dynamic_symbol (out
*** 6671,6685 ****
        e.symndx = -1;
        e.d.h = (struct mips_elf_link_hash_entry *)h;
  
-       if (info->shared
- 	  || h->root.type == bfd_link_hash_undefined
- 	  || h->root.type == bfd_link_hash_undefweak)
- 	value = 0;
-       else if (sym->st_value)
- 	value = sym->st_value;
-       else
- 	value = h->root.u.def.value;
- 
        memset (rel, 0, sizeof (rel));
        rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_REL32);
  
--- 6695,6700 ----
*************** _bfd_mips_elf_finish_dynamic_symbol (out
*** 6692,6711 ****
  	      offset = p->gotidx;
  	      rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
  
! 	      MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
! 
! 	      if ((info->shared
! 		   || (elf_hash_table (info)->dynamic_sections_created
! 		       && p->d.h != NULL
! 		       && ((p->d.h->root.elf_link_hash_flags
! 			    & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
! 		       && ((p->d.h->root.elf_link_hash_flags
! 			    & ELF_LINK_HASH_DEF_REGULAR) == 0)))
! 		  && ! (mips_elf_create_dynamic_relocation
! 			(output_bfd, info, rel,
! 			 e.d.h, NULL, value, &addend, sgot)))
! 		return FALSE;
! 	      BFD_ASSERT (addend == 0);
  	    }
  	}
      }
--- 6707,6729 ----
  	      offset = p->gotidx;
  	      rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
  
! 	      if (info->shared
! 		  || (elf_hash_table (info)->dynamic_sections_created
! 		      && p->d.h != NULL
! 		      && ((p->d.h->root.elf_link_hash_flags
! 			   & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
! 		      && ((p->d.h->root.elf_link_hash_flags
! 			   & ELF_LINK_HASH_DEF_REGULAR) == 0)))
! 		{
! 		  entry = 0;
! 		  if (! (mips_elf_create_dynamic_relocation
! 			 (output_bfd, info, rel,
! 			  e.d.h, NULL, sym->st_value, &entry, sgot)))
! 		    return FALSE;
! 		}
! 	      else
! 		entry = sym->st_value;
! 	      MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset);
  	    }
  	}
      }


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