X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-v850.c;h=df14fe951839f28718a123bed26b0d5bfc020a2e;hb=6df3c45f79c98a397e20edcdf68151d5888412b7;hp=b18cf24353da7c56fa975bcfd54b266df1165e1a;hpb=00fd8294caee09fda9248f1787000c56c270e608;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index b18cf24353..df14fe9518 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -1045,8 +1045,12 @@ handle_ctoff (const struct v850_operand * operand) if (operand == NULL) return BFD_RELOC_V850_CALLT_16_16_OFFSET; - assert (operand->bits == 6); - assert (operand->shift == 0); + if ( operand->bits != 6 + || operand->shift == 0) + { + as_bad ("ctoff() relocation used on an instruction which does not support it"); + return BFD_RELOC_64; /* Used to indicate an error condition. */ + } return BFD_RELOC_V850_CALLT_6_7_OFFSET; } @@ -1061,8 +1065,12 @@ handle_sdaoff (const struct v850_operand * operand) if (operand->bits == -1) return BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET; /* end-sanitize-v850e */ - assert (operand->bits == 16); - assert (operand->shift == 16); + if ( operand->bits != 16 + || operand->shift == 16) + { + as_bad ("sdaoff() relocation used on an instruction which does not support it"); + return BFD_RELOC_64; /* Used to indicate an error condition. */ + } return BFD_RELOC_V850_SDA_16_16_OFFSET; } @@ -1075,9 +1083,13 @@ handle_zdaoff (const struct v850_operand * operand) /* start-sanitize-v850e */ if (operand->bits == -1) return BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET; /* end-sanitize-v850e */ - - assert (operand->bits == 16); - assert (operand->shift == 16); + + if ( operand->bits != 16 + || operand->shift != 16) + { + as_bad ("zdaoff() relocation used on an instruction which does not support it"); + return BFD_RELOC_64; /* Used to indicate an error condition. */ + } return BFD_RELOC_V850_ZDA_16_16_OFFSET; } @@ -1093,7 +1105,11 @@ handle_tdaoff (const struct v850_operand * operand) /* end-sanitize-v850e */ if (operand->bits == 16 && operand->shift == 16) return BFD_RELOC_V850_TDA_16_16_OFFSET; /* set1 & chums, operands: D16 */ - assert (operand->bits == 7); + if (operand->bits != 7) + { + as_bad ("tdaoff() relocation used on an instruction which does not support it"); + return BFD_RELOC_64; /* Used to indicate an error condition. */ + } return operand->insert != NULL ? BFD_RELOC_V850_TDA_7_8_OFFSET /* sld.h/sst.h, operand: D8_7 */ @@ -1237,17 +1253,25 @@ md_assemble (str) hold = input_line_pointer; input_line_pointer = str; -/* fprintf (stderr, "operand: %s index = %d, opcode = %s\n", input_line_pointer, opindex_ptr - opcode->operands, opcode->name ); */ - /* lo(), hi(), hi0(), etc... */ if ((reloc = v850_reloc_prefix (operand)) != BFD_RELOC_UNUSED) { + if (reloc == BFD_RELOC_64) /* This is a fake reloc, used to indicate an error condition. */ + { + match = 1; + goto error; + } + expression (& ex); if (ex.X_op == O_constant) { switch (reloc) { + case BFD_RELOC_V850_ZDA_16_16_OFFSET: + /* To cope with "not1 7, zdaoff(0xfffff006)[r0]" and the like. */ + /* Fall through. */ + case BFD_RELOC_LO16: { /* Truncate, then sign extend the value. */ @@ -1287,9 +1311,10 @@ md_assemble (str) ex.X_add_number = 0; break; /* end-sanitize-v850e */ - + default: - as_bad ( "AAARG -> unhandled constant reloc"); + fprintf (stderr, "reloc: %d\n", reloc); + as_bad ("AAARG -> unhandled constant reloc"); break; }