* config/tc-m68k.c (md_apply_fix3): Change val back to a signed type.
[deliverable/binutils-gdb.git] / gas / config / tc-m68k.c
index 4bbffeaf6e991d0a61669f93fec48c2159833d1c..20c9c107b58ec6d6ede3d093a21f4832e98d43c6 100644 (file)
@@ -20,8 +20,8 @@
    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
-#include <ctype.h>
 #include "as.h"
+#include "safe-ctype.h"
 #include "obstack.h"
 #include "subsegs.h"
 #include "dwarf2dbg.h"
@@ -257,9 +257,9 @@ insop (w, opcode)
      const struct m68k_incant *opcode;
 {
   int z;
-  for(z=the_ins.numo;z>opcode->m_codenum;--z)
+  for (z = the_ins.numo; z > opcode->m_codenum; --z)
     the_ins.opcode[z]=the_ins.opcode[z-1];
-  for(z=0;z<the_ins.nrel;z++)
+  for (z = 0;z < the_ins.nrel; z++)
     the_ins.reloc[z].n+=2;
   for (z = 0; z < the_ins.nfrag; z++)
     the_ins.fragb[z].fragoff++;
@@ -348,7 +348,6 @@ static void s_mri_repeat PARAMS ((int));
 static void s_mri_until PARAMS ((int));
 static void s_mri_while PARAMS ((int));
 static void s_mri_endw PARAMS ((int));
-static void md_apply_fix_2 PARAMS ((fixS *, offsetT));
 static void md_convert_frag_1 PARAMS ((fragS *));
 
 static int current_architecture;
@@ -648,8 +647,6 @@ CONST pseudo_typeS mote_pseudo_table[] =
 
 extern char *input_line_pointer;
 
-static char mklower_table[256];
-#define mklower(c) (mklower_table[(unsigned char) (c)])
 static char notend_table[256];
 static char alt_notend_table[256];
 #define notend(s)                                              \
@@ -2575,14 +2572,14 @@ m68k_ip (instring)
              if (adds (&opP->disp) == 0)
                {
                  if (the_ins.opcode[0] == 0x6000)      /* jbra */
-                   the_ins.opcode[0] = 0x4EF1;
+                   the_ins.opcode[0] = 0x4EF9;
                  else if (the_ins.opcode[0] == 0x6100) /* jbsr */
-                   the_ins.opcode[0] = 0x4EB1;
+                   the_ins.opcode[0] = 0x4EB9;
                  else                                  /* jCC */
                    {
                      the_ins.opcode[0] ^= 0x0100;
                      the_ins.opcode[0] |= 0x0006;
-                     addword (0x4EF1);
+                     addword (0x4EF9);
                    }
                  add_fix ('l', &opP->disp, 0, 0);
                  addword (0);
@@ -3311,7 +3308,7 @@ insert_reg (regname, regnum)
                                   &zero_address_frag));
 
   for (i = 0; regname[i]; i++)
