aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-xtensa.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 765188d..988e2f0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2020-08-26 Alan Modra <amodra@gmail.com>
+ PR 26507
+ * elf32-xtensa.c (find_removed_literal): Don't bsearch empty map.
+
+2020-08-26 Alan Modra <amodra@gmail.com>
+
PR 26506
* elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early
when section is empty.
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 5184fbf..5824c59 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -6014,13 +6014,16 @@ find_removed_literal (removed_literal_list *removed_list, bfd_vma addr)
if (removed_list->map == NULL)
map_removed_literal (removed_list);
- p = bsearch (&addr, removed_list->map, removed_list->n_map,
- sizeof (*removed_list->map), removed_literal_compare);
- if (p)
+ if (removed_list->map != NULL)
{
- while (p != removed_list->map && (p - 1)->addr == addr)
- --p;
- r = p->literal;
+ p = bsearch (&addr, removed_list->map, removed_list->n_map,
+ sizeof (*removed_list->map), removed_literal_compare);
+ if (p)
+ {
+ while (p != removed_list->map && (p - 1)->addr == addr)
+ --p;
+ r = p->literal;
+ }
}
return r;
}