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]

Replace more numbers with bfd_mach_*


More tidying of places where a number is used in place of a bfd_mach
define, and a small change to coff_write_relocs that should, along
with some gas changes, allow the absolute section sym to be removed.

Index: bfd/ChangeLog
===================================================================
RCS file: /cvs/src/src/bfd/ChangeLog,v
retrieving revision 1.1695
diff -u -p -r1.1695 ChangeLog
--- bfd/ChangeLog	2 Sep 2002 05:58:55 -0000	1.1695
+++ bfd/ChangeLog	2 Sep 2002 11:41:29 -0000
@@ -1,7 +1,22 @@
 2002-09-02  Alan Modra  <amodra@bigpond.net.au>
 
+	* ecoff.c (_bfd_ecoff_set_arch_mach_hook): Don't use hard-coded
+	bfd_mach constants.
+	(ecoff_get_magic): Likewise.
+	* elf32-v850.c (v850_elf_object_p): Likewise.
+	(v850_elf_final_write_processing): Likewise.
+	* mipsbsd.c (MY(set_arch_mach)): Likewise.
+	(MY(write_object_contents)): Likewise.
+	* coff64-rs6000.c (xcoff64_write_object_contents): Likewise.
+	* coffcode.h (coff_write_object_contents): Likewise.
+	(coff_set_arch_mach_hook): Add comment describing machine == 0.
+	Remove unnecessary "machine" assignments.
+	(coff_write_relocs): Test for the absolute section sym by testing
+	section and flags.
+
 	* aoutx.h (NAME(aout,machine_type)): Recognize bfd_mach_i386_i386
 	and bfd_mach_i386_i386_intel_syntax.
+	* pdp11.c (NAME(aout,machine_type)): Likewise.
 
Index: bfd/coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.40
diff -u -p -r1.40 coff64-rs6000.c
--- bfd/coff64-rs6000.c	22 Aug 2002 05:13:04 -0000	1.40
+++ bfd/coff64-rs6000.c	2 Sep 2002 11:30:44 -0000
@@ -1014,7 +1014,7 @@ xcoff64_write_object_contents (abfd)
 	      internal_a.o_cputype = 4;
 	      break;
 	    case bfd_arch_powerpc:
-	      if (bfd_get_mach (abfd) == 0)
+	      if (bfd_get_mach (abfd) == bfd_mach_ppc)
 		internal_a.o_cputype = 3;
 	      else
 		internal_a.o_cputype = 1;
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.81
diff -u -p -r1.81 coffcode.h
--- bfd/coffcode.h	26 Aug 2002 09:01:41 -0000	1.81
+++ bfd/coffcode.h	2 Sep 2002 11:30:47 -0000
@@ -1824,6 +1824,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
   enum bfd_architecture arch;
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
 
+  /* Zero selects the default machine for an arch.  */
   machine = 0;
   switch (internal_f->f_magic)
     {
@@ -1831,13 +1832,11 @@ coff_set_arch_mach_hook (abfd, filehdr)
     case OR32_MAGIC_BIG:
     case OR32_MAGIC_LITTLE:
       arch = bfd_arch_or32;
-      machine = 0;
       break;
 #endif
 #ifdef PPCMAGIC
     case PPCMAGIC:
       arch = bfd_arch_powerpc;
-      machine = 0; /* what does this mean? (krk) */
       break;
 #endif
 #ifdef I386MAGIC
@@ -1846,20 +1845,17 @@ coff_set_arch_mach_hook (abfd, filehdr)
     case I386AIXMAGIC:		/* Danbury PS/2 AIX C Compiler */
     case LYNXCOFFMAGIC:	/* shadows the m68k Lynx number below, sigh */
       arch = bfd_arch_i386;
-      machine = 0;
       break;
 #endif
 #ifdef IA64MAGIC
     case IA64MAGIC:
       arch = bfd_arch_ia64;
-      machine = 0;
       break;
 #endif
 #ifdef A29K_MAGIC_BIG
     case A29K_MAGIC_BIG:
     case A29K_MAGIC_LITTLE:
       arch = bfd_arch_a29k;
-      machine = 0;
       break;
 #endif
 #ifdef ARMMAGIC
@@ -2044,7 +2040,6 @@ coff_set_arch_mach_hook (abfd, filehdr)
 #ifdef WE32KMAGIC
     case WE32KMAGIC:
       arch = bfd_arch_we32k;
-      machine = 0;
       break;
 #endif
 
@@ -2082,21 +2077,18 @@ coff_set_arch_mach_hook (abfd, filehdr)
     case SH_ARCH_MAGIC_WINCE:
 #endif
       arch = bfd_arch_sh;
-      machine = 0;
       break;
 #endif
 
 #ifdef MIPS_ARCH_MAGIC_WINCE
     case MIPS_ARCH_MAGIC_WINCE:
       arch = bfd_arch_mips;
-      machine = 0;
       break;
 #endif
 
 #ifdef H8500MAGIC
     case H8500MAGIC:
       arch = bfd_arch_h8500;
-      machine = 0;
       break;
 #endif
 
@@ -2106,7 +2098,6 @@ coff_set_arch_mach_hook (abfd, filehdr)
     case LYNXCOFFMAGIC:
 #endif
       arch = bfd_arch_sparc;
-      machine = 0;
       break;
 #endif
 
@@ -2462,7 +2453,8 @@ coff_write_relocs (abfd, first_undef)
 #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
                 if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
 #else
-		if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr)
+		if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr
+		    && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0)
 #endif
 		  /* This is a relocation relative to the absolute symbol.  */
 		  n.r_symndx = -1;
