* elf64-alpha.c (struct alpha_elf_link_hash_entry): Remove
[deliverable/binutils-gdb.git] / gas / config / tc-w65.c
index ef3f863bdd483444520050f9c14f6b05cb6cfaad..c666d56c65ef9f9c7443e6dc8c1874430cae0f0a 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-w65.c -- Assemble code for the W65816
-
-   Copyright (C) 1995 Free Software Foundation.
+   Copyright 1995, 1998, 2000, 2001, 2002, 2005
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GAS; see the file COPYING.  If not, write to
-   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
-/*
-   Written By Steve Chamberlain
-   sac@cygnus.com
- */
+/* Written By Steve Chamberlain <sac@cygnus.com>.  */
 
 #include <stdio.h>
 #include "as.h"
 #include "subsegs.h"
 #define DEFINE_TABLE
 #include "../opcodes/w65-opc.h"
-#include <ctype.h>
 
-const char comment_chars[] = "!";
-CONST char line_separator_chars[] = ";";
-const char line_comment_chars[] = "!#";
+const char comment_chars[]        = "!";
+const char line_separator_chars[] = ";";
+const char line_comment_chars[]   = "!#";
 
 /* This table describes all the machine specific pseudo-ops the assembler
    has to support.  The fields are:
+
    pseudo-op name without dot
    function to call to execute this pseudo-op
-   Integer arg to pass to the function
- */
+   Integer arg to pass to the function.  */
 
 #define OP_BCC 0x90
 #define OP_BCS 0xB0
@@ -53,7 +50,35 @@ const char line_comment_chars[] = "!#";
 #define OP_BVC 0x50
 #define OP_BVS 0x70
 
-void s_longa ();
+static int M;                          /* M flag.  */
+static int X;                          /* X flag.  */
+
+/* This function is called once, at assembler startup time.  This
+   should set up all the tables, etc that the MD part of the assembler
+   needs.  */
+
+static void
+s_longa (int xmode)
+{
+  int *p = xmode ? &X : &M;
+
+  while (*input_line_pointer == ' ')
+    input_line_pointer++;
+  if (strncmp (input_line_pointer, "on", 2) == 0)
+    {
+      input_line_pointer += 2;
+      *p = 0;
+    }
+  else if (strncmp (input_line_pointer, "off", 3) == 0)
+    {
+      *p = 1;
+      input_line_pointer += 3;
+    }
+  else
+    as_bad (_("need on or off."));
+  demand_empty_rest_of_line ();
+}
+
 const pseudo_typeS md_pseudo_table[] =
 {
   {"int", cons, 2},
@@ -63,89 +88,63 @@ const pseudo_typeS md_pseudo_table[] =
   {0, 0, 0}
 };
 
-
-void cons ();
-void s_align_bytes ();
-
-
-/*int md_reloc_size; */
-
-static int relax;              /* set if -relax seen */
-
 const char EXP_CHARS[] = "eE";
 
-/* Chars that mean this number is a floating point constant */
+/* Chars that mean this number is a floating point constant */
 /* As in 0f12.456 */
 /* or    0d1.2345e12 */
 const char FLT_CHARS[] = "rRsSfFdDxXpP";
 
+/* Opcode mnemonics */
+static struct hash_control *opcode_hash_control;
 
+#define C(a, b)                    ENCODE_RELAX(a,b)
+#define ENCODE_RELAX(what, length) (((what) << 2) + (length))
 
-static struct hash_control *opcode_hash_control;       /* Opcode mnemonics */
-
-int M;                         /* M flag */
-int X;                         /* X flag */
-
-
-
+#define GET_WHAT(x) (((x) >> 2))
 
-#define C(a,b) ENCODE_RELAX(a,b)
-#define ENCODE_RELAX(what,length) (((what) << 2) + (length))
-
-#define GET_WHAT(x) ((x>>2))
-
-#define BYTE_DISP 1
-#define WORD_DISP 2
+#define BYTE_DISP       1
+#define WORD_DISP       2
 #define UNDEF_BYTE_DISP 0
 #define UNDEF_WORD_DISP 3
-
 #define COND_BRANCH    1
 #define UNCOND_BRANCH   2
-#define END    3
+#define END            3
 
