[binutils-gdb/binutils-2_35-branch] PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389

Alan Modra amodra@sourceware.org
Thu Jan 28 08:16:19 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e658f42c0fe7e84a0e1eedaea4b29a4e3a23840c

commit e658f42c0fe7e84a0e1eedaea4b29a4e3a23840c
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 25 01:55:38 2020 +0930

    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].
    
    (cherry picked from commit 918dc783deadc206691dcc20bf8aa6c807c10244)

Diff:
---
 bfd/ChangeLog   | 5 +++++
 bfd/elf64-ppc.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8615b08cc56..4d94806609c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,11 @@
 2021-01-28  Alan Modra  <amodra@gmail.com>
 
 	Apply from master
+	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
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index aef161c029f..f1bce4a7038 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13504,10 +13504,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))


More information about the Binutils-cvs mailing list