aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-08-13 08:38:20 +0000
committerNick Clifton <nickc@redhat.com>1999-08-13 08:38:20 +0000
commit276b1dc2a2663680f734c8603a40e3cb8250f318 (patch)
treeca6a9fc3ae339fb97b726bf63204af34b5433ccf /gas
parentae5ad4adf9d9d33f65221fbc241b4aa490712f64 (diff)
downloadgdb-276b1dc2a2663680f734c8603a40e3cb8250f318.zip
gdb-276b1dc2a2663680f734c8603a40e3cb8250f318.tar.gz
gdb-276b1dc2a2663680f734c8603a40e3cb8250f318.tar.bz2
Only pass positive values to validate_offset_imm()
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-arm.c35
2 files changed, 25 insertions, 16 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1be3cbf..421d3c6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+1999-08-13 Nick Clifton <nickc@cygnus.com>
+
+ * config/tc-arm.c (validate_offset_imm): Work on unsigned values.
+ (md_apply_fix3): Always pass positive values to
+ validate_offset_imm.
+
1999-08-12 Nick Clifton <nickc@cygnus.com>
* config/tc-arm.c (skip_whitespace): New macro.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 999d607..0f0cd70 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -460,7 +460,7 @@ static void symbol_locate PARAMS ((symbolS *, CONST char *, segT, valueT, fragS
static int add_to_lit_pool PARAMS ((void));
static unsigned validate_immediate PARAMS ((unsigned));
static unsigned validate_immediate_twopart PARAMS ((unsigned int, unsigned int *));
-static int validate_offset_imm PARAMS ((int, int));
+static int validate_offset_imm PARAMS ((unsigned int, int));
static void opcode_select PARAMS ((int));
static void end_of_line PARAMS ((char *));
static int reg_required_here PARAMS ((char **, int));
@@ -1127,11 +1127,10 @@ validate_immediate_twopart (val, highpart)
static int
validate_offset_imm (val, hwse)
- int val;
+ unsigned int val;
int hwse;
{
- if ((hwse && (val < -255 || val > 255))
- || (val < -4095 || val > 4095))
+ if ((hwse && val > 255) || val > 4095)
return FAIL;
return val;
}
@@ -2542,7 +2541,7 @@ fp_op2 (str)
int i;
inst.error = NULL;
-
+
skip_whitespace (* str);
/* First try and match exact strings, this is to guarantee that
@@ -2848,7 +2847,7 @@ do_ldst (str, flags)
int reg;
str++;
-
+
skip_whitespace (str);
if ((reg = reg_required_here (&str, 16)) == FAIL)
@@ -5396,13 +5395,15 @@ md_apply_fix3 (fixP, val, seg)
case BFD_RELOC_ARM_OFFSET_IMM:
sign = value >= 0;
- if ((value = validate_offset_imm (value, 0)) == FAIL)
+
+ if (value < 0)
+ value = - value;
+
+ if (validate_offset_imm (value, 0) == FAIL)
{
as_bad (_("bad immediate value for offset (%ld)"), (long) value);
break;
}
- if (value < 0)
- value = -value;
newval = md_chars_to_number (buf, INSN_SIZE);
newval &= 0xff7ff000;
@@ -5413,19 +5414,20 @@ md_apply_fix3 (fixP, val, seg)
case BFD_RELOC_ARM_OFFSET_IMM8:
case BFD_RELOC_ARM_HWLITERAL:
sign = value >= 0;
- if ((value = validate_offset_imm (value, 1)) == FAIL)
+
+ if (value < 0)
+ value = - value;
+
+ if (validate_offset_imm (value, 1) == FAIL)
{
if (fixP->fx_r_type == BFD_RELOC_ARM_HWLITERAL)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("invalid literal constant: pool needs to be closer\n"));
else
- as_bad (_("bad immediate value for offset (%ld)"), (long) value);
+ as_bad (_("bad immediate value for half-word offset (%ld)"), (long) value);
break;
}
- if (value < 0)
- value = -value;
-
newval = md_chars_to_number (buf, INSN_SIZE);
newval &= 0xff7ff0f0;
newval |= ((value >> 4) << 8) | (value & 0xf) | (sign ? INDEX_UP : 0);
@@ -5434,10 +5436,11 @@ md_apply_fix3 (fixP, val, seg)
case BFD_RELOC_ARM_LITERAL:
sign = value >= 0;
+
if (value < 0)
- value = -value;
+ value = - value;
- if ((value = validate_offset_imm (value, 0)) == FAIL)
+ if (validate_offset_imm (value, 0) == FAIL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("invalid literal constant: pool needs to be closer\n"));