aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1994-11-07 07:04:09 +0000
committerKen Raeburn <raeburn@cygnus>1994-11-07 07:04:09 +0000
commitf4c01c95482e6d86f06dfd5c7c0a761f9fd47714 (patch)
tree24501825044b5a40a808fa38372568dbf03a2db1
parentd4e4b3f7f572751266e031681c9ef9873233264c (diff)
downloadgdb-f4c01c95482e6d86f06dfd5c7c0a761f9fd47714.zip
gdb-f4c01c95482e6d86f06dfd5c7c0a761f9fd47714.tar.gz
gdb-f4c01c95482e6d86f06dfd5c7c0a761f9fd47714.tar.bz2
tc-a29k.c: some cleanup; range-checking on JUMPTARG relocs
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/config/tc-a29k.c42
2 files changed, 31 insertions, 22 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e251e0a..9e34698 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+Mon Nov 7 01:58:49 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
+
+ * config/tc-a29k.c (octal, toHex): Variables deleted.
+ (isoctal): Macro deleted.
+ (md_begin): Don't initialize them.
+ (machine_ip, case 'P'/'A'): For absolute operand, generate an
+ error message if it's out of range.
+ (md_apply_fix, case RELOC_JUMPTARG): Check range for PC-relative
+ jumps.
+ (md_apply_fix): Delete code inside "#if 0".
+
Thu Nov 3 20:20:40 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
* config/go32.mh: Unused file deleted.
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index eee09c0..41d9277 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -123,10 +123,6 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
changed in read.c. Ideally it shouldn't have to know about it at
all, but nothing is ideal around here. */
-static unsigned char octal[256];
-#define isoctal(c) octal[c]
-static unsigned char toHex[256];
-
/*
* anull bit - causes the branch delay slot instructions to not be executed
*/
@@ -338,15 +334,6 @@ md_begin ()
if (lose)
as_fatal ("Broken assembler. No assembly attempted.");
- for (i = '0'; i < '8'; ++i)
- octal[i] = 1;
- for (i = '0'; i <= '9'; ++i)
- toHex[i] = i - '0';
- for (i = 'a'; i <= 'f'; ++i)
- toHex[i] = i + 10 - 'a';
- for (i = 'A'; i <= 'F'; ++i)
- toHex[i] = i + 10 - 'A';
-
define_some_regs ();
}
@@ -595,6 +582,13 @@ machine_ip (str)
/* Make sure the 'A' case really exists. */
if ((insn->opcode | ABSOLUTE_BIT) != (insn + 1)->opcode)
break;
+ {
+ bfd_vma v, mask;
+ mask = 0x1ffff;
+ v = operand->X_add_number & ~ mask;
+ if (v)
+ as_bad ("call/jmp target out of range");
+ }
opcode |= ABSOLUTE_BIT |
(operand->X_add_number & 0x0003FC00) << 6 |
((operand->X_add_number & 0x000003FC) >> 2);
@@ -860,16 +854,20 @@ md_apply_fix (fixP, val)
buf[3] = val;
break;
-#if 0
- case RELOC_PC10:
- case RELOC_PC22:
- case RELOC_JMP_TBL:
- case RELOC_SEGOFF16:
- case RELOC_GLOB_DAT:
- case RELOC_JMP_SLOT:
- case RELOC_RELATIVE:
-#endif
case RELOC_JUMPTARG: /* 00XX00XX pattern in a word */
+ if (!fixP->fx_done)
+ /* let linker deal */
+ ;
+ else if (fixP->fx_pcrel)
+ {
+ long v = val >> 16;
+ if (v != 0 && v != -1)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ "call/jmp target out of range");
+ }
+ else
+ /* this case was supposed to be handled in machine_ip */
+ abort ();
buf[1] = val >> 10; /* Holds bits 0003FFFC of address */
buf[3] = val >> 2;
break;