X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-dlx.c;h=955a457212a34b6d4d3a11dfbb526e9d53a8f0e3;hb=e12fe5554c3b70139f68e33ded9e2a8075b9d484;hp=25841ed1eed2f9f7702ec961e3a91177335f29d7;hpb=df7b86aa4cb63ce86e60949b8160438bc0f9e389;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c index 25841ed1ee..955a457212 100644 --- a/gas/config/tc-dlx.c +++ b/gas/config/tc-dlx.c @@ -1,6 +1,5 @@ /* tc-dlx.c -- Assemble for the DLX - Copyright 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2012 - Free Software Foundation, Inc. + Copyright (C) 2002-2015 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -231,11 +230,10 @@ s_proc (int end_p) return; } - name = input_line_pointer; - delim1 = get_symbol_end (); + delim1 = get_symbol_name (&name); name = xstrdup (name); *input_line_pointer = delim1; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { @@ -245,7 +243,12 @@ s_proc (int end_p) /* Missing entry point, use function's name with the leading char prepended. */ if (leading_char) - asprintf (&label, "%c%s", leading_char, name); + { + unsigned len = strlen (name) + 1; + label = xmalloc (len + 1); + label[0] = leading_char; + memcpy (label + 1, name, len); + } else label = name; } @@ -253,10 +256,9 @@ s_proc (int end_p) { ++input_line_pointer; SKIP_WHITESPACE (); - label = input_line_pointer; - delim2 = get_symbol_end (); + delim2 = get_symbol_name (&label); label = xstrdup (label); - *input_line_pointer = delim2; + (void) restore_line_pointer (delim2); } current_name = name; @@ -662,6 +664,9 @@ machine_ip (char *str) expressionS *operand = &the_operand; unsigned int reg, reg_shift = 0; + memset (&the_insn, '\0', sizeof (the_insn)); + the_insn.reloc = NO_RELOC; + /* Fixup the opcode string to all lower cases, and also allow numerical digits. */ s = str; @@ -686,19 +691,12 @@ machine_ip (char *str) return; } - /* Hash the opcode, insn will have the string from opcode table. - also initialized the_insn struct. */ + /* Hash the opcode, insn will have the string from opcode table. */ if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL) { /* Handle the ret and return macro here. */ if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0)) - { - memset (&the_insn, '\0', sizeof (the_insn)); - the_insn.reloc = NO_RELOC; - the_insn.pcrel = 0; - the_insn.opcode = - (unsigned long)(JROP | 0x03e00000); /* 0x03e00000 = r31 << 21 */ - } + the_insn.opcode = JROP | 0x03e00000; /* 0x03e00000 = r31 << 21 */ else as_bad (_("Unknown opcode `%s'."), str); @@ -706,9 +704,6 @@ machine_ip (char *str) } opcode = insn->opcode; - memset (&the_insn, '\0', sizeof (the_insn)); - the_insn.reloc = NO_RELOC; - the_insn.pcrel = 0; /* Set the sip reloc HI16 flag. */ if (!set_dlx_skip_hi16_flag (1)) @@ -806,7 +801,7 @@ machine_ip (char *str) continue; } - the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16 + the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16 : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16); the_insn.reloc_offset = 2; the_insn.size = 2;