This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] [Binutils][Objdump]Check symbol section information while search a mapping symbol backward.
- From: Renlin Li <renlin at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 11 Dec 2017 15:43:16 -0000
- Subject: [binutils-gdb] [Binutils][Objdump]Check symbol section information while search a mapping symbol backward.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4c5ae11b42433dbffc33fbde75c9e415594504d8
commit 4c5ae11b42433dbffc33fbde75c9e415594504d8
Author: Renlin Li <renlin.li@arm.com>
Date: Mon Dec 11 15:33:18 2017 +0000
[Binutils][Objdump]Check symbol section information while search a mapping symbol backward.
When checking mapping symbols backwardly, the section which defines the symbol
is not considerted. This patch fixes this by moving the section checking code
into get_sym_code_type () function which is shared by forward and backword
mapping symbol searching.
opcodes/
2017-12-11 Petr Pavlu <petr.pavlu@arm.com>
Renlin Li <renlin.li@arm.com>
* aarch64-dis.c (print_insn_aarch64): Move symbol section check ...
(get_sym_code_type): Here.
binutils/
2017-12-11 Renlin Li <renlin.li@arm.com>
* testsuite/binutils-all/aarch64/objdump.d: New.
* testsuite/binutils-all/aarch64/objdump.s: New.
Diff:
---
binutils/ChangeLog | 5 +++++
binutils/testsuite/binutils-all/aarch64/objdump.d | 19 +++++++++++++++++++
binutils/testsuite/binutils-all/aarch64/objdump.s | 9 +++++++++
opcodes/ChangeLog | 6 ++++++
opcodes/aarch64-dis.c | 8 +++++---
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4f29d19..f820280 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-11 Renlin Li <renlin.li@arm.com>
+
+ * testsuite/binutils-all/aarch64/objdump.d: New.
+ * testsuite/binutils-all/aarch64/objdump.s: New.
+
2017-12-08 Nick Clifton <nickc@redhat.com>
* objcopy.c (copy_relocations_in_section): Use the orelocations
diff --git a/binutils/testsuite/binutils-all/aarch64/objdump.d b/binutils/testsuite/binutils-all/aarch64/objdump.d
new file mode 100644
index 0000000..4aca57b
--- /dev/null
+++ b/binutils/testsuite/binutils-all/aarch64/objdump.d
@@ -0,0 +1,19 @@
+#PROG: objcopy
+#objdump: -d
+#name: Check that the disassembler properly dump instruction and data.
+
+.*: +file format .*aarch64.*
+
+Disassembly of section \.text:
+
+0+000 <l1>:
+ 0: d503201f nop
+
+0+004 <l2>:
+ 4: d503201f nop
+ 8: 00c0ffee \.word 0x00c0ffee
+
+Disassembly of section .fini:
+
+0+000 <\.fini>:
+ 0: 0000dead \.word 0x0000dead
diff --git a/binutils/testsuite/binutils-all/aarch64/objdump.s b/binutils/testsuite/binutils-all/aarch64/objdump.s
new file mode 100644
index 0000000..68de703
--- /dev/null
+++ b/binutils/testsuite/binutils-all/aarch64/objdump.s
@@ -0,0 +1,9 @@
+.text
+l1:
+ nop
+l2:
+ nop
+.word 0xc0ffee
+
+.section .fini, "x"
+.word 0xdead
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 10d9e63..7751ef2 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-11 Petr Pavlu <petr.pavlu@arm.com>
+ Renlin Li <renlin.li@arm.com>
+
+ * aarch64-dis.c (print_insn_aarch64): Move symbol section check ...
+ (get_sym_code_type): Here.
+
2017-12-03 Alan Modra <amodra@gmail.com>
* ppc-opc.c (extract_li20): Rewrite.
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index df67a06..8fd1ecf 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -3097,6 +3097,10 @@ get_sym_code_type (struct disassemble_info *info, int n,
unsigned int type;
const char *name;
+ /* If the symbol is in a different section, ignore it. */
+ if (info->section != NULL && info->section != info->symtab[n]->section)
+ return FALSE;
+
es = *(elf_symbol_type **)(info->symtab + n);
type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
@@ -3171,9 +3175,7 @@ print_insn_aarch64 (bfd_vma pc,
addr = bfd_asymbol_value (info->symtab[n]);
if (addr > pc)
break;
- if ((info->section == NULL
- || info->section == info->symtab[n]->section)
- && get_sym_code_type (info, n, &type))
+ if (get_sym_code_type (info, n, &type))
{
last_sym = n;
found = TRUE;