PowerPC disassembler: Don't emit trailing spaces

When an instruction has operands, the PowerPC disassembler prints
spaces after the opcode so as to line up operands.  If the operands
are all optional and all default value, then no operands are printed,
leaving trailing spaces.  This patch fixes that.

opcodes/
	* ppc-dis.c (print_insn_powerpc): Delay printing spaces after
	opcode until first operand is output.
gas/
	* testsuite/gas/ppc/476.d: Remove trailing spaces.
	* testsuite/gas/ppc/a2.d: Likewise.
	* testsuite/gas/ppc/booke.d: Likewise.
	* testsuite/gas/ppc/booke_xcoff.d: Likewise.
	* testsuite/gas/ppc/e500.d: Likewise.
	* testsuite/gas/ppc/e500mc.d: Likewise.
	* testsuite/gas/ppc/e6500.d: Likewise.
	* testsuite/gas/ppc/htm.d: Likewise.
	* testsuite/gas/ppc/power6.d: Likewise.
	* testsuite/gas/ppc/power8.d: Likewise.
	* testsuite/gas/ppc/power9.d: Likewise.
	* testsuite/gas/ppc/vle.d: Likewise.
ld/
	* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
	* testsuite/ld-powerpc/tlsopt5.d: Likewise.
	* testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
This commit is contained in:
Alan Modra 2019-04-05 09:20:16 +10:30
parent 82477cd28a
commit c2b1c27545
19 changed files with 96 additions and 63 deletions

View File

@ -1,3 +1,18 @@
2019-04-05 Alan Modra <amodra@gmail.com>
* testsuite/gas/ppc/476.d: Remove trailing spaces.
* testsuite/gas/ppc/a2.d: Likewise.
* testsuite/gas/ppc/booke.d: Likewise.
* testsuite/gas/ppc/booke_xcoff.d: Likewise.
* testsuite/gas/ppc/e500.d: Likewise.
* testsuite/gas/ppc/e500mc.d: Likewise.
* testsuite/gas/ppc/e6500.d: Likewise.
* testsuite/gas/ppc/htm.d: Likewise.
* testsuite/gas/ppc/power6.d: Likewise.
* testsuite/gas/ppc/power8.d: Likewise.
* testsuite/gas/ppc/power9.d: Likewise.
* testsuite/gas/ppc/vle.d: Likewise.
2019-04-04 Peter Bergner <bergner@linux.ibm.com>
PR gas/24349

View File

@ -1,3 +1,9 @@
2019-04-05 Alan Modra <amodra@gmail.com>
* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
* testsuite/ld-powerpc/tlsopt5.d: Likewise.
* testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
2019-04-03 Alan Modra <amodra@gmail.com>
PR 24411

View File

@ -1,3 +1,8 @@
2019-04-05 Alan Modra <amodra@gmail.com>
* ppc-dis.c (print_insn_powerpc): Delay printing spaces after
opcode until first operand is output.
2019-04-04 Peter Bergner <bergner@linux.ibm.com>
PR gas/24349

View File

@ -723,11 +723,13 @@ print_insn_powerpc (bfd_vma memaddr,
int need_comma;
int need_paren;
int skip_optional;
int spaces;
if (opcode->operands[0] != 0)
(*info->fprintf_func) (info->stream, "%-7s ", opcode->name);
else
(*info->fprintf_func) (info->stream, "%s", opcode->name);
(*info->fprintf_func) (info->stream, "%s", opcode->name);
/* gdb fprintf_func doesn't return count printed. */
spaces = 8 - strlen (opcode->name);
if (spaces <= 0)
spaces = 1;
/* Now extract and print the operands. */
need_comma = 0;
@ -752,6 +754,11 @@ print_insn_powerpc (bfd_vma memaddr,
value = operand_value_powerpc (operand, insn, dialect);
if (spaces)
{
(*info->fprintf_func) (info->stream, "%*s", spaces, " ");
spaces = 0;
}
if (need_comma)
{
(*info->fprintf_func) (info->stream, ",");