Thu Mar 20 13:42:01 1997 H.J. Lu <hjl@lucon.org>
authorIan Lance Taylor <ian@airs.com>
Thu, 20 Mar 1997 19:08:35 +0000 (19:08 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 20 Mar 1997 19:08:35 +0000 (19:08 +0000)
* frags.c (frag_var): Change offset parameter to offsetT.
(frag_variant): Likewise.
* frags.h (frag_variant, frag_var): Update declarations.
* config/tc-m68k.c (struct m68k_it): Change foff field to
offsetT.
(add_frag): Change off parameter to offsetT.
* Several files: Add casts to calls to frag_var.

gas/ChangeLog
gas/config/tc-i386.c
gas/config/tc-i386.h
gas/config/tc-m68k.c
gas/config/tc-m88k.c
gas/config/tc-mips.c
gas/symbols.c

index a32c2f5..5512745 100644 (file)
@@ -1,5 +1,13 @@
 Thu Mar 20 13:42:01 1997  H.J. Lu  <hjl@lucon.org>
 
+       * frags.c (frag_var): Change offset parameter to offsetT.
+       (frag_variant): Likewise.
+       * frags.h (frag_variant, frag_var): Update declarations.
+       * config/tc-m68k.c (struct m68k_it): Change foff field to
+       offsetT.
+       (add_frag): Change off parameter to offsetT.
+       * Several files: Add casts to calls to frag_var.
+
        * Makefile.in (m68k-parse.c): Depend upon itbl-parse.c, to
        serialize a parallel make.
        (itbl-parse.h): Split target out from itbl-parse.c.
index 7f04277..3d562cd 100644 (file)
 #define TC_RELOC(X,Y) (Y)
 #endif
 
+static unsigned long mode_from_disp_size PARAMS ((unsigned long));
+static int fits_in_signed_byte PARAMS ((long));
+static int fits_in_unsigned_byte PARAMS ((long));
+static int fits_in_unsigned_word PARAMS ((long));
+static int fits_in_signed_word PARAMS ((long));
+static int smallest_imm_type PARAMS ((long));
+static void set_16bit_code_flag PARAMS ((int));
+#ifdef BFD_ASSEMBLER
+static bfd_reloc_code_real_type reloc
+  PARAMS ((int, int, bfd_reloc_code_real_type));
+#endif
+
 /* 'md_assemble ()' gathers together information and puts it into a
    i386_insn. */
 
@@ -409,7 +421,8 @@ smallest_imm_type (num)
          : (Imm32));
 }                              /* smallest_imm_type() */
 
-void set_16bit_code_flag(new_16bit_code_flag)
+static void
+set_16bit_code_flag (new_16bit_code_flag)
        int new_16bit_code_flag;
 {
   flag_16bit_code = new_16bit_code_flag;
@@ -1679,7 +1692,7 @@ md_assemble (line)
                       ? ENCODE_RELAX_STATE (UNCOND_JUMP, BYTE)
                       : ENCODE_RELAX_STATE (COND_JUMP, BYTE)),
                      i.disps[0]->X_add_symbol,
-                     (long) n, p);
+                     (offsetT) n, p);
          }
       }
     else if (t->opcode_modifier & (JumpByte | JumpDword))
index 55e7e16..51bbb46 100644 (file)
 #ifndef TC_I386
 #define TC_I386 1
 
+#ifdef ANSI_PROTOTYPES
+struct fix;
+#endif
+
 #define TARGET_BYTES_BIG_ENDIAN        0
 
 #ifdef TE_LYNX
@@ -39,6 +43,7 @@
           (X) != BFD_RELOC_386_GOTPC) ? Y : X)
 
 #define tc_fix_adjustable(X)  tc_i386_fix_adjustable(X)
+extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
 
 /* This is the relocation type for direct references to GLOBAL_OFFSET_TABLE.
  * It comes up in complicated expressions such as 
@@ -76,6 +81,9 @@
 #ifdef TE_Mach
 #define TARGET_FORMAT          "a.out-mach3"
 #endif
+#ifdef TE_DYNIX
+#define TARGET_FORMAT          "a.out-i386-dynix"
+#endif
 #ifndef TARGET_FORMAT
 #define TARGET_FORMAT          "a.out-i386"
 #endif
 #define TARGET_FORMAT          "elf32-i386"
 #endif
 
+#ifdef OBJ_MAYBE_ELF
+#ifdef OBJ_MAYBE_COFF
+extern const char *i386_target_format PARAMS ((void));
+#define TARGET_FORMAT i386_target_format ()
+#endif
+#endif
+
 #else /* ! BFD_ASSEMBLER */
 
 /* COFF STUFF */
 #define TC_COUNT_RELOC(x) ((x)->fx_addsy || (x)->fx_r_type==7)
 #define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==7)
 #define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP)
