This is the mail archive of the binutils@sourceware.org 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]

Re: [parisc-linux] [patch] Remove magic constant from gas/tc-hppa.c


Le samedi 21 octobre 2006 Ã 15:44 -0400, John David Anglin a Ãcrit :
> > I opted for eliminating the DEFAULT_LEVEL because it's not clear at a
> > glance what it's a level of, it's only used in that one place, and the
> > construct isn't used in any of the other architectures.
> 
> See pa_level.  The magic numbers end up in the .o files.  The hpux
> linker will issue errors and warnings if you try to link an inconsistent
> set of object files.  The values appear in various places such as
> bfd/archures.c, bfd/libhppa.h, ...

Sorry, I don't mean that the magic number is only used in that one
place, rather that the constant DEFAULT_LEVEL is only used in that one
place.  pa_level just uses the magic numbers directly (as fixed by the
updated patch):


2006-10-21  Jeff Bailey  <jbailey@raspberryginger.com>

        * config/tc-hppa.c: Do not define DEFAULT_LEVEL.
        (need_pa11_opcode): Use bfd_mach_hppa11 instead of pa11 for
        consistency.
        (pa_level): Use defines from bfd.h instead of magic numbers.
        (md_begin): Use defines from bfd.h instead of DEFAULT_LEVEL.



--
Jeff Bailey - http://www.raspberryginger.com/jbailey/
Index: config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.132
diff -u -p -r1.132 tc-hppa.c
--- config/tc-hppa.c	7 Jun 2006 11:27:57 -0000	1.132
+++ config/tc-hppa.c	21 Oct 2006 20:45:11 -0000
@@ -105,12 +105,6 @@ typedef som_symbol_type obj_symbol_type;
 #endif
 #endif /* OBJ_SOM */
 
-#if TARGET_ARCH_SIZE == 64
-#define DEFAULT_LEVEL 25
-#else
-#define DEFAULT_LEVEL 10
-#endif
-
 /* Various structures and types used internally in tc-hppa.c.  */
 
 /* Unwind table and descriptor.  FIXME: Sync this with GDB version.  */
@@ -2273,7 +2267,7 @@ need_pa11_opcode (void)
 	 then set a new architecture.  */
       if (bfd_get_mach (stdoutput) < pa11)
 	{
-	  if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, pa11))
+	  if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, bfd_mach_hppa11))
 	    as_warn (_("could not update architecture and machine"));
 	}
       return TRUE;
@@ -6834,25 +6828,25 @@ pa_level (int unused ATTRIBUTE_UNUSED)
   if (strncmp (level, "1.0", 3) == 0)
     {
       input_line_pointer += 3;
-      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 10))
+      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, bfd_mach_hppa10))
 	as_warn (_("could not set architecture and machine"));
     }
   else if (strncmp (level, "1.1", 3) == 0)
     {
       input_line_pointer += 3;
-      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 11))
+      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, bfd_mach_hppa11))
 	as_warn (_("could not set architecture and machine"));
     }
   else if (strncmp (level, "2.0w", 4) == 0)
     {
       input_line_pointer += 4;
-      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 25))
+      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, bfd_mach_hppa20w))
 	as_warn (_("could not set architecture and machine"));
     }
   else if (strncmp (level, "2.0", 3) == 0)
     {
       input_line_pointer += 3;
-      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 20))
+      if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, bfd_mach_hppa20))
 	as_warn (_("could not set architecture and machine"));
     }
   else
@@ -8257,9 +8251,14 @@ md_begin (void)
 
   last_call_info = NULL;
   call_info_root = NULL;
+  unsigned long mach = bfd_mach_hppa10;
+
+#if TARGET_ARCH_SIZE == 64
+  mach = bfd_mach_hppa20w;
+#endif 
 
   /* Set the default machine type.  */
-  if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, DEFAULT_LEVEL))
+  if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, mach))
     as_warn (_("could not set architecture and machine"));
 
   /* Folding of text and data segments fails miserably on the PA.

Attachment: signature.asc
Description: Ceci est une partie de message=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


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