Re: [parisc-linux] [patch] Remove magic constant from gas/tc-hppa.c
Jeff Bailey <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils,gmane.linux.ports.hppa |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> * 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/
tc-hppa.c.diff
(text/x-patch, 2.7 KB)
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.
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQBFOpJO5M5hmdCYCpkRAnGvAKDFnBQjJieshpulPAmr5+05Q65GbQCdExnw 9qxDevduydPAVUeQXg4+lv0= =C9Hy -----END PGP SIGNATURE-----