summaryrefslogtreecommitdiffstats
path: root/bfd/elfxx-mips.c
diff options
context:
space:
mode:
authorThiemo Seufer <ths@networkno.de>2002-08-09 05:35:26 +0000
committerThiemo Seufer <ths@networkno.de>2002-08-09 05:35:26 +0000
commitd0c7ff072cbb13d2227bb757a2ff60eda4ef1f31 (patch)
treec1a5dc59aa5d0a8a2385b47082f59cbcc6535df0 /bfd/elfxx-mips.c
parentea591d42c4ce7267819a0c9e33efbe4526ab3398 (diff)
downloadppe42-binutils-d0c7ff072cbb13d2227bb757a2ff60eda4ef1f31.tar.gz
ppe42-binutils-d0c7ff072cbb13d2227bb757a2ff60eda4ef1f31.zip
* elfxx-mips.c (mips_elf_global_got_index): Avoid segfault if
g->global_gotsym is NULL.
Diffstat (limited to 'bfd/elfxx-mips.c')
-rw-r--r--bfd/elfxx-mips.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 41bd5b702c..df035315d3 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1446,15 +1446,18 @@ mips_elf_global_got_index (abfd, h)
bfd_vma index;
asection *sgot;
struct mips_got_info *g;
+ long global_got_dynindx = 0;
g = mips_elf_got_info (abfd, &sgot);
+ if (g->global_gotsym != NULL)
+ global_got_dynindx = g->global_gotsym->dynindx;
/* Once we determine the global GOT entry with the lowest dynamic
symbol table index, we must put all dynamic symbols with greater
indices into the GOT. That makes it easy to calculate the GOT
offset. */
- BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
- index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
+ BFD_ASSERT (h->dynindx >= global_got_dynindx);
+ index = ((h->dynindx - global_got_dynindx + g->local_gotno)
* MIPS_ELF_GOT_SIZE (abfd));
BFD_ASSERT (index < sgot->_raw_size);
OpenPOWER on IntegriCloud