aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-s390.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-06-26 11:01:58 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-06-26 11:01:58 +0200
commit93ec5e23766a9f75aa4950748cf73964028a8d1b (patch)
treeba6f4eb23fceddf57b6018ea37d8c2e4e538da28 /bfd/elf64-s390.c
parent49fa50ef9c59aa6d03bc2e33a25b2d832a9e692b (diff)
downloadgdb-93ec5e23766a9f75aa4950748cf73964028a8d1b.zip
gdb-93ec5e23766a9f75aa4950748cf73964028a8d1b.tar.gz
gdb-93ec5e23766a9f75aa4950748cf73964028a8d1b.tar.bz2
S/390: Fix testsuite segfault added with recent pgste patch.
The recent pgste patch caused several testcases to fail with a segfault. Fixed with this patch by adding NULL pointer checks. regression-tested on s390x. bfd/ChangeLog: 2017-06-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf64-s390.c (elf_s390_additional_program_headers): Add NULL pointer checks. (elf_s390_modify_segment_map): Likewise. (bfd_elf_s390_set_options): Lisewise.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r--bfd/elf64-s390.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 1af1200..f85f8cd 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3978,22 +3978,29 @@ elf_s390_additional_program_headers (bfd *abfd ATTRIBUTE_UNUSED,
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- return htab->params->pgste;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ return htab->params->pgste;
+ }
+ return 0;
}
/* Add the PT_S390_PGSTE program header. */
static bfd_boolean
-elf_s390_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
+elf_s390_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
struct elf_segment_map *m, *pm = NULL;
+ if (!abfd || !info)
+ return TRUE;
+
htab = elf_s390_hash_table (info);
- if (!htab->params->pgste)
+ if (!htab || !htab->params->pgste)
return TRUE;
/* If there is already a PT_S390_PGSTE header, avoid adding
@@ -4027,8 +4034,12 @@ bfd_elf_s390_set_options (struct bfd_link_info *info,
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- htab->params = params;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ htab->params = params;
+ }
return TRUE;
}