[Binutils][Objdump]Check symbol section information while search a mapping symbol backward.

Renlin Li renlin.li@foss.arm.com
Mon Dec 11 15:19:00 GMT 2017


Hi all,

For the following test case:

.text
l1:
   nop
l2:
   nop
.word 0xc0ffee

.section .fini, "x"
.word 0xdead

The objdump could not properly dump the nop instruction at l2 label. It treats
it as data. This is because the mapping symbol it found is a data mapping
symbol. However, this $d symbol is defined in a different section. So it
shouldn't be used in a different section.

Symbol table '.symtab' contains 10 entries:
    Num:    Value          Size Type    Bind   Vis      Ndx Name
      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
      1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
      2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2
      3: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
      4: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    1 l1
      5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    1 $x
      6: 0000000000000004     0 NOTYPE  LOCAL  DEFAULT    1 l2
      7: 0000000000000008     0 NOTYPE  LOCAL  DEFAULT    1 $d
      8: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
      9: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    4 $d

This patch fixes this bug and add a new test case. The change is tested in
aarch64-none-elf cross environment. No regression.

Okay to check in?

Regards,
Renlin

opcodes/ChangeLog:

2017-12-11  Petr Pavlu  <petr.pavlu@arm.com>
2017-12-11  Renlin Li  <renlin.li@arm.com>

	* aarch64-dis.c (print_insn_aarch64): Move symbol section check ...
	(get_sym_code_type): Here.

binutils/ChangeLog:

2017-12-11  Renlin Li  <renlin.li@arm.com>

	* testsuite/binutils-all/aarch64/objdump.d: New.
	* testsuite/binutils-all/aarch64/objdump.s: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: change.patch
Type: text/x-patch
Size: 2031 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171211/a6b0dc49/attachment.bin>


More information about the Binutils mailing list