mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
* config/tc-v850.c (v850_reloc_prefix): Several disgusting
hacks to improve parsing of complex hi, lo, zda, etc expressions. (md_assemble): Don't demand and eat a trailing ')' after finding a v850 relocation prefix. Sign extend the constant in a BFD_RELOC_LO16 expression. Do eat a trailing ')' after a complete operand. (parse_cons_expression_v850): Don't eat a trailing ')' after finding a v850 relocation prefix. Trying to get nec's sample code to assemble. Why oh why didn't JT try to assemble any of their code...
This commit is contained in:
@ -1,6 +1,16 @@
|
|||||||
start-sanitize-v850
|
start-sanitize-v850
|
||||||
Thu Oct 24 14:31:04 1996 Jeffrey A Law (law@cygnus.com)
|
Thu Oct 24 14:31:04 1996 Jeffrey A Law (law@cygnus.com)
|
||||||
|
|
||||||
|
* config/tc-v850.c (v850_reloc_prefix): Several disgusting
|
||||||
|
hacks to improve parsing of complex hi, lo, zda, etc
|
||||||
|
expressions.
|
||||||
|
(md_assemble): Don't demand and eat a trailing ')' after finding
|
||||||
|
a v850 relocation prefix. Sign extend the constant in a
|
||||||
|
BFD_RELOC_LO16 expression. Do eat a trailing ')' after a complete
|
||||||
|
operand.
|
||||||
|
(parse_cons_expression_v850): Don't eat a trailing ')' after
|
||||||
|
finding a v850 relocation prefix.
|
||||||
|
|
||||||
* config/tc-v850.h (TC_PARSE_CONS_EXPRESSION): Define.
|
* config/tc-v850.h (TC_PARSE_CONS_EXPRESSION): Define.
|
||||||
(TC_CONS_FIX_NEW): Likewise.
|
(TC_CONS_FIX_NEW): Likewise.
|
||||||
* config/tc-v850.c (parse_cons_expression_v850): New function.
|
* config/tc-v850.c (parse_cons_expression_v850): New function.
|
||||||
|
@ -459,39 +459,72 @@ v850_reloc_prefix()
|
|||||||
{
|
{
|
||||||
if (strncmp(input_line_pointer, "hi0(", 4) == 0)
|
if (strncmp(input_line_pointer, "hi0(", 4) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 4;
|
input_line_pointer += 3;
|
||||||
return BFD_RELOC_HI16;
|
return BFD_RELOC_HI16;
|
||||||
}
|
}
|
||||||
if (strncmp(input_line_pointer, "hi(", 3) == 0)
|
if (strncmp(input_line_pointer, "hi(", 3) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 3;
|
input_line_pointer += 2;
|
||||||
return BFD_RELOC_HI16_S;
|
return BFD_RELOC_HI16_S;
|
||||||
}
|
}
|
||||||
if (strncmp (input_line_pointer, "lo(", 3) == 0)
|
if (strncmp (input_line_pointer, "lo(", 3) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 3;
|
input_line_pointer += 2;
|
||||||
return BFD_RELOC_LO16;
|
return BFD_RELOC_LO16;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp (input_line_pointer, "sdaoff(", 7) == 0)
|
if (strncmp (input_line_pointer, "sdaoff(", 7) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 7;
|
input_line_pointer += 6;
|
||||||
return BFD_RELOC_V850_SDA_OFFSET;
|
return BFD_RELOC_V850_SDA_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp (input_line_pointer, "zdaoff(", 7) == 0)
|
if (strncmp (input_line_pointer, "zdaoff(", 7) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 7;
|
input_line_pointer += 6;
|
||||||
return BFD_RELOC_V850_ZDA_OFFSET;
|
return BFD_RELOC_V850_ZDA_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp (input_line_pointer, "tdaoff(", 7) == 0)
|
if (strncmp (input_line_pointer, "tdaoff(", 7) == 0)
|
||||||
{
|
{
|
||||||
input_line_pointer += 7;
|
input_line_pointer += 6;
|
||||||
return BFD_RELOC_V850_TDA_OFFSET;
|
return BFD_RELOC_V850_TDA_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: implement sda, tda, zda here */
|
/* Disgusting */
|
||||||
|
if (strncmp(input_line_pointer, "(hi0(", 5) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 4;
|
||||||
|
return BFD_RELOC_HI16;
|
||||||
|
}
|
||||||
|
if (strncmp(input_line_pointer, "(hi(", 4) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 3;
|
||||||
|
return BFD_RELOC_HI16_S;
|
||||||
|
}
|
||||||
|
if (strncmp (input_line_pointer, "(lo(", 4) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 3;
|
||||||
|
return BFD_RELOC_LO16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp (input_line_pointer, "(sdaoff(", 8) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 7;
|
||||||
|
return BFD_RELOC_V850_SDA_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp (input_line_pointer, "(zdaoff(", 8) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 7;
|
||||||
|
return BFD_RELOC_V850_ZDA_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp (input_line_pointer, "(tdaoff(", 8) == 0)
|
||||||
|
{
|
||||||
|
input_line_pointer += 7;
|
||||||
|
return BFD_RELOC_V850_TDA_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
return BFD_RELOC_UNUSED;
|
return BFD_RELOC_UNUSED;
|
||||||
}
|
}
|
||||||
@ -570,19 +603,20 @@ md_assemble (str)
|
|||||||
{
|
{
|
||||||
expression(&ex);
|
expression(&ex);
|
||||||
|
|
||||||
if (*input_line_pointer++ != ')')
|
|
||||||
{
|
|
||||||
errmsg = "syntax error: expected `)'";
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ex.X_op == O_constant)
|
if (ex.X_op == O_constant)
|
||||||
{
|
{
|
||||||
switch (reloc)
|
switch (reloc)
|
||||||
{
|
{
|
||||||
case BFD_RELOC_LO16:
|
case BFD_RELOC_LO16:
|
||||||
ex.X_add_number &= 0xffff;
|
{
|
||||||
break;
|
/* Truncate, then sign extend the value. */
|
||||||
|
int temp = ex.X_add_number & 0xffff;
|
||||||
|
|
||||||
|
/* XXX Assumes 32bit ints! */
|
||||||
|
temp = (temp << 16) >> 16;
|
||||||
|
ex.X_add_number = temp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case BFD_RELOC_HI16:
|
case BFD_RELOC_HI16:
|
||||||
ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff);
|
ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff);
|
||||||
@ -720,7 +754,8 @@ md_assemble (str)
|
|||||||
str = input_line_pointer;
|
str = input_line_pointer;
|
||||||
input_line_pointer = hold;
|
input_line_pointer = hold;
|
||||||
|
|
||||||
while (*str == ' ' || *str == ',' || *str == '[' || *str == ']')
|
while (*str == ' ' || *str == ',' || *str == '[' || *str == ']'
|
||||||
|
|| *str == ')')
|
||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
match = 1;
|
match = 1;
|
||||||
@ -1019,11 +1054,6 @@ parse_cons_expression_v850 (exp)
|
|||||||
|
|
||||||
/* Do normal expression parsing. */
|
/* Do normal expression parsing. */
|
||||||
expression (exp);
|
expression (exp);
|
||||||
|
|
||||||
/* If we had to handle a reloc prefix, then eat the trailing
|
|
||||||
close paren. */
|
|
||||||
if (hold_cons_reloc != BFD_RELOC_UNUSED)
|
|
||||||
input_line_pointer++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a fixup for a cons expression. If parse_cons_expression_v850
|
/* Create a fixup for a cons expression. If parse_cons_expression_v850
|
||||||
|
Reference in New Issue
Block a user