summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2006-11-28 14:09:50 +0000
committerKazu Hirata <kazu@codesourcery.com>2006-11-28 14:09:50 +0000
commitb01cb0cf698c5ad89f150b930f9bec11a7e1b578 (patch)
tree05ec59db687487b475d4d4c0b99ebfb7d42664ec
parent6c0a3f4b46b6b6834db7fd084dc39e29391c972c (diff)
downloadbinutils-redhat-b01cb0cf698c5ad89f150b930f9bec11a7e1b578.tar.gz
bfd/
* elf32-m68k.c (elf32_m68k_object_p, elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to extract architecture mask. binutils/ * readelf.c (get_machine_flags): Use EF_M68K_ARCH_MASK to extract architecture mask. include/elf/ * m68k.h (EF_M68K_ARCH_MASK): New.
-rw-r--r--ChangeLog.csl14
-rw-r--r--bfd/elf32-m68k.c107
-rw-r--r--binutils/readelf.c10
-rw-r--r--include/elf/m68k.h6
4 files changed, 81 insertions, 56 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index e234c243ab..2bcf2f94fe 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,17 @@
+2006-11-28 Kazu Hirata <kazu@codesourcery.com>
+
+ bfd/
+ * elf32-m68k.c (elf32_m68k_object_p,
+ elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to
+ extract architecture mask.
+
+ binutils/
+ * readelf.c (get_machine_flags): Use EF_M68K_ARCH_MASK to
+ extract architecture mask.
+
+ include/elf/
+ * m68k.h (EF_M68K_ARCH_MASK): New.
+
2006-11-19 Nathan Sidwell <nathan@codesourcery.com>
opcodes/
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index daea4bdbfd..f1a47c44a3 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -441,11 +441,13 @@ elf32_m68k_object_p (bfd *abfd)
unsigned features = 0;
flagword eflags = elf_elfheader (abfd)->e_flags;
- if (eflags & EF_M68K_M68000)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
features |= m68000;
- else if (eflags & EF_M68K_CPU32)
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
features |= cpu32;
- else if (eflags & EF_M68K_CF_ISA_MASK)
+ else if (((eflags & EF_M68K_ARCH_MASK) == 0
+ && (eflags & EF_M68K_CF_ISA_MASK) != 0)
+ || (eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
{
switch (eflags & EF_M68K_CF_ISA_MASK)
{
@@ -560,58 +562,61 @@ elf32_m68k_print_private_bfd_data (abfd, ptr)
/* xgettext:c-format */
fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
- if (eflags & EF_M68K_CPU32)
- fprintf (file, " [cpu32]");
-
- if (eflags & EF_M68K_M68000)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
fprintf (file, " [m68000]");
-
- if (eflags & EF_M68K_CFV4E)
- fprintf (file, " [cfv4e]");
-
- if (eflags & EF_M68K_CF_ISA_MASK)
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
+ fprintf (file, " [cpu32]");
+ else if (((eflags & EF_M68K_ARCH_MASK) == 0
+ && (eflags & EF_M68K_CF_ISA_MASK) != 0)
+ || (eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
{
- char const *isa = _("unknown");
- char const *mac = _("unknown");
- char const *additional = "";
-
- switch (eflags & EF_M68K_CF_ISA_MASK)
- {
- case EF_M68K_CF_ISA_A_NODIV:
- isa = "A";
- additional = " [nodiv]";
- break;
- case EF_M68K_CF_ISA_A:
- isa = "A";
- break;
- case EF_M68K_CF_ISA_A_PLUS:
- isa = "A+";
- break;
- case EF_M68K_CF_ISA_B_NOUSP:
- isa = "B";
- additional = " [nousp]";
- break;
- case EF_M68K_CF_ISA_B:
- isa = "B";
- break;
- }
- fprintf (file, " [isa %s]%s", isa, additional);
- if (eflags & EF_M68K_CF_FLOAT)
- fprintf (file, " [float]");
- switch (eflags & EF_M68K_CF_MAC_MASK)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
+ fprintf (file, " [cfv4e]");
+
+ if (eflags & EF_M68K_CF_ISA_MASK)
{
- case 0:
- mac = NULL;
- break;
- case EF_M68K_CF_MAC:
- mac = "mac";
- break;
- case EF_M68K_CF_EMAC:
- mac = "emac";
- break;
+ char const *isa = _("unknown");
+ char const *mac = _("unknown");
+ char const *additional = "";
+
+ switch (eflags & EF_M68K_CF_ISA_MASK)
+ {
+ case EF_M68K_CF_ISA_A_NODIV:
+ isa = "A";
+ additional = " [nodiv]";
+ break;
+ case EF_M68K_CF_ISA_A:
+ isa = "A";
+ break;
+ case EF_M68K_CF_ISA_A_PLUS:
+ isa = "A+";
+ break;
+ case EF_M68K_CF_ISA_B_NOUSP:
+ isa = "B";
+ additional = " [nousp]";
+ break;
+ case EF_M68K_CF_ISA_B:
+ isa = "B";
+ break;
+ }
+ fprintf (file, " [isa %s]%s", isa, additional);
+ if (eflags & EF_M68K_CF_FLOAT)
+ fprintf (file, " [float]");
+ switch (eflags & EF_M68K_CF_MAC_MASK)
+ {
+ case 0:
+ mac = NULL;
+ break;
+ case EF_M68K_CF_MAC:
+ mac = "mac";
+ break;
+ case EF_M68K_CF_EMAC:
+ mac = "emac";
+ break;
+ }
+ if (mac)
+ fprintf (file, " [%s]", mac);
}
- if (mac)
- fprintf (file, " [%s]", mac);
}
fputc ('\n', file);
diff --git a/binutils/readelf.c b/binutils/readelf.c
index f11cad417e..2d0e5df13e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1946,11 +1946,13 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
break;
case EM_68K:
- if (e_flags & EF_M68K_CPU32)
- strcat (buf, ", cpu32");
- if (e_flags & EF_M68K_M68000)
+ if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
strcat (buf, ", m68000");
- if (e_flags & EF_M68K_CF_ISA_MASK)
+ else if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
+ strcat (buf, ", cpu32");
+ else if (((e_flags & EF_M68K_ARCH_MASK) == 0
+ && (e_flags & EF_M68K_CF_ISA_MASK) != 0)
+ || (e_flags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
{
char const *isa = _("unknown");
char const *mac = _("unknown mac");
diff --git a/include/elf/m68k.h b/include/elf/m68k.h
index 4bc365321a..3665d72453 100644
--- a/include/elf/m68k.h
+++ b/include/elf/m68k.h
@@ -52,12 +52,16 @@ START_RELOC_NUMBERS (elf_m68k_reloc_type)
RELOC_NUMBER (R_68K_GNU_VTENTRY, 24)
END_RELOC_NUMBERS (R_68K_max)
+/* We use the top 24 bits to encode information about the
+ architecture variant. */
#define EF_M68K_CPU32 0x00810000
#define EF_M68K_M68000 0x01000000
#define EF_M68K_CFV4E 0x00008000
+#define EF_M68K_ARCH_MASK (EF_M68K_M68000 | EF_M68K_CPU32 | EF_M68K_CFV4E)
/* We use the bottom 8 bits to encode information about the
- coldfire variant. */
+ coldfire variant. If we use any of these bits, the top 24 bits are
+ either 0 or EF_M68K_CFV4E. */
#define EF_M68K_CF_ISA_MASK 0x0F /* Which ISA */
#define EF_M68K_CF_ISA_A_NODIV 0x01 /* ISA A except for div */
#define EF_M68K_CF_ISA_A 0x02