-#define BYTE_F 127             /* How far we can branch forwards */
-#define BYTE_B -126            /* How far we can branch backwards */
+#define BYTE_F 127     /* How far we can branch forwards.  */
+#define BYTE_B -126    /* How far we can branch backwards.  */
 #define WORD_F 32767
 #define WORD_B 32768
 
-relax_typeS md_relax_table[C (END, 0)];
-
-/*
-   This function is called once, at assembler startup time.  This should
-   set up all the tables, etc that the MD part of the assembler needs
- */
-
-
-void
-s_longa (xmode)
+relax_typeS md_relax_table[C (END, 0)] =
 {
-  int *p = xmode ? &X : &M;
-  while (*input_line_pointer == ' ')
-    input_line_pointer++;
-  if (strncmp (input_line_pointer, "on", 2) == 0)
-    {
-      input_line_pointer += 2;
-      *p = 0;
-    }
-  else if (strncmp (input_line_pointer, "off", 3) == 0)
-    {
-      *p = 1;
-      input_line_pointer += 3;
-    }
-  else
-    as_bad ("need on or off.");
-  demand_empty_rest_of_line ();
-}
+  { 0, 0, 0, 0 },
+  { 0, 0, 0, 0 },
+  { 0, 0, 0, 0 },
+  { 0, 0, 0, 0 },
+
+  /* COND_BRANCH */
+  { 0,       0,       0,  0 },                         /* UNDEF_BYTE_DISP */
+  { BYTE_F,  BYTE_B,  2,  C (COND_BRANCH, WORD_DISP) },        /* BYTE_DISP */
+  { WORD_F,  WORD_B,  5,  0 },                         /* WORD_DISP */
+  { 0,       0,       5,  0 },                         /* UNDEF_WORD_DISP */
+
+  /* UNCOND_BRANCH */
+  { 0,       0,       0,  0 },                           /* UNDEF_BYTE_DISP */
+  { BYTE_F,  BYTE_B,  2,  C (UNCOND_BRANCH, WORD_DISP) }, /* BYTE_DISP */
+  { WORD_F,  WORD_B,  3,  0 },                           /* WORD_DISP */
+  { 0,       0,       3,  0 }                            /* UNDEF_WORD_DISP */
+};
+
 void
-md_begin ()
+md_begin (void)
 {
-  relax_typeS *table;
-  struct opinfo *opcode;
+  const struct opinfo *opcode;
   char *prev_name = "";
 
   opcode_hash_control = hash_new ();
 
-  /* Insert unique names into hash table */
+  /* Insert unique names into hash table */
   for (opcode = optable; opcode->name; opcode++)
     {
       if (strcmp (prev_name, opcode->name))
@@ -153,67 +152,19 @@ md_begin ()
          prev_name = opcode->name;
          hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
        }
-      else
-       {
-         /* Make all the opcodes with the same name point to the same
-            string */
-         opcode->name = prev_name;
-       }
     }
 
