Blame SOURCES/binutils-ppc-annobin-disassembly.patch

2e9b04
--- binutils.orig/opcodes/ppc-dis.c	2020-09-11 10:55:56.243724026 +0100
2e9b04
+++ binutils-2.35/opcodes/ppc-dis.c	2020-09-11 10:57:51.363934217 +0100
2e9b04
@@ -399,12 +399,36 @@ static unsigned short vle_opcd_indices[V
2e9b04
 #define SPE2_OPCD_SEGS (1 + SPE2_XOP_TO_SEG (SPE2_XOP (-1)))
2e9b04
 static unsigned short spe2_opcd_indices[SPE2_OPCD_SEGS + 1];
2e9b04
 
2e9b04
+static bfd_boolean
2e9b04
+ppc_symbol_is_valid (asymbol *sym,
2e9b04
+		     struct disassemble_info *info ATTRIBUTE_UNUSED)
2e9b04
+{
2e9b04
+  elf_symbol_type * est;
2e9b04
+
2e9b04
+  if (sym == NULL)
2e9b04
+    return FALSE;
2e9b04
+
2e9b04
+  est = elf_symbol_from (NULL, sym);
2e9b04
+  
2e9b04
+  /* Ignore ELF hidden, local, no-type symbols.
2e9b04
+     These are generated by annobin.  */
2e9b04
+  if (est != NULL
2e9b04
+      && ELF_ST_VISIBILITY (est->internal_elf_sym.st_other) == STV_HIDDEN
2e9b04
+      && ELF_ST_BIND (est->internal_elf_sym.st_info) == STB_LOCAL
2e9b04
+      && ELF_ST_TYPE (est->internal_elf_sym.st_info) == STT_NOTYPE)
2e9b04
+    return FALSE;
2e9b04
+
2e9b04
+  return TRUE;
2e9b04
+}
2e9b04
+
2e9b04
 /* Calculate opcode table indices to speed up disassembly,
2e9b04
    and init dialect.  */
2e9b04
 
2e9b04
 void
2e9b04
 disassemble_init_powerpc (struct disassemble_info *info)
2e9b04
 {
2e9b04
+  info->symbol_is_valid = ppc_symbol_is_valid;
2e9b04
+
2e9b04
   if (powerpc_opcd_indices[PPC_OPCD_SEGS] == 0)
2e9b04
     {
2e9b04
       unsigned seg, idx, op;