aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-25 01:55:38 +0930
committerAlan Modra <amodra@gmail.com>2020-08-25 02:12:35 +0930
commit918dc783deadc206691dcc20bf8aa6c807c10244 (patch)
tree3bd5c7ff591a97be6d9dbc79972e1ad408bfc71f
parent573eb292ee79dc78207cedadaa8acbb1922ab699 (diff)
downloadbinutils-918dc783deadc206691dcc20bf8aa6c807c10244.zip
binutils-918dc783deadc206691dcc20bf8aa6c807c10244.tar.gz
binutils-918dc783deadc206691dcc20bf8aa6c807c10244.tar.bz2
PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389
Stub sections are inserted after sec_info is sized, so have higher ids. Test flags that will exclude stub sections before looking at the sec_info array. PR 26489 * elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc and code_sec->makes_toc_func_call before sec_info[code_sec->id].
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf64-ppc.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8f062b0..ca79c4e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2020-08-25 Alan Modra <amodra@gmail.com>
+ PR 26489
+ * elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc
+ and code_sec->makes_toc_func_call before sec_info[code_sec->id].
+
+2020-08-25 Alan Modra <amodra@gmail.com>
+
PR 26492
* elf64-ppc.c (ppc_hash_table): Test is_elf_hash_table before
accessing elf_hash_table_id.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 5a21bfa..d144796 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13426,10 +13426,10 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
fact a call needing a TOC adjustment. */
if ((code_sec != NULL
&& code_sec->output_section != NULL
- && (htab->sec_info[code_sec->id].toc_off
- != htab->sec_info[section->id].toc_off)
&& (code_sec->has_toc_reloc
- || code_sec->makes_toc_func_call))
+ || code_sec->makes_toc_func_call)
+ && (htab->sec_info[code_sec->id].toc_off
+ != htab->sec_info[section->id].toc_off))
|| (((hash ? hash->elf.other : sym->st_other)
& STO_PPC64_LOCAL_MASK)
== 1 << STO_PPC64_LOCAL_BIT))