* elf32-m68k.c (elf32_m68k_object_p,
	elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to
	extract architecture mask.

include/elf/
	* m68k.h (EF_M68K_ARCH_MASK): New.
This commit is contained in:
Kazu Hirata 2006-12-19 13:24:56 +00:00
parent 8a0d8a5c46
commit 425c6cb00d
5 changed files with 82 additions and 58 deletions

View File

@ -1,3 +1,9 @@
2006-12-19 Kazu Hirata <kazu@codesourcery.com>
* elf32-m68k.c (elf32_m68k_object_p,
elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to
extract architecture mask.
2006-12-19 Nathan Sidwell <nathan@codesourcery.com>
* elf.c (assign_file_positions_for_load_sections): Adjust p_vaddr

View File

@ -429,11 +429,11 @@ 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
{
switch (eflags & EF_M68K_CF_ISA_MASK)
{
@ -518,8 +518,17 @@ elf32_m68k_merge_private_bfd_data (ibfd, obfd)
else
{
out_flags = elf_elfheader (obfd)->e_flags;
in_isa = (in_flags & EF_M68K_CF_ISA_MASK);
out_isa = (out_flags & EF_M68K_CF_ISA_MASK);
unsigned int variant_mask;
if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
variant_mask = 0;
else if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
variant_mask = 0;
else
variant_mask = EF_M68K_CF_ISA_MASK;
in_isa = (in_flags & variant_mask);
out_isa = (out_flags & variant_mask);
if (in_isa > out_isa)
out_flags ^= in_isa ^ out_isa;
out_flags |= in_flags ^ in_isa;
@ -548,58 +557,59 @@ 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
{
char const *isa = _("unknown");
char const *mac = _("unknown");
char const *additional = "";
if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
fprintf (file, " [cfv4e]");
if (eflags & EF_M68K_CF_ISA_MASK)
{
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;
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);
}
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);
}
fputc ('\n', file);

View File

@ -2012,11 +2012,11 @@ 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
{
char const *isa = _("unknown");
char const *mac = _("unknown mac");

View File

@ -1,3 +1,7 @@
2006-12-19 Kazu Hirata <kazu@codesourcery.com>
* m68k.h (EF_M68K_ARCH_MASK): New.
2006-12-19 Nathan Sidwell <nathan@codesourcery.com>
* internal.h (struct elf_segment_map): Add p_vaddr_offset field.

View File

@ -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