Fix the PowerPC disassembler so that it ignores annobin symbols.

This commit is contained in:
Nick Clifton 2020-09-11 11:37:10 +01:00
parent 2e0c2015a5
commit ba80920a4c
3 changed files with 54 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
*.diff *.diff
*.patch
*.orig *.orig
*.rej *.rej

View File

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

View File

@ -2,7 +2,7 @@
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug} Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.35 Version: 2.35
Release: 12%{?dist} Release: 14%{?dist}
License: GPLv3+ License: GPLv3+
URL: https://sourceware.org/binutils URL: https://sourceware.org/binutils
@ -245,6 +245,14 @@ Patch27: binutils-ppc-rename-xvcvbf16sp-to-xvcvbf16spn.patch
# Lifetime: Fixed in 2.36 # Lifetime: Fixed in 2.36
Patch28: binutils-dwarf-5-fixes.patch Patch28: binutils-dwarf-5-fixes.patch
# Purpose: Fix handling of relocations for AArch64 conditional branches.
# Lifetime: Fixed in 2.36
Patch29: binutils-aarch64-condbranch-relocs.patch
# Purpose: Fix the PowerPC disassembler so that it ignores annobin symbols.
# Lifetime: Fixed in 2.36
Patch30: binutils-ppc-annobin-disassembly.patch
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -818,6 +826,12 @@ exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%changelog %changelog
* Fri Sep 11 2020 Nick Clifton <nickc@redhat.com> - 2.35-14
- Fix the PowerPC disassembler so that it ignores annobin symbols.
* Thu Sep 10 2020 Nick Clifton <nickc@redhat.com> - 2.35-13
- Fix the handling of relocations for AArch64 conditional branches.
* Tue Aug 25 2020 Nick Clifton <nickc@redhat.com> - 2.35-12 * Tue Aug 25 2020 Nick Clifton <nickc@redhat.com> - 2.35-12
- Import fixes from GNU binutils mainline for handling DWARF-5 debug information. - Import fixes from GNU binutils mainline for handling DWARF-5 debug information.