diff options
author | Nick Clifton <nickc@redhat.com> | 2020-09-10 13:23:11 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-09-10 13:23:11 +0100 |
commit | 7ad578807ad20ac19c0b31bf8b97c99eab1ce15e (patch) | |
tree | 86289cde8b5b130a48206020921471b10a8e8035 | |
parent | 89ce8eab23ac49c8c990c1934d2dff84841990af (diff) | |
download | gdb-7ad578807ad20ac19c0b31bf8b97c99eab1ce15e.zip gdb-7ad578807ad20ac19c0b31bf8b97c99eab1ce15e.tar.gz gdb-7ad578807ad20ac19c0b31bf8b97c99eab1ce15e.tar.bz2 |
Stop symbols generated by the annobin gcc plugin from breaking the disassembly of PowerPC binaries.
* ppc-dis.c (ppc_symbol_is_valid): New function. Returns false
for hidden, local, no-type symbols.
(disassemble_init_powerpc): Point the symbol_is_valid field in the
info structure at the new function.
-rw-r--r-- | opcodes/ChangeLog | 7 | ||||
-rw-r--r-- | opcodes/ppc-dis.c | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 865bf14..d4d1865 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,10 @@ +2020-09-10 Nick Clifton <nickc@redhat.com> + + * ppc-dis.c (ppc_symbol_is_valid): New function. Returns false + for hidden, local, no-type symbols. + (disassemble_init_powerpc): Point the symbol_is_valid field in the + info structure at the new function. + 2020-09-10 Cooper Qu <cooper.qu@linux.alibaba.com> * csky-opc.h (csky_v2_opcodes): Add L2Cache instructions. diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index eca1f36..4e8e3cb 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -399,12 +399,36 @@ static unsigned short vle_opcd_indices[VLE_OPCD_SEGS + 1]; #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; |