@@ -4116,7 +4108,7 @@ coff_write_object_contents (abfd)
 	      internal_a.o_cputype = 4;
 	      break;
 	    case bfd_arch_powerpc:
-	      if (bfd_get_mach (abfd) == 0)
+	      if (bfd_get_mach (abfd) == bfd_mach_ppc)
 		internal_a.o_cputype = 3;
 	      else
 		internal_a.o_cputype = 1;
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.19
diff -u -p -r1.19 ecoff.c
--- bfd/ecoff.c	30 Jul 2002 05:49:24 -0000	1.19
+++ bfd/ecoff.c	2 Sep 2002 11:30:52 -0000
@@ -205,21 +205,21 @@ _bfd_ecoff_set_arch_mach_hook (abfd, fil
     case MIPS_MAGIC_LITTLE:
     case MIPS_MAGIC_BIG:
       arch = bfd_arch_mips;
-      mach = 3000;
+      mach = bfd_mach_mips3000;
       break;
 
     case MIPS_MAGIC_LITTLE2:
     case MIPS_MAGIC_BIG2:
       /* MIPS ISA level 2: the r6000.  */
       arch = bfd_arch_mips;
-      mach = 6000;
+      mach = bfd_mach_mips6000;
       break;
 
     case MIPS_MAGIC_LITTLE3:
     case MIPS_MAGIC_BIG3:
       /* MIPS ISA level 3: the r4000.  */
       arch = bfd_arch_mips;
-      mach = 4000;
+      mach = bfd_mach_mips4000;
       break;
 
     case ALPHA_MAGIC:
@@ -252,17 +252,17 @@ ecoff_get_magic (abfd)
 	{
 	default:
 	case 0:
-	case 3000:
+	case bfd_mach_mips3000:
 	  big = MIPS_MAGIC_BIG;
 	  little = MIPS_MAGIC_LITTLE;
 	  break;
 
-	case 6000:
+	case bfd_mach_mips6000:
 	  big = MIPS_MAGIC_BIG2;
 	  little = MIPS_MAGIC_LITTLE2;
 	  break;
 
-	case 4000:
+	case bfd_mach_mips4000:
 	  big = MIPS_MAGIC_BIG3;
 	  little = MIPS_MAGIC_LITTLE3;
 	  break;
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.25
diff -u -p -r1.25 elf32-v850.c
--- bfd/elf32-v850.c	29 Aug 2002 06:49:33 -0000	1.25
+++ bfd/elf32-v850.c	2 Sep 2002 11:30:57 -0000
@@ -1848,8 +1848,12 @@ v850_elf_object_p (abfd)
   switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
     {
     default:
-    case E_V850_ARCH:   (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, 0); break;
-    case E_V850E_ARCH:  (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); break;
+    case E_V850_ARCH:
+      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850);
+      break;
+    case E_V850E_ARCH:
+      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e);
+      break;
     }
   return true;
 }
@@ -1865,9 +1869,9 @@ v850_elf_final_write_processing (abfd, l
 
   switch (bfd_get_mach (abfd))
     {
-    default:
-    case 0: val = E_V850_ARCH; break;
-    case bfd_mach_v850e:  val = E_V850E_ARCH; break;
+    default:		 
+    case bfd_mach_v850:  val = E_V850_ARCH; break;
+    case bfd_mach_v850e: val = E_V850E_ARCH; break;
     }
 
   elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
Index: bfd/mipsbsd.c
===================================================================
RCS file: /cvs/src/src/bfd/mipsbsd.c,v
retrieving revision 1.8
diff -u -p -r1.8 mipsbsd.c
--- bfd/mipsbsd.c	2 Oct 2001 05:58:41 -0000	1.8
+++ bfd/mipsbsd.c	2 Sep 2002 11:30:57 -0000
@@ -91,12 +91,12 @@ MY(set_arch_mach) (abfd, machtype)
     {
     case M_MIPS1:
       arch = bfd_arch_mips;
-      machine = 3000;
+      machine = bfd_mach_mips3000;
       break;
 
     case M_MIPS2:
       arch = bfd_arch_mips;
-      machine = 4000;
+      machine = bfd_mach_mips4000;
       break;
 
     default:
@@ -164,8 +164,8 @@ MY (write_object_contents) (abfd)
     case bfd_arch_mips:
       switch (bfd_get_mach (abfd))
 	{
-	case 4000:
-	case 6000:
+	case bfd_mach_mips4000:
+	case bfd_mach_mips6000:
 	  N_SET_MACHTYPE (*execp, M_MIPS2);
 	  break;
 	default:
Index: bfd/pdp11.c
===================================================================
RCS file: /cvs/src/src/bfd/pdp11.c,v
retrieving revision 1.14
diff -u -p -r1.14 pdp11.c
--- bfd/pdp11.c	25 Jun 2002 06:21:54 -0000	1.14
+++ bfd/pdp11.c	2 Sep 2002 11:31:01 -0000
@@ -955,7 +955,10 @@ NAME(aout,machine_type) (arch, machine, 
       break;
 
     case bfd_arch_i386:
-      if (machine == 0)	arch_flags = M_386;
+      if (machine == 0
+	  || machine == bfd_mach_i386_i386
+	  || machine == bfd_mach_i386_i386_intel_syntax)
+	arch_flags = M_386;
       break;
 
     case bfd_arch_a29k:


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