From: Mark Mitchell <mark@codesourcery.com>
To: binutils@sourceware.cygnus.com
Subject: PATCH for elf32-mips.c
Date: Sun, 01 Aug 1999 15:48:00 -0000 [thread overview]
Message-ID: <19990801154859T.mitchell@codesourcery.com> (raw)
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;
next reply other threads:[~1999-08-01 15:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-01 15:48 Mark Mitchell [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-06-06 13:45 Patch " H . J . Lu
[not found] <199909251314.GAA16811@crane.prod.itd.earthlink.net>
1999-09-25 9:40 ` patch " Mark Mitchell
1999-09-25 6:14 Felix Lee
1999-09-25 6:14 Felix Lee
1999-08-05 19:46 PATCH " Mark Mitchell
1999-08-07 6:55 ` Koundinya.K
1999-08-07 14:42 ` Ralf Baechle
1999-08-02 23:07 Mark Mitchell
1999-08-03 14:57 ` Ralf Baechle
1999-07-01 0:00 mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19990801154859T.mitchell@codesourcery.com \
--to=mark@codesourcery.com \
--cc=binutils@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).