-extern short tc_coff_fix2rtype ();
+extern short tc_coff_fix2rtype PARAMS ((struct fix *));
 #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
 extern int tc_coff_sizemachdep PARAMS ((fragS *frag));
 #define SUB_SEGMENT_ALIGN(SEG) 2
@@ -123,14 +138,16 @@ extern int tc_coff_sizemachdep PARAMS ((fragS *frag));
 #endif
 #define tc_coff_symbol_emit_hook(a)    ;       /* not used */
 
+#ifndef BFD_ASSEMBLER
 #ifndef OBJ_AOUT
 #ifndef TE_PE
 /* Local labels starts with .L */
 #define LOCAL_LABEL(name) (name[0] == '.' \
                 && (name[1] == 'L' || name[1] == 'X' || name[1] == '.'))
-#define FAKE_LABEL_NAME ".L0\001"
 #endif
 #endif
+#endif
+
 #define LOCAL_LABELS_FB 1
 
 #define tc_aout_pre_write_hook(x)      {;}     /* not used */
@@ -365,7 +382,7 @@ base_index_byte;
 #endif
 
 #ifdef BFD_ASSEMBLER
-void i386_validate_fix ();
+void i386_validate_fix PARAMS ((struct fix *));
 #define TC_VALIDATE_FIX(FIXP,SEGTYPE,SKIP) i386_validate_fix(FIXP)
 #endif
 
@@ -386,7 +403,7 @@ if ((n) && !need_pass_2                                                     \
   {                                                                    \
     char *p;                                                           \
     p = frag_var (rs_align_code, 15, 1, (relax_substateT) max,         \
-                 (symbolS *) 0, (long) (n), (char *) 0);               \
+                 (symbolS *) 0, (offsetT) (n), (char *) 0);            \
     *p = 0x90;                                                         \
     goto around;                                                       \
   }
index ec92ca2..8d2b508 100644 (file)
@@ -218,7 +218,7 @@ struct m68k_it
     {
       int fragoff;             /* Where in the current opcode the frag ends */
       symbolS *fadd;
-      long foff;
+      offsetT foff;
       int fragty;
     }
   fragb[4];
@@ -265,6 +265,12 @@ static struct m68k_it the_ins;     /* the instruction being assembled */
 
 #define addword(w)     the_ins.opcode[the_ins.numo++]=(w)
 
+/* Static functions.  */
+
+static void insop PARAMS ((int, struct m68k_incant *));
+static void add_fix PARAMS ((int, struct m68k_exp *, int, int));
+static void add_frag PARAMS ((symbolS *, offsetT, int));
+
 /* Like addword, but goes BEFORE general operands */
 static void
 insop (w, opcode)
@@ -286,7 +292,7 @@ insop (w, opcode)
    Blecch.  */
 static void
 add_fix (width, exp, pc_rel, pc_fix)
-     char width;
+     int width;
      struct m68k_exp *exp;
      int pc_rel;
      int pc_fix;
@@ -316,9 +322,9 @@ add_fix (width, exp, pc_rel, pc_fix)
 
    ADD becomes the FR_SYMBOL field of the frag, and OFF the FR_OFFSET.  */
 static void
-add_frag(add,off,type)
+add_frag (add, off, type)
      symbolS *add;