-    buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+    buf[i] = TOUPPER (regname[i]);
   buf[i] = '\0';
 
   symbol_table_insert (symbol_new (buf, reg_section, regnum,
@@ -3781,11 +3778,10 @@ md_begin ()
      my lord ghod hath spoken, so we do it this way.  Excuse the ugly var
      names.  */
 
-  register const struct m68k_opcode *ins;
-  register struct m68k_incant *hack, *slak;
-  register const char *retval = 0;     /* empty string, or error msg text */
-  register int i;
-  register char c;
+  const struct m68k_opcode *ins;
+  struct m68k_incant *hack, *slak;
+  const char *retval = 0;      /* empty string, or error msg text */
+  int i;
 
   if (flag_mri)
     {
@@ -3880,9 +3876,6 @@ md_begin ()
        }
     }
 
-  for (i = 0; i < (int) sizeof (mklower_table); i++)
-    mklower_table[i] = (isupper (c = (char) i)) ? tolower (c) : c;
-
   for (i = 0; i < (int) sizeof (notend_table); i++)
     {
       notend_table[i] = 0;
@@ -4228,11 +4221,13 @@ md_number_to_chars (buf, val, n)
   number_to_chars_bigendian (buf, val, n);
 }
 
-static void
-md_apply_fix_2 (fixP, val)
+void
+md_apply_fix3 (fixP, valP, seg)
      fixS *fixP;
-     offsetT val;
+     valueT *valP;
+     segT seg ATTRIBUTE_UNUSED;
 {
+  offsetT val = *valP;
   addressT upper_limit;
   offsetT lower_limit;
 
@@ -4244,6 +4239,9 @@ md_apply_fix_2 (fixP, val)
 
   val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000;
 
+  if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+    fixP->fx_done = 1;
+
 #ifdef OBJ_ELF
   if (fixP->fx_addsy)
     {
@@ -4266,8 +4264,8 @@ md_apply_fix_2 (fixP, val)
 
   switch (fixP->fx_size)
     {
-      /* The cast to offsetT below are necessary to make code correct for
-        machines where ints are smaller than offsetT */
+      /* The cast to offsetT below are necessary to make code
+        correct for machines where ints are smaller than offsetT.  */
     case 1:
       *buf++ = val;
       upper_limit = 0x7f;
@@ -4327,24 +4325,6 @@ md_apply_fix_2 (fixP, val)
     as_bad_where (fixP->fx_file, fixP->fx_line, _("invalid byte branch offset"));
 }
 
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
-     fixS *fixP;
-     valueT *valp;
-{
-  md_apply_fix_2 (fixP, (addressT) *valp);
-  return 1;
-}
-#else
-void md_apply_fix (fixP, val)
-     fixS *fixP;
-     long val;
-{
-  md_apply_fix_2 (fixP, (addressT) val);
-}
-#endif
-
 /* *fragP has been relaxed to its final size, and now needs to have
    the bytes inside it modified to conform to the new size  There is UGLY
    MAGIC here. ..
@@ -5370,7 +5350,7 @@ s_reg (ignore)
   SKIP_WHITESPACE ();
 
   s = input_line_pointer;
-  while (isalnum ((unsigned char) *input_line_pointer)
+  while (ISALNUM (*input_line_pointer)
 #ifdef REGISTER_PREFIX
         || *input_line_pointer == REGISTER_PREFIX
 #endif
@@ -5582,10 +5562,7 @@ mri_assemble (str)
 
   /* md_assemble expects the opcode to be in lower case.  */
   for (s = str; *s != ' ' && *s != '\0'; s++)
-    {
-      if (isupper ((unsigned char) *s))
-       *s = tolower ((unsigned char) *s);
-    }
+    *s = TOLOWER (*s);
 
   md_assemble (str);
 }
@@ -5667,10 +5644,8 @@ parse_mri_condition (pcc)
   ++input_line_pointer;
   SKIP_WHITESPACE ();
 
-  if (isupper (c1))
-    c1 = tolower (c1);
-  if (isupper (c2))
-    c2 = tolower (c2);
+  c1 = TOLOWER (c1);
+  c2 = TOLOWER (c2);
 
   *pcc = (c1 << 8) | c2;
 
@@ -5912,7 +5887,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
       *s++ = 'm';
       *s++ = 'p';
       if (qual != '\0')
-       *s++ = tolower(qual);
+       *s++ = TOLOWER (qual);
       *s++ = ' ';
       memcpy (s, leftstart, leftstop - leftstart);
       s += leftstop - leftstart;
@@ -5930,7 +5905,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
   *s++ = cc >> 8;
   *s++ = cc & 0xff;
   if (extent != '\0')
-    *s++ = tolower(extent);
+    *s++ = TOLOWER (extent);
   *s++ = ' ';
   strcpy (s, truelab);
   mri_assemble (buf);
@@ -6180,7 +6155,7 @@ s_mri_else (qual)
   mri_control_stack->else_seen = 1;
 
   buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom));
-  q[0] = tolower(qual);
+  q[0] = TOLOWER (qual);
   q[1] = '\0';
   sprintf (buf, "bra%s %s", q, mri_control_stack->bottom);
   mri_assemble (buf);
@@ -6253,7 +6228,7 @@ s_mri_break (extent)
     }
 
   buf = (char *) xmalloc (20 + strlen (n->bottom));
-  ex[0] = tolower(extent);
+  ex[0] = TOLOWER (extent);
   ex[1] = '\0';
   sprintf (buf, "bra%s %s", ex, n->bottom);
   mri_assemble (buf);
@@ -6292,7 +6267,7 @@ s_mri_next (extent)
     }
 
   buf = (char *) xmalloc (20 + strlen (n->next));
-  ex[0] = tolower(extent);
+  ex[0] = TOLOWER (extent);
   ex[1] = '\0';
   sprintf (buf, "bra%s %s", ex, n->next);
   mri_assemble (buf);
@@ -6476,7 +6451,7 @@ s_mri_for (qual)
   *s++ = 'v';
   *s++ = 'e';
   if (qual != '\0')
-    *s++ = tolower(qual);
+    *s++ = TOLOWER (qual);
   *s++ = ' ';
   memcpy (s, initstart, initstop - initstart);
   s += initstop - initstart;
@@ -6494,7 +6469,7 @@ s_mri_for (qual)
   *s++ = 'm';
   *s++ = 'p';
   if (qual != '\0')
-    *s++ = tolower(qual);
+    *s++ = TOLOWER (qual);
   *s++ = ' ';
   memcpy (s, endstart, endstop - endstart);
   s += endstop - endstart;
@@ -6505,7 +6480,7 @@ s_mri_for (qual)
   mri_assemble (buf);
 
   /* bcc bottom */
-  ex[0] = tolower(extent);
+  ex[0] = TOLOWER (extent);
   ex[1] = '\0';
   if (up)
     sprintf (buf, "blt%s %s", ex, n->bottom);
@@ -6521,7 +6496,7 @@ s_mri_for (qual)
     strcpy (s, "sub");
   s += 3;
   if (qual != '\0')
-    *s++ = tolower(qual);
+    *s++ = TOLOWER (qual);
   *s++ = ' ';
   memcpy (s, bystart, bystop - bystart);
   s += bystop - bystart;
This page took 0.027042 seconds and 4 git commands to generate.