X-Git-Url: https://oss.titaniummirror.com/gitweb?p=msp430-binutils.git;a=blobdiff_plain;f=opcodes%2For32-opc.c;h=24ab5cf28093bba197ef618f937a25006346661a;hp=e52dbd671c8a89fff9c10d20bc713b3a8b8b6a86;hb=88750007d7869f178f0ba528f41efd3b74c424cf;hpb=6df9443a374e2b81278c61b8afc0a1eef7db280b diff --git a/opcodes/or32-opc.c b/opcodes/or32-opc.c index e52dbd6..24ab5cf 100644 --- a/opcodes/or32-opc.c +++ b/opcodes/or32-opc.c @@ -1,5 +1,5 @@ /* Table of opcodes for the OpenRISC 1000 ISA. - Copyright 2002, 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright 2002, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Damjan Lampret (lampret@opencores.org). This file is part of the GNU opcodes library. @@ -586,7 +586,8 @@ cover_insn (unsigned long * cur, int pass, unsigned int mask) c = cover_insn (cur, curpass, mask & (~(cur_mask << best_first))); if (c) { - debug (8, "%li> #%X -> %lu\n", (long)(next - automata), i, (long)(cur - automata)); + debug (8, "%li> #%X -> %lu\n", (long)(next - automata), i, + (unsigned long)(cur - automata)); *next = cur - automata; cur = c; } @@ -950,8 +951,10 @@ static void or32_print_register (char param_ch, char *encoding, unsigned long insn) { int regnum = or32_extract(param_ch, encoding, insn); - - sprintf (disassembled, "%sr%d", disassembled, regnum); + char s_regnum[20]; + + sprintf (s_regnum, "r%d", regnum); + strcat (disassembled, s_regnum); } /* Print immediate. Used only by print_insn. */ @@ -960,18 +963,20 @@ static void or32_print_immediate (char param_ch, char *encoding, unsigned long insn) { int imm = or32_extract (param_ch, encoding, insn); + char s_imm[20]; imm = extend_imm (imm, param_ch); - + if (letter_signed (param_ch)) { if (imm < 0) - sprintf (disassembled, "%s%d", disassembled, imm); + sprintf (s_imm, "%d", imm); else - sprintf (disassembled, "%s0x%x", disassembled, imm); + sprintf (s_imm, "0x%x", imm); } else - sprintf (disassembled, "%s%#x", disassembled, imm); + sprintf (s_imm, "%#x", imm); + strcat (disassembled, s_imm); } /* Disassemble one instruction from insn to disassemble. @@ -1004,14 +1009,22 @@ disassemble_insn (unsigned long insn) if (strchr (opcode->encoding, *s)) or32_print_immediate (*s, opcode->encoding, insn); else - sprintf (disassembled, "%s%c", disassembled, *s); + { + char s_encoding[2] = { *s, '\0' }; + + strcat (disassembled, s_encoding); + } + } } } else { + char s_insn[20]; + /* This used to be %8x for binutils. */ - sprintf (disassembled, "%s.word 0x%08lx", disassembled, insn); + sprintf (s_insn, ".word 0x%08lx", insn); + strcat (disassembled, s_insn); } return insn_len (insn);