-     long off;
+     offsetT off;
      int type;
 {
   the_ins.fragb[the_ins.nfrag].fragoff=the_ins.numo;
@@ -332,6 +338,10 @@ add_frag(add,off,type)
 
 static char *crack_operand PARAMS ((char *str, struct m68k_op *opP));
 static int get_num PARAMS ((struct m68k_exp *exp, int ok));
+static void m68k_ip PARAMS ((char *));
+static void insert_reg PARAMS ((const char *, int));
+static void select_control_regs PARAMS ((void));
+static void init_regtable PARAMS ((void));
 static int reverse_16_bits PARAMS ((int in));
 static int reverse_8_bits PARAMS ((int in));
 static void install_gen_operand PARAMS ((int mode, int val));
@@ -359,6 +369,8 @@ 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;
 
@@ -536,7 +548,10 @@ const pseudo_typeS md_pseudo_table[] =
 /* The mote pseudo ops are put into the opcode table, since they
    don't start with a . they look like opcodes to gas.
    */
-extern void obj_coff_section ();
+
+#ifdef M68KCOFF
+extern void obj_coff_section PARAMS ((int));
+#endif
 
 CONST pseudo_typeS mote_pseudo_table[] =
 {
@@ -2450,15 +2465,15 @@ m68k_ip (instring)
              if (subs (&opP->disp))
                {
                  add_fix ('l', &opP->disp, 1, 0);
-                 add_frag ((symbolS *) 0, (long) 0, TAB (FBRANCH, LONG));
+                 add_frag ((symbolS *) 0, (offsetT) 0, TAB (FBRANCH, LONG));
                }
              else if (adds (&opP->disp))
                add_frag (adds (&opP->disp), offs (&opP->disp),
                          TAB (FBRANCH, SZ_UNDEF));
              else
                {
-                 /* add_frag((symbolS *) 0, offs(&opP->disp),
-                    TAB(FBRANCH,SHORT)); */
+                 /* add_frag ((symbolS *) 0, offs (&opP->disp),
+                              TAB(FBRANCH,SHORT)); */
                  the_ins.opcode[the_ins.numo - 1] |= 0x40;
                  add_fix ('l', &opP->disp, 1, 0);
                  addword (0);
@@ -3061,7 +3076,7 @@ crack_operand (str, opP)
 
 void
 insert_reg (regname, regnum)
-     char *regname;
+     const char *regname;
      int regnum;
 {
   char buf[100];
@@ -3871,7 +3886,6 @@ md_atof (type, litP, sizeP)
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
   LITTLENUM_TYPE *wordP;
   char *t;
-  char *atof_ieee ();
 
   switch (type)
     {
@@ -4767,7 +4781,6 @@ get_num (exp, ok)
 }
 
 /* These are the back-ends for the various machine dependent pseudo-ops.  */
-void demand_empty_rest_of_line ();     /* Hate those extra verbose names */
 
 static void
 s_data1 (ignore)
index c593656..d9b87dc 100644 (file)
@@ -1299,7 +1299,7 @@ s_bss ()
 
          symbolP->sy_frag  = frag_now;
          p = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
-                       temp, (char *)0);
+                       (offsetT) temp, (char *)0);
          *p = 0;
          S_SET_SEGMENT (symbolP, SEG_BSS);
 
index 650122a..5a92c24 100644 (file)
@@ -1577,7 +1577,7 @@ append_insn (place, ip, address_expr, reloc_type, unmatched_hi)
                                          & INSN_UNCOND_BRANCH_DELAY),
                                         (prev_insn_reloc_type
                                          == BFD_RELOC_MIPS16_JMP)),
-                   make_expr_symbol (address_expr), (long) 0,
+                   make_expr_symbol (address_expr), (offsetT) 0,
                    (char *) NULL);
     }
   else if (place != NULL)
@@ -2792,8 +2792,12 @@ load_register (counter, reg, ep, dbl)
                    || ! ep->X_unsigned
                    || sizeof (ep->X_add_number) > 4
                    || (ep->X_add_number & 0x80000000) == 0))
-              || ((mips_isa < 3 || !dbl)
-                  && (ep->X_add_number &~ (offsetT) 0xffffffff) == 0))
+              || ((mips_isa < 3 || ! dbl)
+                  && (ep->X_add_number &~ (offsetT) 0xffffffff) == 0)
+              || (mips_isa < 3
+                  && ! dbl
+                  && ((ep->X_add_number &~ (offsetT) 0xffffffff)
+                      == ~ (offsetT) 0xffffffff)))
        {
          /* 32 bit values require an lui.  */
          macro_build ((char *) NULL, counter, ep, "lui", "t,u", reg,
@@ -3051,7 +3055,7 @@ load_address (counter, reg, ep)
                       "t,r,j", reg, GP, (int) BFD_RELOC_MIPS_GPREL);
          p = frag_var (rs_machine_dependent, 8, 0,
                        RELAX_ENCODE (4, 8, 0, 4, 0, mips_warn_about_macros),
-                       ep->X_add_symbol, (long) 0, (char *) NULL);
+                       ep->X_add_symbol, (offsetT) 0, (char *) NULL);
        }
       macro_build_lui (p, counter, ep, reg);
       if (p != NULL)
