PATCH for elf32-mips.c
Mark Mitchell
mark@codesourcery.com
Sun Aug 1 15:48:00 GMT 1999
This simple patch fixes the case where no global GOT entries are
required. We were tripping over a NULL pointer in that case.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-08-01 Mark Mitchell <mark@codesourcery.com>
* elf32-mips.c (_bfd_mips_elf_final_link): Handle the case where
there are no global symbols requiring GOT entries.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Likewise.
Index: elf32-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v
retrieving revision 1.37
diff -c -p -r1.37 elf32-mips.c
*** elf32-mips.c 1999/08/01 20:58:19 1.37
--- elf32-mips.c 1999/08/01 22:44:26
*************** _bfd_mips_elf_final_link (abfd, info)
*** 4363,4371 ****
got = bfd_get_section_by_name (dynobj, ".got");
g = (struct mips_got_info *) elf_section_data (got)->tdata;
! BFD_ASSERT ((elf_hash_table (info)->dynsymcount
! - g->global_gotsym->dynindx)
! <= g->global_gotno);
}
/* On IRIX5, we omit the .options section. On IRIX6, however, we
--- 4363,4372 ----
got = bfd_get_section_by_name (dynobj, ".got");
g = (struct mips_got_info *) elf_section_data (got)->tdata;
! if (g->global_gotsym != NULL)
! BFD_ASSERT ((elf_hash_table (info)->dynsymcount
! - g->global_gotsym->dynindx)
! <= g->global_gotno);
}
/* On IRIX5, we omit the .options section. On IRIX6, however, we
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 7773,7779 ****
bfd *dynobj;
asection *s;
boolean reltext;
! struct mips_got_info *g;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
--- 7774,7780 ----
bfd *dynobj;
asection *s;
boolean reltext;
! struct mips_got_info *g = NULL;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 7896,7902 ****
if (!mips_elf_sort_hash_table (info, 1))
return false;
! i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
g->global_gotno = i;
s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj);
}
--- 7897,7908 ----
if (!mips_elf_sort_hash_table (info, 1))
return false;
! if (g->global_gotsym != NULL)
! i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
! else
! /* If there are no global symbols, or none requiring
! relocations, then GLOBAL_GOTSYM will be NULL. */
! i = 0;
g->global_gotno = i;
s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj);
}
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 8038,8044 ****
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
return false;
! if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
return false;
if (IRIX_COMPAT (dynobj) == ict_irix5
--- 8044,8051 ----
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
return false;
! if (g != NULL && g->global_gotsym != NULL
! && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
return false;
if (IRIX_COMPAT (dynobj) == ict_irix5
*************** _bfd_mips_elf_finish_dynamic_symbol (out
*** 8186,8192 ****
/* Run through the global symbol table, creating GOT entries for all
the symbols that need them. */
! if (h->dynindx >= g->global_gotsym->dynindx)
{
bfd_vma offset;
bfd_vma value;
--- 8193,8200 ----
/* Run through the global symbol table, creating GOT entries for all
the symbols that need them. */
! if (g->global_gotsym != NULL
! && h->dynindx >= g->global_gotsym->dynindx)
{
bfd_vma offset;
bfd_vma value;
More information about the Binutils
mailing list