-
-  /* Initialize the relax table.  We use a local variable to avoid
-     warnings about modifying a supposedly const data structure.  */
-  table = (relax_typeS *) md_relax_table;
-  table[C (COND_BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
-  table[C (COND_BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
-  table[C (COND_BRANCH, BYTE_DISP)].rlx_length = 2;
-  table[C (COND_BRANCH, BYTE_DISP)].rlx_more = C (COND_BRANCH, WORD_DISP);
-
-  table[C (COND_BRANCH, WORD_DISP)].rlx_forward = WORD_F;
-  table[C (COND_BRANCH, WORD_DISP)].rlx_backward = WORD_B;
-  table[C (COND_BRANCH, WORD_DISP)].rlx_length = 5;
-  table[C (COND_BRANCH, WORD_DISP)].rlx_more = 0;
-
-  table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
-  table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
-  table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_length = 2;
-  table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_more = C (UNCOND_BRANCH, WORD_DISP);
-
-  table[C (UNCOND_BRANCH, WORD_DISP)].rlx_forward = WORD_F;
-  table[C (UNCOND_BRANCH, WORD_DISP)].rlx_backward = WORD_B;
-  table[C (UNCOND_BRANCH, WORD_DISP)].rlx_length = 3;
-  table[C (UNCOND_BRANCH, WORD_DISP)].rlx_more = 0;
-
   flag_signed_overflow_ok = 1;
 }
 
-static expressionS immediate;  /* absolute expression */
-static expressionS immediate1; /* absolute expression */
-
-
-static symbolS *
-dot ()
-{
-  const char *fake;
-
-  /* JF: '.' is pseudo symbol with value of current location
-     in current segment.  */
-  fake = FAKE_LABEL_NAME;
-  return symbol_new (fake,
-                    now_seg,
-                    (valueT) frag_now_fix (),
-                    frag_now);
-
-}
-
+static expressionS immediate;  /* Absolute expression.  */
+static expressionS immediate1; /* Absolute expression.  */
 int expr_size;
 int expr_shift;
 int tc_cons_reloc;
+
 void
-w65_expression (dest, bytes)
-     expressionS *dest;
-     unsigned int bytes;
+w65_expression (expressionS *dest)
 {
   expr_size = 0;
   expr_shift = 0;
@@ -241,34 +192,29 @@ w65_expression (dest, bytes)
 }
 
 int amode;
-static
-char *
-parse_exp (s, bytes)
-     char *s;
-     int bytes;
+
+static char *
+parse_exp (char *s)
 {
   char *save;
   char *new;
 
   save = input_line_pointer;
   input_line_pointer = s;
-  w65_expression (&immediate, bytes);
+  w65_expression (&immediate);
   if (immediate.X_op == O_absent)
-    as_bad ("missing operand");
+    as_bad (_("missing operand"));
   new = input_line_pointer;
   input_line_pointer = save;
   return new;
 }
 
-
-static
-char *
-get_operands (info, ptr)
-     struct opinfo *info;
-     char *ptr;
+static char *
+get_operands (const struct opinfo *info, char *ptr)
 {
-  register int override_len = 0;
-  register int bytes = 0;
+  int override_len = 0;
+  int bytes = 0;
+
   while (*ptr == ' ')
     ptr++;
 
@@ -317,9 +263,7 @@ get_operands (info, ptr)
              ptr += 2;
            }
          else
-           {
-             as_bad ("syntax error after <exp");
-           }
+           as_bad (_("syntax error after <exp"));
        }
       else
        {
@@ -360,9 +304,7 @@ get_operands (info, ptr)
              bytes = 2;
            }
          else
-           {
-             as_bad ("syntax error after <exp");
-           }
+           as_bad (_("syntax error after <exp"));
        }
       else
        {
@@ -371,9 +313,7 @@ get_operands (info, ptr)
        }
     }
   else if (ptr[0] == 'a')