@@ -3080,7 +3084,7 @@ load_address (counter, reg, ep)
       macro_build ((char *) NULL, counter, (expressionS *) NULL, "nop", "");
       p = frag_var (rs_machine_dependent, 4, 0,
                    RELAX_ENCODE (0, 4, -8, 0, 0, mips_warn_about_macros),
-                   ep->X_add_symbol, (long) 0, (char *) NULL);
+                   ep->X_add_symbol, (offsetT) 0, (char *) NULL);
       macro_build (p, counter, ep,
                   mips_isa < 3 ? "addiu" : "daddiu",
                   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
@@ -3127,7 +3131,7 @@ load_address (counter, reg, ep)
       p = frag_var (rs_machine_dependent, 12 + off, 0,
                    RELAX_ENCODE (12, 12 + off, off, 8 + off, 0,
                                  mips_warn_about_macros),
-                   ep->X_add_symbol, (long) 0, (char *) NULL);
+                   ep->X_add_symbol, (offsetT) 0, (char *) NULL);
       if (off > 0)
        {
          /* We need a nop before loading from $gp.  This special
@@ -3922,7 +3926,7 @@ macro (ip)
              p = frag_var (rs_machine_dependent, 8, 0,
                            RELAX_ENCODE (4, 8, 0, 4, 0,
                                          mips_warn_about_macros),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
            }
          macro_build_lui (p, &icnt, &offset_expr, tempreg);
@@ -3986,7 +3990,7 @@ macro (ip)
                                          (breg == 0
                                           ? mips_warn_about_macros
                                           : 0)),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
              if (breg == 0)
                {
@@ -4010,7 +4014,7 @@ macro (ip)
                           "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16);
              (void) frag_var (rs_machine_dependent, 0, 0,
                               RELAX_ENCODE (0, 0, -12, -4, 0, 0),
-                              offset_expr.X_add_symbol, (long) 0,
+                              offset_expr.X_add_symbol, (offsetT) 0,
                               (char *) NULL);
            }
          else
@@ -4053,7 +4057,7 @@ macro (ip)
                           "d,v,t", tempreg, tempreg, AT);
              (void) frag_var (rs_machine_dependent, 0, 0,
                               RELAX_ENCODE (0, 0, -16 + off1, -8, 0, 0),
-                              offset_expr.X_add_symbol, (long) 0,
+                              offset_expr.X_add_symbol, (offsetT) 0,
                               (char *) NULL);
              used_at = 1;
            }
@@ -4136,7 +4140,7 @@ macro (ip)
                                          (breg == 0
                                           ? mips_warn_about_macros
                                           : 0)),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
            }
          else if (expr1.X_add_number >= -0x8000
@@ -4153,7 +4157,7 @@ macro (ip)
                                          (breg == 0
                                           ? mips_warn_about_macros
                                           : 0)),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
            }
          else
@@ -4204,7 +4208,7 @@ macro (ip)
                                          (breg == 0
                                           ? mips_warn_about_macros
                                           : 0)),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
 
              used_at = 1;
@@ -4370,7 +4374,8 @@ macro (ip)
                           "nop", "");
              p = frag_var (rs_machine_dependent, 4, 0,
                            RELAX_ENCODE (0, 4, -8, 0, 0, 0),
-                           offset_expr.X_add_symbol, (long) 0, (char *) NULL);
+                           offset_expr.X_add_symbol, (offsetT) 0,
+                           (char *) NULL);
            }
          else
            {
@@ -4394,7 +4399,8 @@ macro (ip)
              p = frag_var (rs_machine_dependent, 12 + gpdel, 0,
                            RELAX_ENCODE (16, 12 + gpdel, gpdel, 8 + gpdel,
                                          0, 0),
-                           offset_expr.X_add_symbol, (long) 0, (char *) NULL);
+                           offset_expr.X_add_symbol, (offsetT) 0,
+                           (char *) NULL);
              if (gpdel > 0)
                {
                  macro_build (p, &icnt, (expressionS *) NULL, "nop", "");
@@ -4648,7 +4654,7 @@ macro (ip)
                                RELAX_ENCODE (4, 8, 0, 4, 0,
                                              (mips_warn_about_macros
                                               || (used_at && mips_noat))),
-                               offset_expr.X_add_symbol, (long) 0,
+                               offset_expr.X_add_symbol, (offsetT) 0,
                                (char *) NULL);
                  used_at = 0;
                }
@@ -4673,7 +4679,7 @@ macro (ip)
                               treg, (int) BFD_RELOC_MIPS_GPREL, tempreg);
                  p = frag_var (rs_machine_dependent, 12, 0,
                                RELAX_ENCODE (8, 12, 0, 8, 0, 0),
-                               offset_expr.X_add_symbol, (long) 0,
+                               offset_expr.X_add_symbol, (offsetT) 0,
                                (char *) NULL);
                }
              macro_build_lui (p, &icnt, &offset_expr, tempreg);
@@ -4718,7 +4724,7 @@ macro (ip)
          macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
          p = frag_var (rs_machine_dependent, 4, 0, 
                        RELAX_ENCODE (0, 4, -8, 0, 0, 0),
-                       offset_expr.X_add_symbol, (long) 0,
+                       offset_expr.X_add_symbol, (offsetT) 0,
                        (char *) NULL);
          macro_build (p, &icnt, &offset_expr,
                       mips_isa < 3 ? "addiu" : "daddiu",
@@ -4772,7 +4778,7 @@ macro (ip)
                       tempreg);
          p = frag_var (rs_machine_dependent, 12 + gpdel, 0,
                        RELAX_ENCODE (12, 12 + gpdel, gpdel, 8 + gpdel, 0, 0),
-                       offset_expr.X_add_symbol, (long) 0, (char *) NULL);
+                       offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL);
          if (gpdel > 0)
            {
              macro_build (p, &icnt, (expressionS *) NULL, "nop", "");
@@ -5115,7 +5121,7 @@ macro (ip)
              p = frag_var (rs_machine_dependent, 12 + off, 0,
                            RELAX_ENCODE (8 + off, 12 + off, 0, 4 + off, 1,
                                          used_at && mips_noat),
-                           offset_expr.X_add_symbol, (long) 0,
+                           offset_expr.X_add_symbol, (offsetT) 0,
                            (char *) NULL);
 
              /* We just generated two relocs.  When tc_gen_reloc
@@ -5207,7 +5213,7 @@ macro (ip)
 
          (void) frag_var (rs_machine_dependent, 0, 0,
                           RELAX_ENCODE (0, 0, -16 - off, -8, 1, 0),
-                          offset_expr.X_add_symbol, (long) 0,
+                          offset_expr.X_add_symbol, (offsetT) 0,
                           (char *) NULL);
        }
       else if (mips_pic == SVR4_PIC)
@@ -5277,7 +5283,7 @@ macro (ip)
          p = frag_var (rs_machine_dependent, 16 + gpdel + off, 0,
                        RELAX_ENCODE (24 + off, 16 + gpdel + off, gpdel,
                                      8 + gpdel + off, 1, 0),
-                       offset_expr.X_add_symbol, (long) 0,
+                       offset_expr.X_add_symbol, (offsetT) 0,
                        (char *) NULL);
          if (gpdel > 0)
            {
index 7d3fa15..161f83b 100644 (file)
@@ -53,6 +53,8 @@ symbolS abs_symbol;
 struct obstack notes;
 
 static void fb_label_init PARAMS ((void));
+static long dollar_label_instance PARAMS ((long));
+static long fb_label_instance PARAMS ((long));
 
 /* symbol_new()
   
@@ -206,7 +208,7 @@ colon (sym_name)            /* just seen "x:" - rattle symbols & frags */
                              possible_bytes,
                              (relax_substateT) 0,
                              (symbolS *) broken_words,
-                             0L,
+                             (offsetT) 0,
                              NULL);
 
       /* We want to store the pointer to where to insert the jump table in the
@@ -917,7 +919,7 @@ dollar_label_defined (label)
   return 0;
 }                              /* dollar_label_defined() */
 
-static int 
+static long
 dollar_label_instance (label)
      long label;
 {
@@ -1489,9 +1491,6 @@ indent ()
 
 #endif
 
-void print_expr_1 PARAMS ((FILE *, expressionS *));
-void print_symbol_value_1 PARAMS ((FILE *, symbolS *));
-
 void
 print_symbol_value_1 (file, sym)
      FILE *file;