This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] [PRU]: Fix disassembly text for instructions with reloc
- From: Dimitar Dimitrov <dimitar at dinux dot eu>
- To: binutils at sourceware dot org
- Date: Thu, 07 Dec 2017 19:43:15 +0200
- Subject: Re: [PATCH] [PRU]: Fix disassembly text for instructions with reloc
- Authentication-results: sourceware.org; auth=none
- Authentication-results: outgoing.host.bg; auth=pass smtp.auth=193 dot 107 dot 36 dot 199 at server28 dot host dot bg
- References: <20171118141235.7545-1-dimitar@dinux.eu>
Ping.
On събота, 18 ноември 2017 г. 16:12:35 EET Dimitar Dimitrov wrote:
> This patch enables disassembler_needs_relocs for PRU. It is needed
> to print correct symbols when disassembling arguments of "call"
> instructions with a relocation.
>
> Also add regression test to GAS, since opcode lib doesn't have its
> own test suite.
>
> gas/
> 2017-11-18 Dimitar Dimitrov <dimitar@dinux.eu>
>
> * testsuite/gas/pru/extern.d: New test for print of U16_PMEMM
> relocation. * testsuite/gas/pru/extern.s: Ditto.
>
> opcodes/
> 2017-11-18 Dimitar Dimitrov <dimitar@dinux.eu>
>
> * disassemble.c: Enable disassembler_needs_relocs for PRU.
>
> Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
> ---
> gas/testsuite/gas/pru/extern.d | 10 ++++++++++
> gas/testsuite/gas/pru/extern.s | 5 +++++
> opcodes/disassemble.c | 5 +++++
> 3 files changed, 20 insertions(+)
> create mode 100644 gas/testsuite/gas/pru/extern.d
> create mode 100644 gas/testsuite/gas/pru/extern.s
>
> diff --git a/gas/testsuite/gas/pru/extern.d b/gas/testsuite/gas/pru/extern.d
> new file mode 100644
> index 0000000000..e06f758ff7
> --- /dev/null
> +++ b/gas/testsuite/gas/pru/extern.d
> @@ -0,0 +1,10 @@
> +#objdump: -dr --prefix-addresses --show-raw-insn
> +#name: PRU extern function call dump
> +
> +# Test dumping of U16_PMEMIMM relocation
> +
> +.*: +file format elf32-pru
> +
> +Disassembly of section .text:
> +0+0000 <[^>]*> 230000c3 call 00000000 <myextfunc>
> +[\t ]*0: R_PRU_U16_PMEMIMM[\t ]*myextfunc
> diff --git a/gas/testsuite/gas/pru/extern.s b/gas/testsuite/gas/pru/extern.s
> new file mode 100644
> index 0000000000..87380df732
> --- /dev/null
> +++ b/gas/testsuite/gas/pru/extern.s
> @@ -0,0 +1,5 @@
> +# Source file used to test text dump of U16_PMEMIMM relocation
> +
> + .extern myextfunc
> +foo:
> + call myextfunc
> diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
> index 11206c67a5..70ee65a1ab 100644
> --- a/opcodes/disassemble.c
> +++ b/opcodes/disassemble.c
> @@ -651,6 +651,11 @@ disassemble_init_for_target (struct disassemble_info *
> info) }
> break;
> #endif
> +#ifdef ARCH_pru
> + case bfd_arch_pru:
> + info->disassembler_needs_relocs = TRUE;
> + break;
> +#endif
> #ifdef ARCH_powerpc
> case bfd_arch_powerpc:
> #endif