PowerPC64 handling of @tocbase
authorAlan Modra <amodra@gmail.com>
Thu, 20 Jan 2022 03:25:53 +0000 (13:55 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 28 Jan 2022 06:30:55 +0000 (17:00 +1030)
* elf64-ppc.c (ppc64_elf_relocate_section): Warn if the symbol
on R_PPC64_TOC isn't local.

bfd/elf64-ppc.c

index 8a8b83b283dcf229a2f45c9be538fb965140df24..92f6d0a5d007160532780e56d20ae0e26a3909ce 100644 (file)
@@ -17027,6 +17027,15 @@ ppc64_elf_relocate_section (bfd *output_bfd,
            relocation += htab->sec_info[sec->id].toc_off;
          else
            unresolved_reloc = true;
+         if (unresolved_reloc
+             || (!is_opd
+                 && h != NULL
+                 && !SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
+           info->callbacks->einfo
+             /* xgettext:c-format */
+             (_("%H: %s against %pT is not supported\n"),
+              input_bfd, input_section, rel->r_offset,
+              ppc64_elf_howto_table[r_type]->name, sym_name);
          goto dodyn;
 
          /* TOC16 relocs.  We want the offset relative to the TOC base,