diff options
Diffstat (limited to 'opcodes/avr-dis.c')
-rw-r--r-- | opcodes/avr-dis.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c index 7e792c9d1574..aea807e9255d 100644 --- a/opcodes/avr-dis.c +++ b/opcodes/avr-dis.c @@ -43,6 +43,8 @@ const struct avr_opcodes_s avr_opcodes[] = {NULL, NULL, NULL, 0, 0, 0} }; +static const char * comment_start = "0x"; + static int avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint, char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) @@ -140,12 +142,11 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra case 'h': *sym = 1; *sym_addr = ((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2; - /* See PR binutils/2545. Ideally we would like to display the hex + /* See PR binutils/2454. Ideally we would like to display the hex value of the address only once, but this would mean recoding objdump_print_address() which would affect many targets. */ sprintf (buf, "%#lx", (unsigned long) *sym_addr); - sprintf (comment, "0x"); - + sprintf (comment, comment_start); break; case 'L': @@ -154,17 +155,18 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra sprintf (buf, ".%+-8d", rel_addr); *sym = 1; *sym_addr = pc + 2 + rel_addr; - sprintf (comment, "0x"); + sprintf (comment, comment_start); } break; case 'l': { int rel_addr = ((((insn >> 3) & 0x7f) ^ 0x40) - 0x40) * 2; + sprintf (buf, ".%+-8d", rel_addr); *sym = 1; *sym_addr = pc + 2 + rel_addr; - sprintf (comment, "0x"); + sprintf (comment, comment_start); } break; @@ -267,10 +269,17 @@ print_insn_avr (bfd_vma addr, disassemble_info *info) int sym_op1 = 0, sym_op2 = 0; bfd_vma sym_addr1, sym_addr2; + if (!initialized) { unsigned int nopcodes; + /* PR 4045: Try to avoid duplicating the 0x prefix that + objdump_print_addr() will put on addresses when there + is no symbol table available. */ + if (info->symtab_size == 0) + comment_start = " "; + nopcodes = sizeof (avr_opcodes) / sizeof (struct avr_opcodes_s); avr_bin_masks = xmalloc (nopcodes * sizeof (unsigned int)); |