]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PowerPC64 notoc calls
authorAlan Modra <amodra@gmail.com>
Tue, 18 Jun 2019 01:04:14 +0000 (10:34 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 19 Jun 2019 04:31:05 +0000 (14:01 +0930)
Calls from functions that don't have a valid toc pointer in r2 (these
calls are marked with _NOTOC relocs) to functions that require r2
valid must go via the callee global entry point.  This patch corrects
the condition the linker was using to detect functions that require r2
to be valid.  Values of both zero and one in st_other local entry bits
mean a function doesn't care about r2.

* elf64-ppc.c (ppc64_elf_inline_plt): Correct st_other test for
functions that require r2 valid to use local entry.
(ppc64_elf_size_stubs, ppc64_elf_relocate_section): Likewise.

bfd/ChangeLog
bfd/elf64-ppc.c

index e1767fe7949ca5632ecba5fe823a9ec5c5f8ece5..ea049b1d423c430c1295816fe134ce888ca1fe9f 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-19  Alan Modra  <amodra@gmail.com>
+
+       * elf64-ppc.c (ppc64_elf_inline_plt): Correct st_other test for
+       functions that require r2 valid to use local entry.
+       (ppc64_elf_size_stubs, ppc64_elf_relocate_section): Likewise.
+
 2019-06-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        * elfnn-aarch64.c (elfNN_aarch64_allocate_local_dynrelocs): Remove.
index 9372ea46943c0aa40b42cf3f8f87bf36adf3e9a2..61620190ce623794b7f0c594e36b1ee3f8356613 100644 (file)
@@ -7445,7 +7445,7 @@ ppc64_elf_inline_plt (struct bfd_link_info *info)
                        && !(r_type == R_PPC64_PLTCALL_NOTOC
                             && (((h ? h->other : sym->st_other)
                                  & STO_PPC64_LOCAL_MASK)
-                                != 1 << STO_PPC64_LOCAL_BIT)))
+                                > 1 << STO_PPC64_LOCAL_BIT)))
                      *tls_maskp &= ~PLT_KEEP;
                  }
              }
@@ -12897,7 +12897,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
                                   && code_sec->output_section != NULL
                                   && (((hash ? hash->elf.other : sym->st_other)
                                        & STO_PPC64_LOCAL_MASK)
-                                      != 1 << STO_PPC64_LOCAL_BIT)))
+                                      > 1 << STO_PPC64_LOCAL_BIT)))
                        stub_type = ppc_stub_long_branch_notoc;
                    }
                  else if (stub_type != ppc_stub_plt_call)
@@ -15056,7 +15056,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
                  || stub_entry->stub_type == ppc_stub_plt_branch_both)
              && (r_type != R_PPC64_REL24_NOTOC
                  || ((fdh ? fdh->elf.other : sym->st_other)
-                     & STO_PPC64_LOCAL_MASK) == 1 << STO_PPC64_LOCAL_BIT)
+                     & STO_PPC64_LOCAL_MASK) <= 1 << STO_PPC64_LOCAL_BIT)
              && (relocation + addend - from + max_br_offset
                  < 2 * max_br_offset))
            stub_entry = NULL;