-    {
-      amode = ADDR_ACC;
-    }
+    amode = ADDR_ACC;
   else if (ptr[0] == '(')
     {
       /* Look for (exp),y
@@ -406,9 +346,8 @@ get_operands (info, ptr)
          ptr++;
        }
       else
-       {
-         override_len = 0;
-       }
+       override_len = 0;
+
       ptr = parse_exp (ptr);
 
       if (ptr[0] == ',')
@@ -429,7 +368,8 @@ get_operands (info, ptr)
                  bytes = 2;
                }
            }
-         else if (ptr[0] == 's' && ptr[1] == ')' && ptr[2] == ',' && ptr[3] == 'y')
+         else if (ptr[0] == 's' && ptr[1] == ')'
+                  && ptr[2] == ',' && ptr[3] == 'y')
            {
              amode = ADDR_STACK_REL_INDX_IDX;
              bytes = 1;
@@ -457,14 +397,13 @@ get_operands (info, ptr)
                  bytes = 2;
                }
              ptr++;
-
            }
        }
-
     }
   else if (ptr[0] == '[')
     {
       ptr = parse_exp (ptr + 1);
+
       if (ptr[0] == ']')
        {
          ptr++;
@@ -476,23 +415,22 @@ get_operands (info, ptr)
            }
          else
            {
-             if (info->code == O_jmp) 
+             if (info->code == O_jmp)
                {
-               bytes = 2;
-               amode = ADDR_ABS_IND_LONG;
-             } 
-             else 
-{
-               bytes = 1;
-             
-               amode = ADDR_DIR_IND_LONG;
-             }
+                 bytes = 2;
+                 amode = ADDR_ABS_IND_LONG;
+               }
+             else
+               {
+                 bytes = 1;
+                 amode = ADDR_DIR_IND_LONG;
+               }
            }
        }
     }
   else
     {
-      ptr = parse_exp (ptr, 2);
+      ptr = parse_exp (ptr);
       if (ptr[0] == ',')
        {
          if (ptr[1] == 'y')
@@ -576,9 +514,9 @@ get_operands (info, ptr)
        {
        case 0:
          if (amode == ADDR_DIR)
-       tc_cons_reloc = R_W65_DP;
+           tc_cons_reloc = R_W65_DP;
          else
-tc_cons_reloc = R_W65_ABS8;
+           tc_cons_reloc = R_W65_ABS8;
          break;
        case 1:
          tc_cons_reloc = R_W65_ABS8S8;
@@ -607,48 +545,24 @@ tc_cons_reloc = R_W65_ABS8;
 
 /* Passed a pointer to a list of opcodes which use different
    addressing modes, return the opcode which matches the opcodes
-   provided
- */
+   provided.  */
 
-static
-struct opinfo *
-get_specific (opcode)
-     struct opinfo *opcode;
+static const struct opinfo *
+get_specific (const struct opinfo *opcode)
 {
   int ocode = opcode->code;
 
   for (; opcode->code == ocode; opcode++)
-    {
-      if (opcode->amode == amode)
-       return opcode;
-    }
-  return 0;
-}
+    if (opcode->amode == amode)
+      return opcode;
 
-int
-check (operand, low, high)
-     expressionS *operand;
-     int low;
-     int high;
-{
-  if (operand->X_op != O_constant
-      || operand->X_add_number < low
-      || operand->X_add_number > high)
-    {
-      as_bad ("operand must be absolute in range %d..%d", low, high);
-    }
-  return operand->X_add_number;
+  return 0;
 }
 
+/* Now we know what sort of opcodes it is, let's build the bytes.  */
 
-static int log2[] =
-{0, 0, 1, 0, 2};
-
-/* Now we know what sort of opcodes it is, lets build the bytes -
- */
 static void
-build_Mytes (opcode)
-     struct opinfo *opcode;
+build_Mytes (const struct opinfo *opcode)
 {
   int size;
   int type;
@@ -656,13 +570,13 @@ build_Mytes (opcode)
   char *output;
 
   if (opcode->amode == ADDR_IMPLIED)
-    {
-      output = frag_more (1);
-    }
+    output = frag_more (1);
+
   else if (opcode->amode == ADDR_PC_REL)
     {
       int type;
-      /* This is a relaxable insn, so we do some special handling */
+
+      /* This is a relaxable insn, so we do some special handling.  */
       type = opcode->val == OP_BRA ? UNCOND_BRANCH : COND_BRANCH;
       output = frag_var (rs_machine_dependent,
                         md_relax_table[C (type, WORD_DISP)].rlx_length,
@@ -677,23 +591,21 @@ build_Mytes (opcode)
       switch (opcode->amode)
        {
          GETINFO (size, type, pcrel);
+       default:
+         abort ();
        }
 
-      /* If something special was done in the
-        expression modify the reloc type */
+      /* If something special was done in the expression modify the
+        reloc type.  */
       if (tc_cons_reloc)
-       {
-         type = tc_cons_reloc;
-       }
-
-
+       type = tc_cons_reloc;
 
-      /* 1 byte for the opcode + the bytes for the addrmode */
+      /* 1 byte for the opcode + the bytes for the addrmode */
       output = frag_more (size + 1);
 
       if (opcode->amode == ADDR_BLOCK_MOVE)
        {
-         /* Two relocs for this one */
+         /* Two relocs for this one */
          fix_new_exp (frag_now,
                       output + 1 - frag_now->fr_literal,
                       1,
@@ -724,27 +636,21 @@ build_Mytes (opcode)
   output[0] = opcode->val;
 }
 
-/* This is the guts of the machine-dependent assembler.  STR points to a
-   machine dependent instruction.  This function is supposed to emit
-   the frags/bytes it assembles to.
- */
+/* This is the guts of the machine-dependent assembler.  STR points to
+   a machine dependent instruction.  This function is supposed to emit
+   the frags/bytes it assembles to.  */
 
 void
-md_assemble (str)
-     char *str;
+md_assemble (char *str)
 {
-  unsigned char *op_start;
-  unsigned char *op_end;
-  struct opinfo *opcode;
+  const struct opinfo *opcode;
   char name[20];
-  int nlen = 0;
-  char *p;
 
   /* Drop leading whitespace */
   while (*str == ' ')
     str++;
 
-  /* all opcodes are three letters */
+  /* All opcodes are three letters.  */
   name[0] = str[0];
   name[1] = str[1];
   name[2] = str[2];
@@ -756,7 +662,7 @@ md_assemble (str)
 
   if (opcode == NULL)
     {
-      as_bad ("unknown opcode");
+      as_bad (_("unknown opcode"));
       return;
     }
 
@@ -769,61 +675,41 @@ md_assemble (str)
 
   if (opcode == 0)
     {
-      /* Couldn't find an opcode which matched the operands */
-
+      /* Couldn't find an opcode which matched the operands.  */
 
       char *where = frag_more (1);
 
       where[0] = 0x0;
       where[1] = 0x0;
-      as_bad ("invalid operands for opcode");
+      as_bad (_("invalid operands for opcode"));
       return;
     }
 
   build_Mytes (opcode);
 }
 
-
-void
-DEFUN (tc_crawl_symbol_chain, (headers),
-       object_headers * headers)
-{
-  printf ("call to tc_crawl_symbol_chain \n");
-}
-
 symbolS *
-DEFUN (md_undefined_symbol, (name),
-       char *name)
+md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
-void
-DEFUN (tc_headers_hook, (headers),
-       object_headers * headers)
-{
-  printf ("call to tc_headers_hook \n");
-}
-
-/* Various routines to kill one day */
-/* Equal to MAX_PRECISION in atof-ieee.c */
+/* Various routines to kill one day.  */
+/* Equal to MAX_PRECISION in atof-ieee.c.  */
 #define MAX_LITTLENUMS 6
 
-/* Turn a string in input_line_pointer into a floating point constant of type
-   type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
-   emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
- */
+/* Turn a string in input_line_pointer into a floating point constant
+   of type TYPE, and store the appropriate bytes in *LITP.  The number
+   of LITTLENUMS emitted is stored in *SIZEP.  An error message is
+   returned, or NULL on OK.  */
+
 char *
-md_atof (type, litP, sizeP)
-     char type;
-     char *litP;
-     int *sizeP;
+md_atof (int type, char *litP, int *sizeP)
 {
   int prec;
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
   LITTLENUM_TYPE *wordP;
   char *t;
-  char *atof_ieee ();
 
   switch (type)
     {
@@ -853,7 +739,7 @@ md_atof (type, litP, sizeP)
 
     default:
       *sizeP = 0;
-      return "Bad call to MD_NTOF()";
+      return _("Bad call to MD_NTOF()");
     }
   t = atof_ieee (input_line_pointer, type, words);
   if (t)
@@ -869,57 +755,23 @@ md_atof (type, litP, sizeP)
 }
 
 int
-md_parse_option (c,a)
-    int c;
-    char *a;
-
-{
-  return 1;
-}
-
-int md_short_jump_size;
-
-void
-tc_Nout_fix_to_chars ()
-{
-  printf ("call to tc_Nout_fix_to_chars \n");
-  abort ();
-}
-
-void
-md_create_short_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol)
-     char *ptr;
-     addressT from_Nddr;
-     addressT to_Nddr;
-     fragS *frag;
-     symbolS *to_symbol;
-{
-  as_fatal ("failed sanity check.");
-}
-
-void
-md_create_long_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol)
-     char *ptr;
-     addressT from_Nddr, to_Nddr;
-     fragS *frag;
-     symbolS *to_symbol;
+md_parse_option (int c ATTRIBUTE_UNUSED, char *a ATTRIBUTE_UNUSED)
 {
-  as_fatal ("failed sanity check.");
+  return 0;
 }
 
+/* Called after relaxing, change the frags so they know how big they
+   are.  */
 
-/*
-called after relaxing, change the frags so they know how big they are
-*/
 void
-md_convert_frag (headers, fragP)
-     object_headers *headers;
-     fragS *fragP;
-
+md_convert_frag (object_headers *headers ATTRIBUTE_UNUSED,
+                segT seg ATTRIBUTE_UNUSED,
+                fragS *fragP)
 {
   int disp_size = 0;
   int inst_size = 0;
-  unsigned char *buffer = (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+  unsigned char *buffer =
+    (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
 
   switch (fragP->fr_subtype)
     {
@@ -929,7 +781,7 @@ md_convert_frag (headers, fragP)
       inst_size = 1;
       break;
 
-      /* cond branches to a known 16 bit displacement */
+      /* Conditional branches to a known 16 bit displacement.  */
     case C (COND_BRANCH, WORD_DISP):
       switch (buffer[0])
        {
@@ -941,9 +793,9 @@ md_convert_frag (headers, fragP)
        case OP_BPL:
        case OP_BVS:
        case OP_BVC:
-         /* Invert the sense of the test */
+         /* Invert the sense of the test */
          buffer[0] ^= 0x20;
-         buffer[1] = 3;        /* Jump over following brl */
+         buffer[1] = 3;        /* Jump over following brl */
          buffer[2] = OP_BRL;
          buffer[3] = 0;
          buffer[4] = 0;
@@ -955,7 +807,7 @@ md_convert_frag (headers, fragP)
        }
       break;
     case C (UNCOND_BRANCH, WORD_DISP):
-      /* Unconditional branches to a known 16 bit displacement */
+      /* Unconditional branches to a known 16 bit displacement */
 
       switch (buffer[0])
        {
@@ -968,9 +820,9 @@ md_convert_frag (headers, fragP)
          abort ();
        }
       break;
-      /* got to create a branch over a reloc here */
+      /* Got to create a branch over a reloc here.  */
     case C (COND_BRANCH, UNDEF_WORD_DISP):
-      buffer[0] ^= 0x20;       /* invert test */
+      buffer[0] ^= 0x20;       /* Invert test.  */
       buffer[1] = 3;
       buffer[2] = OP_BRL;
       buffer[3] = 0;
@@ -1006,34 +858,30 @@ md_convert_frag (headers, fragP)
     }
   if (inst_size)
     {
-      /* Get the address of the end of the instruction */
-      int next_inst = fragP->fr_fix + fragP->fr_address + disp_size + inst_size;
+      /* Get the address of the end of the instruction.  */
+      int next_inst = (fragP->fr_fix + fragP->fr_address
+                      + disp_size + inst_size);
       int targ_addr = (S_GET_VALUE (fragP->fr_symbol) +
                       fragP->fr_offset);
       int disp = targ_addr - next_inst;
 
-      md_number_to_chars (buffer + inst_size, disp, disp_size);
+      md_number_to_chars ((char *) buffer + inst_size, disp, disp_size);
       fragP->fr_fix += disp_size + inst_size;
       fragP->fr_var = 0;
     }
 }
 
-
 valueT
-DEFUN (md_section_align, (seg, size),
-       segT seg AND
-       valueT size)
+md_section_align (segT seg, valueT size)
 {
   return ((size + (1 << section_alignment[(int) seg]) - 1)
          & (-1 << section_alignment[(int) seg]));
-
 }
 
 void
-md_apply_fix (fixP, val)
-     fixS *fixP;
-     long val;
+md_apply_fix3 (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
 {
+  long val = * (long *) valP;
   char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
   int addr = fixP->fx_frag->fr_address + fixP->fx_where;
 
@@ -1082,47 +930,41 @@ md_apply_fix (fixP, val)
     default:
       abort ();
     }
-}
 
-int md_long_jump_size;
+  if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+    fixP->fx_done = 1;
+}
 
-/* Put number into target byte order */
+/* Put number into target byte order */
 
 void
-md_number_to_chars (ptr, use, nbytes)
-     char *ptr;
-     valueT use;
-     int nbytes;
+md_number_to_chars (char *ptr, valueT use, int nbytes)
 {
   number_to_chars_littleendian (ptr, use, nbytes);
 }
 
 long
-md_pcrel_from (fixP)
-     fixS *fixP;
+md_pcrel_from (fixS *fixP)
 {
   int gap = fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address - 1;
   return gap;
 }
 
 void
-tc_coff_symbol_emit_hook (x)
-    struct symbol *x;
+tc_coff_symbol_emit_hook (symbolS *x ATTRIBUTE_UNUSED)
 {
 }
 
 short
-tc_coff_fix2rtype (fix_ptr)
-     fixS *fix_ptr;
+tc_coff_fix2rtype (fixS *fix_ptr)
 {
   return fix_ptr->fx_r_type;
 }
 
 void
-tc_reloc_mangle (fix_ptr, intr, base)
-     fixS *fix_ptr;
-     struct internal_reloc *intr;
-     bfd_vma base;
+tc_reloc_mangle (fixS *fix_ptr,
+                struct internal_reloc *intr,
+                bfd_vma base)
 
 {
   symbolS *symbol_ptr;
@@ -1133,8 +975,7 @@ tc_reloc_mangle (fix_ptr, intr, base)
      to output it */
   if (fix_ptr->fx_r_type == RELOC_32)
     {
-      /* cons likes to create reloc32's whatever the size of the reloc..
-       */
+      /* Cons likes to create reloc32's whatever the size of the reloc.  */
       switch (fix_ptr->fx_size)
        {
        case 2:
@@ -1170,76 +1011,70 @@ tc_reloc_mangle (fix_ptr, intr, base)
          intr->r_symndx = dot->sy_number;
        }
       else
-       {
-         intr->r_symndx = symbol_ptr->sy_number;
-       }
+       intr->r_symndx = symbol_ptr->sy_number;
     }
   else
-    {
-      intr->r_symndx = -1;
-    }
+    intr->r_symndx = -1;
 }
 
 int
-tc_coff_sizemachdep (frag)
-     fragS *frag;
+tc_coff_sizemachdep (fragS *frag)
 {
   return md_relax_table[frag->fr_subtype].rlx_length;
 }
 
+/* Called just before address relaxation, return the length by which a
+   fragment must grow to reach it's destination.  */
 
-
-
-
-/*
-called just before address relaxation, return the length
-by which a fragment must grow to reach it's destination
-*/
 int
-md_estimate_size_before_relax (fragP, segment_type)
-     register fragS *fragP;
-     register segT segment_type;
+md_estimate_size_before_relax (fragS *fragP, segT segment_type)
 {
-  int what = GET_WHAT (fragP->fr_subtype);
+  int what;
 
   switch (fragP->fr_subtype)
     {
     default:
       abort ();
+
     case C (COND_BRANCH, UNDEF_BYTE_DISP):
     case C (UNCOND_BRANCH, UNDEF_BYTE_DISP):
-      /* used to be a branch to somewhere which was unknown */
+      what = GET_WHAT (fragP->fr_subtype);
+      /* Used to be a branch to somewhere which was unknown.  */
       if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
-       {
-         /* Got a symbol and it's defined in this segment, become byte
-        sized - maybe it will fix up */
-         fragP->fr_subtype = C (what, BYTE_DISP);
-         fragP->fr_var = md_relax_table[C (what, BYTE_DISP)].rlx_length;
-       }
+       /* Got a symbol and it's defined in this segment, become byte
+          sized - maybe it will fix up.  */
+       fragP->fr_subtype = C (what, BYTE_DISP);
       else
-       {
-         /* Its got a segment, but its not ours, so it will always be long */
-         fragP->fr_subtype = C (what, UNDEF_WORD_DISP);
-         fragP->fr_var = md_relax_table[C (what, WORD_DISP)].rlx_length;
-         return md_relax_table[C (what, WORD_DISP)].rlx_length;
-       }
+       /* Its got a segment, but its not ours, so it will always be
+          long.  */
+       fragP->fr_subtype = C (what, UNDEF_WORD_DISP);
+      break;
+
+    case C (COND_BRANCH, BYTE_DISP):
+    case C (COND_BRANCH, WORD_DISP):
+    case C (COND_BRANCH, UNDEF_WORD_DISP):
+    case C (UNCOND_BRANCH, BYTE_DISP):
+    case C (UNCOND_BRANCH, WORD_DISP):
+    case C (UNCOND_BRANCH, UNDEF_WORD_DISP):
+      /* When relaxing a section for the second time, we don't need to
+        do anything besides return the current size.  */
+      break;
     }
+
+  fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
   return fragP->fr_var;
 }
 
-
-
-CONST char *md_shortopts = "";
-struct option md_longopts[] = {
+const char *md_shortopts = "";
+struct option md_longopts[] =
+{
 #define OPTION_RELAX (OPTION_MD_BASE)
   {NULL, no_argument, NULL, 0}
 };
 
 void
-md_show_usage (stream)
-     FILE *stream;
+md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
 {
-
 }
 
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
This page took 0.035353 seconds and 4 git commands to generate.