aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1997-05-13 17:55:41 +0000
committerFred Fish <fnf@specifix.com>1997-05-13 17:55:41 +0000
commit7b02bacd3de266168c23dc6f4f8286a6b4487890 (patch)
tree68385dadf417a624189e4df91d3f1e68f5b61cdf
parent8490235019dde8d3b838f3b7f6666ca0eca63911 (diff)
downloadgdb-7b02bacd3de266168c23dc6f4f8286a6b4487890.zip
gdb-7b02bacd3de266168c23dc6f4f8286a6b4487890.tar.gz
gdb-7b02bacd3de266168c23dc6f4f8286a6b4487890.tar.bz2
* config/tc-tic80.c (md_apply_fix): Check PC relative relocations
for overflow/underflow, only insert lower 15 bits into instruction.
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-tic80.c16
2 files changed, 20 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index adaf79b..a0ee8d8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+start-sanitize-tic80
+Tue May 13 10:45:56 1997 Fred Fish <fnf@cygnus.com>
+
+ * config/tc-tic80.c (md_apply_fix): Check PC relative relocations
+ for overflow/underflow, only insert lower 15 bits into instruction.
+
+end-sanitize-tic80
Mon May 12 13:33:08 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
* config/tc-i386.c (pi): Check for RegMMX.
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index 9430512..6c1f490 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -917,6 +917,7 @@ md_apply_fix (fixP, val)
long val;
{
char *dest = fixP -> fx_frag -> fr_literal + fixP -> fx_where;
+ int overflow;
switch (fixP -> fx_r_type)
{
@@ -924,9 +925,18 @@ md_apply_fix (fixP, val)
md_number_to_chars (dest, (valueT) val, 4);
break;
case R_MPPCR:
- /* FIXME! - should check for overflow of the 15 bit field */
- *dest++ = val >> 2;
- *dest = (*dest & 0x80) | val >> 10;
+ overflow = (val < 0) ? !(val & 0x8000) : (val & 0x8000);
+ if (overflow)
+ {
+ as_bad_where (fixP -> fx_file, fixP -> fx_line, "PC relative target out of range");
+ }
+ else
+ {
+ val >>= 2;
+ *dest++ = val & 0xFF;
+ val >>= 8;
+ *dest = (*dest & 0x80) | (val & 0x7F);
+ }
break;
case R_ABS:
md_number_to_chars (dest, (valueT) val, fixP -> fx_size);