diff options
author | Alan Modra <amodra@gmail.com> | 2014-06-16 10:02:59 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-06-16 12:33:42 +0930 |
commit | 97d24fbbf5300d5b03e48018454335772d9304e8 (patch) | |
tree | 9303af7e1dc8f226b79d6a55291b4c3f002a53ec | |
parent | 1ab668bf2a42ad6c9ef2f691257118faba65bfe9 (diff) | |
download | gdb-97d24fbbf5300d5b03e48018454335772d9304e8.zip gdb-97d24fbbf5300d5b03e48018454335772d9304e8.tar.gz gdb-97d24fbbf5300d5b03e48018454335772d9304e8.tar.bz2 |
Don't leave DLX the_insn uninitialised
In particular the_insn.reloc must be initialised, otherwise the early
exit cases for bad opcodes will result in cascading errors if
write_object_file is called after an error.
* config/tc-dlx.c (machine_ip): Move initialisation of the_insn
earlier.
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-dlx.c | 17 |
2 files changed, 10 insertions, 12 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 568df4e..8f1aec1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ 2014-06-16 Alan Modra <amodra@gmail.com> + * config/tc-dlx.c (machine_ip): Move initialisation of the_insn + earlier. + +2014-06-16 Alan Modra <amodra@gmail.com> + * config/tc-i386.c (reloc): Don't avoid pcrel check for BFD_RELOC_SIZE64. Return NO_RELOC on failing pcrel check. diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c index 4cbc5c0..3c487f2 100644 --- a/gas/config/tc-dlx.c +++ b/gas/config/tc-dlx.c @@ -666,6 +666,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; @@ -690,19 +693,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); @@ -710,9 +706,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)) |