This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Clean up previous patch


Hi

The attached patch sorts out a few small problems I introduced with my
last patch a month ago
(http://sources.redhat.com/ml/binutils/2004-05/msg00450.html). I would
have fixed it before now, but I have been busy.

It removes some redundant code which was left in tc-sh.c by mistake. The
-isa option used to accept a limited number of architecture names. I
expanded this to accept all architecture names (and the *_up variants)
by using the table, but never removed the old tests from the if-else
chain. This should have no externally visible effects whatsoever.

It silences some harmless warnings:

* isspace was implicitly defined in tc-sh.c . I have changed isspace to
ISSPACE which is preferred anyway. I'm not sure whether the two variants
do exactly the same thing, but it seems to work OK.

* sh_get_bfd_mach_from_arch_set and sh_merge_bfd_arch were implicitly
defined in elf32-sh.c . I have included sh-opc.h to pull in the
prototypes. I have also updated the dependencies in the makefiles.

* const was being cast away in two places in tc-sh.c. The const keyword
has been inserted in the right places.

The patch doesn't do anything really dangerous, but I have still tested
it with 'make check'  on sh-elf, sh64-elf and sh-coff.

-- 
Andrew Stubbs
SuperH (UK) Ltd.
2004-06-30  Andrew Stubbs <andrew.stubbs@superh.com>

	bfd:
	* elf32-sh.c: Include ../opcodes/sh-opc.h .
	* Makefile.am: Ran make dep-am .
	* Makefile.in: Ran make dep-in .

	gas:
	* config/tc-sh.c (md_assemble): Change isspace to ISSPACE.
	(md_parse_option): Remove redundant -isa testing.
	Make bfd_arch variable const.
	(md_show_usage): Make bfd_arch variable const.

Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.137
diff -u -p -r1.137 Makefile.am
--- bfd/Makefile.am	28 May 2004 12:32:01 -0000	1.137
+++ bfd/Makefile.am	30 Jun 2004 09:56:57 -0000
@@ -908,7 +908,8 @@ syms.lo: syms.c $(INCDIR)/filenames.h $(
   $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
 targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
   targmatch.h
-hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h
+hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+  $(INCDIR)/libiberty.h
 linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   genlink.h
 srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
@@ -1294,7 +1295,8 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/fi
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
   elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
-  $(INCDIR)/libiberty.h elf32-target.h
+  $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
+  elf32-target.h
 elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
@@ -1306,7 +1308,8 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/fi
 elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
-  $(INCDIR)/libiberty.h elf32-target.h
+  $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
+  elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
Index: bfd/Makefile.in
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.in,v
retrieving revision 1.150
diff -u -p -r1.150 Makefile.in
--- bfd/Makefile.in	28 May 2004 12:32:01 -0000	1.150
+++ bfd/Makefile.in	30 Jun 2004 09:56:58 -0000
@@ -1441,7 +1441,8 @@ syms.lo: syms.c $(INCDIR)/filenames.h $(
   $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
 targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
   targmatch.h
-hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h
+hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+  $(INCDIR)/libiberty.h
 linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   genlink.h
 srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
@@ -1827,7 +1828,8 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/fi
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
   elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
-  $(INCDIR)/libiberty.h elf32-target.h
+  $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
+  elf32-target.h
 elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
@@ -1839,7 +1841,8 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/fi
 elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
-  $(INCDIR)/libiberty.h elf32-target.h
+  $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
+  elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -2186,7 +2189,3 @@ pepigen.lo: pepigen.c $(INCDIR)/filename
   $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
   libcoff.h $(INCDIR)/bfdlink.h libpei.h
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.108
diff -u -p -r1.108 elf32-sh.c
--- bfd/elf32-sh.c	29 Jun 2004 13:46:32 -0000	1.108
+++ bfd/elf32-sh.c	30 Jun 2004 09:56:58 -0000
@@ -26,6 +26,7 @@
 #include "elf-bfd.h"
 #include "elf/sh.h"
 #include "libiberty.h"
+#include "../opcodes/sh-opc.h"
 
 static bfd_reloc_status_type sh_elf_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.99
diff -u -p -r1.99 tc-sh.c
--- gas/config/tc-sh.c	28 May 2004 12:32:04 -0000	1.99
+++ gas/config/tc-sh.c	30 Jun 2004 09:56:59 -0000
@@ -2631,11 +2631,11 @@ md_assemble (char *str)
       int found = 0;
 
       /* identify opcode in string */
-      while (isspace (*name))
+      while (ISSPACE (*name))
 	{
 	  name++;
 	}
-      while (!isspace (name[name_length]))
+      while (!ISSPACE (name[name_length]))
 	{
 	  name_length++;
 	}
@@ -2945,15 +2945,7 @@ md_parse_option (int c, char *arg ATTRIB
       break;
 
     case OPTION_ISA:
-      if (strcasecmp (arg, "sh4") == 0)
-	preset_target_arch = arch_sh4;
-      else if (strcasecmp (arg, "sh4-nofpu") == 0)
-	preset_target_arch = arch_sh4_nofpu;
-      else if (strcasecmp (arg, "sh4-nommu-nofpu") == 0)
-	preset_target_arch = arch_sh4_nommu_nofpu;
-      else if (strcasecmp (arg, "sh4a") == 0)
-	preset_target_arch = arch_sh4a;
-      else if (strcasecmp (arg, "dsp") == 0)
+      if (strcasecmp (arg, "dsp") == 0)
 	preset_target_arch = arch_sh1_up & ~(arch_sh_sp_fpu|arch_sh_dp_fpu);
       else if (strcasecmp (arg, "fp") == 0)
 	preset_target_arch = arch_sh1_up & ~arch_sh_has_dsp;
@@ -2978,8 +2970,7 @@ md_parse_option (int c, char *arg ATTRIB
       else
 	{
 	  extern const bfd_arch_info_type bfd_sh_arch;
-	  extern unsigned int sh_ef_archset_table[];
-	  bfd_arch_info_type *bfd_arch = &bfd_sh_arch;
+	  bfd_arch_info_type const *bfd_arch = &bfd_sh_arch;
 	  preset_target_arch = 0;
 	  for (; bfd_arch; bfd_arch=bfd_arch->next)
 	    {
@@ -3068,7 +3059,7 @@ SH options:\n\
     | fp"));
   {
     extern const bfd_arch_info_type bfd_sh_arch;
-    bfd_arch_info_type *bfd_arch = &bfd_sh_arch;
+    bfd_arch_info_type const *bfd_arch = &bfd_sh_arch;
     for (; bfd_arch; bfd_arch=bfd_arch->next)
       if (bfd_arch->mach != bfd_mach_sh5)
 	{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]