From e08ae97912972aa69b9860deebf29b0f2c84de4a Mon Sep 17 00:00:00 2001
From: Hans-Peter Nilsson <hp@axis.com>
Date: Sat, 15 Sep 2001 14:49:54 +0000
Subject: [PATCH] 	* config/tc-sh.h (sh_force_relocation): Prototype. 
 (struct fix): Forward declare. 	* config/tc-sh.c (type
 sh_operand_info): Move to top of file. 	(cons, s_align_bytes): Remove
 old-type declarations. 	(sh_elf_suffix, parse_reg, dot, parse_exp,
 parse_at, get_operand, 	get_operands, get_specific, insert,
 build_relax, 	insert_loop_bounds, build_Mytes): Prototype. 	(little): Make
 static.  Prototype. 	(check, tc_Nout_fix_to_chars): Delete unused
 functions.

---
 gas/ChangeLog      | 12 ++++++++++
 gas/config/tc-sh.c | 58 ++++++++++++++++++++--------------------------
 gas/config/tc-sh.h |  8 ++++++-
 3 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index c40f60e4e6c..bb0677a1503 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,15 @@
+2001-09-15  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* config/tc-sh.h (sh_force_relocation): Prototype.
+	(struct fix): Forward declare.
+	* config/tc-sh.c (type sh_operand_info): Move to top of file.
+	(cons, s_align_bytes): Remove old-type declarations.
+	(sh_elf_suffix, parse_reg, dot, parse_exp, parse_at, get_operand,
+	get_operands, get_specific, insert, build_relax,
+	insert_loop_bounds, build_Mytes): Prototype.
+	(little): Make static.  Prototype.
+	(check, tc_Nout_fix_to_chars): Delete unused functions.
+
 2001-09-14  Eric Christopher  <echristo@redhat.com>
 
 	* config/tc-mips.c (md_parse_option): Remove setting mips_64 via
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index a1cb874743d..930895907d7 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -36,6 +36,14 @@
 
 #include "dwarf2dbg.h"
 
+typedef struct
+  {
+    sh_arg_type type;
+    int reg;
+    expressionS immediate;
+  }
+sh_operand_info;
+
 const char comment_chars[] = "!";
 const char line_separator_chars[] = ";";
 const char line_comment_chars[] = "!#";
@@ -45,11 +53,26 @@ static void s_uses PARAMS ((int));
 static void sh_count_relocs PARAMS ((bfd *, segT, PTR));
 static void sh_frob_section PARAMS ((bfd *, segT, PTR));
 
-void cons ();
-void s_align_bytes ();
 static void s_uacons PARAMS ((int));
 static sh_opcode_info *find_cooked_opcode PARAMS ((char **));
 static unsigned int assemble_ppi PARAMS ((char *, sh_opcode_info *));
+static void little PARAMS ((int));
+static bfd_reloc_code_real_type sh_elf_suffix
+  PARAMS ((char **str_p, expressionS *, expressionS *new_exp_p));
+static int parse_reg PARAMS ((char *, int *, int *));
+static symbolS *dot PARAMS ((void));
+static char *parse_exp PARAMS ((char *, sh_operand_info *));
+static char *parse_at PARAMS ((char *, sh_operand_info *));
+static void get_operand PARAMS ((char **, sh_operand_info *));
+static char *get_operands
+  PARAMS ((sh_opcode_info *, char *, sh_operand_info *));
+static sh_opcode_info *get_specific
+  PARAMS ((sh_opcode_info *, sh_operand_info *));
+static void insert PARAMS ((char *, int, int, sh_operand_info *));
+static void build_relax PARAMS ((sh_opcode_info *, sh_operand_info *));
+static char *insert_loop_bounds PARAMS ((char *, sh_operand_info *));
+static unsigned int build_Mytes
+  PARAMS ((sh_opcode_info *, sh_operand_info *));
 
 #ifdef OBJ_ELF
 static void sh_elf_cons PARAMS ((int));
@@ -456,14 +479,6 @@ static int reg_x, reg_y;
 static int reg_efg;
 static int reg_b;
 
-typedef struct
-  {
-    sh_arg_type type;
-    int reg;
-    expressionS immediate;
-  }
-sh_operand_info;
-
 #define IDENT_CHAR(c) (isalnum (c) || (c) == '_')
 
 /* Try to parse a reg name.  Return the number of chars consumed.  */
@@ -1381,21 +1396,6 @@ get_specific (opcode, operands)
   return 0;
 }
 
-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;
-}
-
 static void
 insert (where, how, pcrel, op)
      char *where;
@@ -1501,7 +1501,6 @@ static unsigned int
 build_Mytes (opcode, operand)
      sh_opcode_info *opcode;
      sh_operand_info *operand;
-
 {
   int index;
   char nbuf[4];
@@ -2185,13 +2184,6 @@ SH options:\n\
 -dsp			enable sh-dsp insns, and disable sh3e / sh4 insns.\n"));
 }
 
-void
-tc_Nout_fix_to_chars ()
-{
-  printf (_("call to tc_Nout_fix_to_chars \n"));
-  abort ();
-}
-
 /* This struct is used to pass arguments to sh_count_relocs through
    bfd_map_over_sections.  */
 
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index 3c8279bbb1b..ece6e4f3478 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -58,7 +58,13 @@ extern void sh_handle_align PARAMS ((fragS *));
 
 /* We need to force out some relocations when relaxing.  */
 #define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix)
-extern int sh_force_relocation ();
+
+/* The type fixS is defined (to struct fix) in write.h, but write.h uses
+   definitions from this file.  To avoid problems with including write.h
+   after the "right" definitions, don't; just forward-declare struct fix
+   here.  */
+struct fix;
+extern int sh_force_relocation PARAMS ((struct fix *));
 
 #ifdef OBJ_ELF
 #define obj_fix_adjustable(fixP) sh_fix_adjustable(fixP)