summaryrefslogtreecommitdiff
path: root/bfd/elf32-s390.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-07-28 17:59:25 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-07-28 18:26:25 +0200
commit79c12faeea57e61364b6a7a3e411b096edce989c (patch)
tree66333b8892e6dccfd68a4f07953242e6c5183da1 /bfd/elf32-s390.c
parent2b94abd48aef2d91bae1c35c8c10ebfb8757247d (diff)
downloadbinutils-gdb-79c12faeea57e61364b6a7a3e411b096edce989c.tar.gz
S/390: Fix segfault when linking -shared -nostartfiles
Regression-tested on s390x. bfd/ChangeLog: 2017-07-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL pointer check for htab->elf.irelplt. * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r--bfd/elf32-s390.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index ddbeb97dfcd..95682b659eb 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3941,7 +3941,9 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->elf.srelplt->size + htab->elf.irelplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
+ if (htab->elf.irelplt)
+ dyn.d_un.d_val += htab->elf.irelplt->size;
break;
}