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]

PATCH for elf/mips



This patch (checked in) fixes a buglet in Richard's recent
section-symbol changes, and also fixes a couple of minor issues
revealed by the test-suite.  Only one failure remains; it will be
fixed next.

--

Thu Jul 15 17:55:31 1999  Mark P. Mitchell  <mark@codesourcery.com>

	* elf32-mips.c (_bfd_mips_elf_modify_segment_map): Don't require
	a PT_PHDR program headers.
	(_bfd_mips_elf_final_link): Don't assume there are going to be
	section symbols when we're not building a shared object.
	(_bfd_mips_elf_check_relocs): Make sure we have a GOT when
	we need one.

Index: elf32-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v
retrieving revision 1.25
diff -c -p -r1.25 elf32-mips.c
*** elf32-mips.c	1999/07/14 14:23:13	1.25
--- elf32-mips.c	1999/07/15 23:54:57
*************** _bfd_mips_elf_modify_segment_map (abfd)
*** 3242,3264 ****
  	{
  	  struct elf_segment_map *options_segment;
  
! 	  for (m = elf_tdata (abfd)->segment_map; m; m = m->next)
! 	    if (m->p_type == PT_PHDR)
  	      break;
  
- 	  /* There should always be a program header table.  */
- 	  if (m == NULL)
- 	    return false;
- 
  	  options_segment = bfd_zalloc (abfd, 
  					sizeof (struct elf_segment_map));
! 	  options_segment->next = m->next;
  	  options_segment->p_type = PT_MIPS_OPTIONS;
  	  options_segment->p_flags = PF_R;
  	  options_segment->p_flags_valid = true;
  	  options_segment->count = 1;
  	  options_segment->sections[0] = s;
! 	  m->next = options_segment;
  	}
      }
    else
--- 3242,3266 ----
  	{
  	  struct elf_segment_map *options_segment;
  
! 	  /* Usually, there's a program header table.  But, sometimes
! 	     there's not (like when running the `ld' testsuite).  So,
! 	     if there's no program header table, we just put the
! 	     options segement at the end.  */
! 	  for (pm = &elf_tdata (abfd)->segment_map; 
! 	       *pm != NULL;
! 	       pm = &(*pm)->next)
! 	    if ((*pm)->p_type == PT_PHDR)
  	      break;
  
  	  options_segment = bfd_zalloc (abfd, 
  					sizeof (struct elf_segment_map));
! 	  options_segment->next = *pm;
  	  options_segment->p_type = PT_MIPS_OPTIONS;
  	  options_segment->p_flags = PF_R;
  	  options_segment->p_flags_valid = true;
  	  options_segment->count = 1;
  	  options_segment->sections[0] = s;
! 	  *pm = options_segment;
  	}
      }
    else
*************** _bfd_mips_elf_final_link (abfd, info)
*** 4323,4336 ****
       generic size_dynamic_sections renumbered them out from under us.
       Rather than trying somehow to prevent the renumbering, just do
       the sort again.  */
- 
    if (elf_hash_table (info)->dynobj)
      {
        bfd *dynobj;
        asection *got;
        struct mips_got_info *g;
  
!       if (!mips_elf_sort_hash_table (info, bfd_count_sections (abfd) + 1))
          return false;
  
        /* Make sure we didn't grow the global .got region.  */
--- 4325,4345 ----
       generic size_dynamic_sections renumbered them out from under us.
       Rather than trying somehow to prevent the renumbering, just do
       the sort again.  */
    if (elf_hash_table (info)->dynobj)
      {
        bfd *dynobj;
        asection *got;
        struct mips_got_info *g;
  
!       /* When we resort, we must tell mips_elf_sort_hash_table what
! 	 the lowest index it may use is.  That's the number of section
! 	 symbols we're going to add.  The generic ELF linker only
! 	 adds these symbols when building a shared object.  Note that
! 	 we count the sections after (possibly) removing the .options
! 	 section above.  */
!       if (!mips_elf_sort_hash_table (info, (info->shared 
! 					    ? bfd_count_sections (abfd) + 1
! 					    : 1)))
          return false;
  
        /* Make sure we didn't grow the global .got region.  */
*************** mips_elf_next_lo16_addend (relocation, r
*** 5528,5534 ****
       immediately following.  However, for the IRIX6 ABI, the next
       relocation may be a composed relocation consisting of several
       relocations for the same address.  In that case, the R_MIPS_LO16
!      relo!scation may occur as one of these.  We permit a similar
       extension in general, as that is useful for GCC.  */
    while (relocation < relend)
      {
--- 5537,5543 ----
       immediately following.  However, for the IRIX6 ABI, the next
       relocation may be a composed relocation consisting of several
       relocations for the same address.  In that case, the R_MIPS_LO16
!      relocation may occur as one of these.  We permit a similar
       extension in general, as that is useful for GCC.  */
    while (relocation < relend)
      {
*************** _bfd_mips_elf_check_relocs (abfd, info, 
*** 7056,7061 ****
--- 7065,7073 ----
  	    case R_MIPS_CALL_LO16:
  	    case R_MIPS_GOT_HI16:
  	    case R_MIPS_GOT_LO16:
+ 	    case R_MIPS_GOT_PAGE:
+ 	    case R_MIPS_GOT_OFST:
+ 	    case R_MIPS_GOT_DISP:
  	      if (dynobj == NULL)
  		elf_hash_table (info)->dynobj = dynobj = abfd;
  	      if (! mips_elf_create_got_section (dynobj, info))

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