From: Nathan Sidwell Date: Mon, 6 Mar 2006 13:42:05 +0000 (+0000) Subject: bfd: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b2e31dc3b568d10386bcfc3e2c75e21a72be568;p=binutils-gdb.git bfd: * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp): New. Adjust other variants. (bfd_default_scan): Update. * bfd-in2.h: Rebuilt. * cpu-m68k.c: Adjust. (bfd_m68k_compatible): New. Use it for architectures. * elf32-m68k.c (elf32_m68k_object_p): Adjust. (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b mismatch. (elf32_m68k_print_private_bfd_data): Adjust. * ieee.c (ieee_write_processor): Adjust. binutils: * readelf.c (get_machine_flags): Adjust. gas: * config/tc-m68k.c (m68k_extensions): Allow 'float' on both m68k and cf. (m68k_ip): Check we have some control regs. (md_parse_option): Allow raw arch switch. (m68k_init_arch): Better detection of arch/cpu mismatch. Detect whether 68881 or cfloat was meant by -mfloat. (md_show_usage): Adjust extension display. (m68k_elf_final_processing): Adjust. gas/testsuite: * gas/m68k/arch-cpu-1.s: Tweak. * gas/m68k/arch-cpu-1.d: Tweak. include/elf: * m68k.h (EF_M68K_ISA_MASK, EF_M68K_ISA_A, EF_M68K_ISA_A_PLUS, EF_M68K_ISA_B, EF_M68K_ISA_C): Adjust. (EF_M68K_ISA_A_NODIV, EF_M68K_ISA_B_NOUSP): New. (EF_M68K_HW_DIV, EF_M68K_USP): Remove. (EF_M68K_MAC, EF_M68K_EMAC, EF_M68K_FLOAT): Adjust. (EF_M68K_EMAC_B): New. ld/testsuite: * ld-m68k: New tests. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 691d6c4d8ce..f0c7a8629c4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2006-03-06 Nathan Sidwell + + * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp): + New. Adjust other variants. + (bfd_default_scan): Update. + * bfd-in2.h: Rebuilt. + * cpu-m68k.c: Adjust. + (bfd_m68k_compatible): New. Use it for architectures. + * elf32-m68k.c (elf32_m68k_object_p): Adjust. + (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b + mismatch. + (elf32_m68k_print_private_bfd_data): Adjust. + * ieee.c (ieee_write_processor): Adjust. + 2006-03-06 Alan Modra * dwarf2.c: Formatting. diff --git a/bfd/archures.c b/bfd/archures.c index fc2f85ba1c0..f4080a63a46 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -80,22 +80,22 @@ DESCRIPTION .#define bfd_mach_m68040 6 .#define bfd_mach_m68060 7 .#define bfd_mach_cpu32 8 -.#define bfd_mach_mcf_isa_a 9 -.#define bfd_mach_mcf_isa_a_div 10 -.#define bfd_mach_mcf_isa_a_div_mac 11 -.#define bfd_mach_mcf_isa_a_div_emac 12 +.#define bfd_mach_mcf_isa_a_nodiv 9 +.#define bfd_mach_mcf_isa_a 10 +.#define bfd_mach_mcf_isa_a_mac 11 +.#define bfd_mach_mcf_isa_a_emac 12 .#define bfd_mach_mcf_isa_aplus 13 .#define bfd_mach_mcf_isa_aplus_mac 14 .#define bfd_mach_mcf_isa_aplus_emac 15 -.#define bfd_mach_mcf_isa_aplus_usp 16 -.#define bfd_mach_mcf_isa_aplus_usp_mac 17 -.#define bfd_mach_mcf_isa_aplus_usp_emac 18 +.#define bfd_mach_mcf_isa_b_nousp 16 +.#define bfd_mach_mcf_isa_b_nousp_mac 17 +.#define bfd_mach_mcf_isa_b_nousp_emac 18 .#define bfd_mach_mcf_isa_b 19 .#define bfd_mach_mcf_isa_b_mac 20 .#define bfd_mach_mcf_isa_b_emac 21 -.#define bfd_mach_mcf_isa_b_usp_float 22 -.#define bfd_mach_mcf_isa_b_usp_float_mac 23 -.#define bfd_mach_mcf_isa_b_usp_float_emac 24 +.#define bfd_mach_mcf_isa_b_float 22 +.#define bfd_mach_mcf_isa_b_float_mac 23 +.#define bfd_mach_mcf_isa_b_float_emac 24 . bfd_arch_vax, {* DEC Vax *} . bfd_arch_i960, {* Intel 960 *} . {* The order of the following is important. @@ -1016,23 +1016,23 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string) break; case 5200: arch = bfd_arch_m68k; - number = bfd_mach_mcf_isa_a; + number = bfd_mach_mcf_isa_a_nodiv; break; case 5206: arch = bfd_arch_m68k; - number = bfd_mach_mcf_isa_a_div_mac; + number = bfd_mach_mcf_isa_a_mac; break; case 5307: arch = bfd_arch_m68k; - number = bfd_mach_mcf_isa_a_div_mac; + number = bfd_mach_mcf_isa_a_mac; break; case 5407: arch = bfd_arch_m68k; - number = bfd_mach_mcf_isa_b_mac; + number = bfd_mach_mcf_isa_b_nousp_mac; break; case 5282: arch = bfd_arch_m68k; - number = bfd_mach_mcf_isa_b_usp_float_emac; + number = bfd_mach_mcf_isa_aplus_emac; break; case 32000: diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index cc9eb24344f..8782bf914cb 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1674,22 +1674,22 @@ enum bfd_architecture #define bfd_mach_m68040 6 #define bfd_mach_m68060 7 #define bfd_mach_cpu32 8 -#define bfd_mach_mcf_isa_a 9 -#define bfd_mach_mcf_isa_a_div 10 -#define bfd_mach_mcf_isa_a_div_mac 11 -#define bfd_mach_mcf_isa_a_div_emac 12 +#define bfd_mach_mcf_isa_a_nodiv 9 +#define bfd_mach_mcf_isa_a 10 +#define bfd_mach_mcf_isa_a_mac 11 +#define bfd_mach_mcf_isa_a_emac 12 #define bfd_mach_mcf_isa_aplus 13 #define bfd_mach_mcf_isa_aplus_mac 14 #define bfd_mach_mcf_isa_aplus_emac 15 -#define bfd_mach_mcf_isa_aplus_usp 16 -#define bfd_mach_mcf_isa_aplus_usp_mac 17 -#define bfd_mach_mcf_isa_aplus_usp_emac 18 +#define bfd_mach_mcf_isa_b_nousp 16 +#define bfd_mach_mcf_isa_b_nousp_mac 17 +#define bfd_mach_mcf_isa_b_nousp_emac 18 #define bfd_mach_mcf_isa_b 19 #define bfd_mach_mcf_isa_b_mac 20 #define bfd_mach_mcf_isa_b_emac 21 -#define bfd_mach_mcf_isa_b_usp_float 22 -#define bfd_mach_mcf_isa_b_usp_float_mac 23 -#define bfd_mach_mcf_isa_b_usp_float_emac 24 +#define bfd_mach_mcf_isa_b_float 22 +#define bfd_mach_mcf_isa_b_float_mac 23 +#define bfd_mach_mcf_isa_b_float_emac 24 bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ /* The order of the following is important. diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c index 93b60f969ba..83aaa254c1f 100644 --- a/bfd/cpu-m68k.c +++ b/bfd/cpu-m68k.c @@ -24,8 +24,12 @@ #include "libbfd.h" #include "opcode/m68k.h" +static const bfd_arch_info_type * +bfd_m68k_compatible (const bfd_arch_info_type *a, + const bfd_arch_info_type *b); + #define N(name, print,d,next) \ -{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, } +{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, } static const bfd_arch_info_type arch_info_struct[] = { @@ -39,25 +43,25 @@ static const bfd_arch_info_type arch_info_struct[] = N(bfd_mach_cpu32, "m68k:cpu32", FALSE, &arch_info_struct[8]), /* Various combinations of CF architecture features */ - N(bfd_mach_mcf_isa_a, "m68k:isa-a", + N(bfd_mach_mcf_isa_a_nodiv, "m68k:isa-a:nodiv", FALSE, &arch_info_struct[9]), - N(bfd_mach_mcf_isa_a_div, "m68k:isa-a:div", + N(bfd_mach_mcf_isa_a, "m68k:isa-a", FALSE, &arch_info_struct[10]), - N(bfd_mach_mcf_isa_a_div_mac, "m68k:isa-a:div:mac", + N(bfd_mach_mcf_isa_a_mac, "m68k:isa-a:mac", FALSE, &arch_info_struct[11]), - N(bfd_mach_mcf_isa_a_div_emac, "m68k:isa-a:div:emac", + N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac", FALSE, &arch_info_struct[12]), - N(bfd_mach_mcf_isa_aplus, "m68k:isa-a+", + N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus", FALSE, &arch_info_struct[13]), - N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-a+:mac", + N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac", FALSE, &arch_info_struct[14]), - N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-a+:emac", + N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac", FALSE, &arch_info_struct[15]), - N(bfd_mach_mcf_isa_aplus_usp, "m68k:isa-a+:usp", + N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp", FALSE, &arch_info_struct[16]), - N(bfd_mach_mcf_isa_aplus_usp_mac, "m68k:isa-a+:usp:mac", + N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac", FALSE, &arch_info_struct[17]), - N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:isa-a+:usp:emac", + N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac", FALSE, &arch_info_struct[18]), N(bfd_mach_mcf_isa_b, "m68k:isa-b", FALSE, &arch_info_struct[19]), @@ -65,28 +69,26 @@ static const bfd_arch_info_type arch_info_struct[] = FALSE, &arch_info_struct[20]), N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac", FALSE, &arch_info_struct[21]), - N(bfd_mach_mcf_isa_b_usp_float, "m68k:isa-b:usp:float", + N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float", FALSE, &arch_info_struct[22]), - N(bfd_mach_mcf_isa_b_usp_float_mac, "m68k:isa-b:usp:float:mac", + N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac", FALSE, &arch_info_struct[23]), - N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:isa-b:usp:float:emac", + N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac", FALSE, &arch_info_struct[24]), /* Legacy names for CF architectures */ - N(bfd_mach_mcf_isa_a, "m68k:5200", FALSE, &arch_info_struct[25]), - N(bfd_mach_mcf_isa_a_div_mac,"m68k:5206e", FALSE, &arch_info_struct[26]), - N(bfd_mach_mcf_isa_a_div_mac, "m68k:5307", FALSE, &arch_info_struct[27]), - N(bfd_mach_mcf_isa_b_mac, "m68k:5407", FALSE, &arch_info_struct[28]), - N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:528x", - FALSE, &arch_info_struct[29]), - N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:521x", - FALSE, &arch_info_struct[30]), - N(bfd_mach_mcf_isa_a_div_emac, "m68k:5249", FALSE, &arch_info_struct[31]), - N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:547x", + N(bfd_mach_mcf_isa_a_nodiv, "m68k:5200", FALSE, &arch_info_struct[25]), + N(bfd_mach_mcf_isa_a_mac,"m68k:5206e", FALSE, &arch_info_struct[26]), + N(bfd_mach_mcf_isa_a_mac, "m68k:5307", FALSE, &arch_info_struct[27]), + N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:5407", FALSE, &arch_info_struct[28]), + N(bfd_mach_mcf_isa_aplus_emac, "m68k:528x", FALSE, &arch_info_struct[29]), + N(bfd_mach_mcf_isa_aplus_emac, "m68k:521x", FALSE, &arch_info_struct[30]), + N(bfd_mach_mcf_isa_a_emac, "m68k:5249", FALSE, &arch_info_struct[31]), + N(bfd_mach_mcf_isa_b_float_emac, "m68k:547x", FALSE, &arch_info_struct[32]), - N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:548x", + N(bfd_mach_mcf_isa_b_float_emac, "m68k:548x", FALSE, &arch_info_struct[33]), - N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:cfv4e", FALSE, 0), + N(bfd_mach_mcf_isa_b_float_emac, "m68k:cfv4e", FALSE, 0), }; const bfd_arch_info_type bfd_m68k_arch = @@ -109,15 +111,15 @@ static const unsigned m68k_arch_features[] = mcfisa_a|mcfhwdiv, mcfisa_a|mcfhwdiv|mcfmac, mcfisa_a|mcfhwdiv|mcfemac, - mcfisa_a|mcfisa_aa|mcfhwdiv, - mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, - mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp, mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfmac, mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfemac, mcfisa_a|mcfhwdiv|mcfisa_b, mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac, mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac, + mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp, + mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|mcfmac, + mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|mcfemac, mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat, mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfmac, mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfemac, @@ -181,3 +183,36 @@ int bfd_m68k_features_to_mach (unsigned features) } return superset ? superset : subset; } + +static const bfd_arch_info_type * +bfd_m68k_compatible (const bfd_arch_info_type *a, + const bfd_arch_info_type *b) +{ + if (a->arch != b->arch) + return NULL; + + if (a->bits_per_word != b->bits_per_word) + return NULL; + + if (!a->mach) + return b; + if (!b->mach) + return a; + + if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060) + /* Merge m68k machine. */ + return a->mach > b->mach ? a : b; + else if (a->mach >= bfd_mach_mcf_isa_a_nodiv + && b->mach >= bfd_mach_mcf_isa_a_nodiv) + { + /* Merge cf machine. */ + unsigned features = (bfd_m68k_mach_to_features (a->mach) + | bfd_m68k_mach_to_features (b->mach)); + unsigned machine = bfd_m68k_features_to_mach (features); + + return bfd_lookup_arch (a->arch, machine); + } + else + /* They are incompatible. */ + return NULL; +} diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 98b0b12229a..978dbd22d94 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -390,18 +390,22 @@ elf32_m68k_object_p (bfd *abfd) { switch (eflags & EF_M68K_ISA_MASK) { - case EF_M68K_ISA_B: - features |= mcfisa_b; - /* FALLTHROUGH */ - case EF_M68K_ISA_A_PLUS: - features |= mcfisa_aa; - /* FALLTHROUGH */ - case EF_M68K_ISA_A: + case EF_M68K_ISA_A_NODIV: features |= mcfisa_a; break; + case EF_M68K_ISA_A: + features |= mcfisa_a|mcfhwdiv; + break; + case EF_M68K_ISA_A_PLUS: + features |= mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp; + break; + case EF_M68K_ISA_B_NOUSP: + features |= mcfisa_a|mcfisa_b|mcfhwdiv; + break; + case EF_M68K_ISA_B: + features |= mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp; + break; } - if (eflags & EF_M68K_HW_DIV) - features |= mcfhwdiv; switch (eflags & EF_M68K_MAC_MASK) { case EF_M68K_MAC: @@ -411,8 +415,6 @@ elf32_m68k_object_p (bfd *abfd) features |= mcfemac; break; } - if (eflags & EF_M68K_USP) - features |= mcfusp; if (eflags & EF_M68K_FLOAT) features |= cfloat; } @@ -462,7 +464,8 @@ elf32_m68k_merge_private_bfd_data (ibfd, obfd) if (in_mach > out_mach) out_mach = in_mach; } - else if (in_mach >= bfd_mach_mcf_isa_a && out_mach >= bfd_mach_mcf_isa_a) + else if (in_mach >= bfd_mach_mcf_isa_a_nodiv + && out_mach >= bfd_mach_mcf_isa_a_nodiv) /* Merge cf machine. */ out_mach = bfd_m68k_features_to_mach (bfd_m68k_mach_to_features (in_mach) @@ -483,27 +486,37 @@ elf32_m68k_merge_private_bfd_data (ibfd, obfd) } else { + flagword isa_in = in_flags & EF_M68K_ISA_MASK; + flagword isa_out = out_flags & EF_M68K_ISA_MASK; + + /* Copy legacy flags. */ out_flags |= in_flags & (EF_M68K_CPU32 | EF_M68K_M68000 | EF_M68K_CFV4E); - if (((in_flags | out_flags) & EF_M68K_ISA_MASK) + if ((isa_in | isa_out) && ((in_flags | out_flags) & (EF_M68K_CPU32 | EF_M68K_M68000))) /* Mixing m68k and cf is not allowed */ return FALSE; - if (in_flags & EF_M68K_ISA_MASK) + if (isa_in) { - if (out_flags & EF_M68K_ISA_MASK) + if (isa_out) { - /* Merge cf specific flags */ - if ((in_flags & EF_M68K_ISA_MASK) - > (out_flags & EF_M68K_ISA_MASK)) - { - out_flags ^= out_flags & EF_M68K_ISA_MASK; - out_flags |= in_flags & EF_M68K_ISA_MASK; - } - out_flags |= in_flags - & (EF_M68K_HW_DIV | EF_M68K_USP | EF_M68K_FLOAT); + if (isa_out == EF_M68K_ISA_A_PLUS + && (isa_in == EF_M68K_ISA_B_NOUSP + || isa_in == EF_M68K_ISA_B)) + /* Cannot mix A+ and B */ + return FALSE; + if (isa_in == EF_M68K_ISA_A_PLUS + && (isa_out == EF_M68K_ISA_B_NOUSP + || isa_out == EF_M68K_ISA_B)) + /* Cannot mix B and A+ */ + return FALSE; + + if (isa_in > isa_out) + out_flags ^= isa_in ^ isa_out; + + out_flags |= in_flags & EF_M68K_FLOAT; if (in_flags & EF_M68K_MAC_MASK) { if (!(out_flags & EF_M68K_MAC_MASK)) @@ -559,22 +572,31 @@ elf32_m68k_print_private_bfd_data (abfd, ptr) { char const *isa = _("unknown"); char const *mac = _("unknown"); + char const *additional = ""; switch (eflags & EF_M68K_ISA_MASK) { + case EF_M68K_ISA_A_NODIV: + isa = "A"; + additional = " [nodiv]"; + break; case EF_M68K_ISA_A: isa = "A"; break; case EF_M68K_ISA_A_PLUS: isa = "A+"; break; + case EF_M68K_ISA_B_NOUSP: + isa = "B"; + additional = " [nousp]"; + break; case EF_M68K_ISA_B: isa = "B"; break; } - fprintf (file, " [isa %s]", isa); - if (eflags & EF_M68K_HW_DIV) - fprintf (file, " [hwdiv]"); + fprintf (file, " [isa %s]%s", isa, additional); + if (eflags & EF_M68K_FLOAT) + fprintf (file, " [float]"); switch (eflags & EF_M68K_MAC_MASK) { case 0: @@ -589,10 +611,6 @@ elf32_m68k_print_private_bfd_data (abfd, ptr) } if (mac) fprintf (file, " [%s]", mac); - if (eflags & EF_M68K_USP) - fprintf (file, " [usp"); - if (eflags & EF_M68K_FLOAT) - fprintf (file, " [float]"); } fputc ('\n', file); diff --git a/bfd/ieee.c b/bfd/ieee.c index 248551f04b3..be8455c617f 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -3466,22 +3466,22 @@ ieee_write_processor (bfd *abfd) case bfd_mach_m68040: id = "68040"; break; case bfd_mach_m68060: id = "68060"; break; case bfd_mach_cpu32: id = "cpu32"; break; + case bfd_mach_mcf_isa_a_nodiv: id = "isa-a:nodiv"; break; case bfd_mach_mcf_isa_a: id = "isa-a"; break; - case bfd_mach_mcf_isa_a_div: id = "isa-a:div"; break; - case bfd_mach_mcf_isa_a_div_mac: id = "isa-a:div:mac"; break; - case bfd_mach_mcf_isa_a_div_emac: id = "isa-a:div:emac"; break; - case bfd_mach_mcf_isa_aplus: id = "isa-a+"; break; - case bfd_mach_mcf_isa_aplus_mac: id = "isa-a+:mac"; break; - case bfd_mach_mcf_isa_aplus_emac: id = "isa-a+:mac"; break; - case bfd_mach_mcf_isa_aplus_usp: id = "isa-a+:usp"; break; - case bfd_mach_mcf_isa_aplus_usp_mac: id = "isa-a+:usp:mac"; break; - case bfd_mach_mcf_isa_aplus_usp_emac: id = "isa-a+:usp:emac"; break; + case bfd_mach_mcf_isa_a_mac: id = "isa-a:mac"; break; + case bfd_mach_mcf_isa_a_emac: id = "isa-a:emac"; break; + case bfd_mach_mcf_isa_aplus: id = "isa-aplus"; break; + case bfd_mach_mcf_isa_aplus_mac: id = "isa-aplus:mac"; break; + case bfd_mach_mcf_isa_aplus_emac: id = "isa-aplus:mac"; break; + case bfd_mach_mcf_isa_b_nousp: id = "isa-b:nousp"; break; + case bfd_mach_mcf_isa_b_nousp_mac: id = "isa-b:nousp:mac"; break; + case bfd_mach_mcf_isa_b_nousp_emac: id = "isa-b:nousp:emac"; break; case bfd_mach_mcf_isa_b: id = "isa-b"; break; case bfd_mach_mcf_isa_b_mac: id = "isa-b:mac"; break; case bfd_mach_mcf_isa_b_emac: id = "isa-b:emac"; break; - case bfd_mach_mcf_isa_b_usp_float: id = "isa-b:usp:float"; break; - case bfd_mach_mcf_isa_b_usp_float_mac: id = "isa-b:usp:float:mac"; break; - case bfd_mach_mcf_isa_b_usp_float_emac: id = "isa-b:usp:float:emac"; break; + case bfd_mach_mcf_isa_b_float: id = "isa-b:float"; break; + case bfd_mach_mcf_isa_b_float_mac: id = "isa-b:float:mac"; break; + case bfd_mach_mcf_isa_b_float_emac: id = "isa-b:float:emac"; break; } if (! ieee_write_id (abfd, id)) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 85c5b667cd5..34ab9fe790c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2006-03-06 Nathan Sidwell + + * readelf.c (get_machine_flags): Adjust. + 2006-03-03 Jakub Jelinek * dwarf.c (frame_display_row, display_debug_frames): Handle diff --git a/binutils/readelf.c b/binutils/readelf.c index 192ddcff969..dcd02bca218 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1949,23 +1949,34 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) { char const *isa = _("unknown"); char const *mac = _("unknown mac"); + char const *additional = NULL; switch (e_flags & EF_M68K_ISA_MASK) { + case EF_M68K_ISA_A_NODIV: + isa = "A"; + additional = ", nodiv"; + break; case EF_M68K_ISA_A: isa = "A"; break; case EF_M68K_ISA_A_PLUS: isa = "A+"; break; + case EF_M68K_ISA_B_NOUSP: + isa = "B"; + additional = ", nousp"; + break; case EF_M68K_ISA_B: isa = "B"; break; } strcat (buf, ", cf, isa "); strcat (buf, isa); - if (e_flags & EF_M68K_HW_DIV) - strcat (buf, ", hwdiv"); + if (additional) + strcat (buf, additional); + if (e_flags & EF_M68K_FLOAT) + strcat (buf, ", float"); switch (e_flags & EF_M68K_MAC_MASK) { case 0: @@ -1983,10 +1994,6 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) strcat (buf, ", "); strcat (buf, mac); } - if (e_flags & EF_M68K_USP) - strcat (buf, ", usp"); - if (e_flags & EF_M68K_FLOAT) - strcat (buf, ", float"); } break; diff --git a/gas/ChangeLog b/gas/ChangeLog index 1347fae0696..709e66b0a4d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2006-03-06 Nathan Sidwell + + * config/tc-m68k.c (m68k_extensions): Allow 'float' on both m68k + and cf. + (m68k_ip): Check we have some control regs. + (md_parse_option): Allow raw arch switch. + (m68k_init_arch): Better detection of arch/cpu mismatch. Detect + whether 68881 or cfloat was meant by -mfloat. + (md_show_usage): Adjust extension display. + (m68k_elf_final_processing): Adjust. + 2006-03-03 Bjoern Haase * config/tc-avr.c (avr_mod_hash_value): New function. diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index b7fb25c1fd4..8b112631bd8 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -368,7 +368,11 @@ struct m68k_cpu unsigned long arch; /* Architecture features. */ unsigned long chip; /* Specific chip */ const char *name; /* Name */ - unsigned alias; + int alias; /* Alias for a cannonical name. If 1, then + succeeds canonical name, if -1 then + succeeds canonical name, if <-1 ||>1 this is a + deprecated name, and the next/previous name + should be used. */ }; /* We hold flags for features explicitly enabled and explicitly @@ -391,23 +395,25 @@ static const struct m68k_cpu m68k_archs[] = {m68060, cpu_m68060, "68060", 0}, {cpu32|m68881, cpu_cpu32, "cpu32", 0}, {mcfisa_a|mcfhwdiv, 0, "isaa", 0}, - {mcfisa_a|mcfhwdiv|mcfisa_aa, 0, "isaaplus", 0}, - {mcfisa_a|mcfhwdiv|mcfisa_b, 0, "isab", 0}, + {mcfisa_a|mcfhwdiv|mcfisa_aa|mcfusp, 0, "isaaplus", 0}, + {mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp, 0, "isab", 0}, {mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat, cpu_cf547x, "cfv4e", 0}, {0,0,NULL, 0} }; -/* Architecture extensions. */ +/* Architecture extensions, here 'alias' -1 for m68k, +1 for cf and 0 + for either. */ static const struct m68k_cpu m68k_extensions[] = { - {m68851, 0, "68851", 0}, - {m68881, 0, "68881", 0}, - {m68881, 0, "68882", 0}, + {m68851, 0, "68851", -1}, + {m68881, 0, "68881", -1}, + {m68881, 0, "68882", -1}, + + {cfloat|m68881, 0, "float", 0}, {mcfhwdiv, 0, "div", 1}, {mcfusp, 0, "usp", 1}, - {cfloat, 0, "float", 1}, {mcfmac, 0, "mac", 1}, {mcfemac, 0, "emac", 1}, @@ -426,13 +432,13 @@ static const struct m68k_cpu m68k_cpus[] = { cpu32|m68881, cpu_cpu32, "cpu32", 0}, { mcfisa_a, cpu_cf5200, "5200", 0}, { mcfisa_a|mcfhwdiv|mcfmac, cpu_cf5206e, "5206e", 0}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, cpu_cf5208, "5208", 0}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, cpu_cf5213, "5213", 0}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, cpu_cf5208, "5208", 0}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, cpu_cf5213, "5213", 0}, { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf521x, "521x", 0}, { mcfisa_a|mcfhwdiv|mcfemac, cpu_cf5249, "5249", 0}, { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf528x, "528x", 0}, { mcfisa_a|mcfhwdiv|mcfmac, cpu_cf5307, "5307", 0}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf5329, "5329", 0}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf5329, "5329", 0}, { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac, cpu_cf5407, "5407",0}, { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat, cpu_cf547x, "547x", 0}, @@ -467,16 +473,16 @@ static const struct m68k_cpu m68k_cpus[] = { mcfisa_a, cpu_cf5200, "5202", 1}, { mcfisa_a, cpu_cf5200, "5204", 1}, { mcfisa_a, cpu_cf5200, "5206", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, cpu_cf5208, "5207", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, cpu_cf5213, "5211", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac, cpu_cf5213, "5212", 1}, - { mcfisa_a|mcfhwdiv|mcfisa_aa|mcfemac, cpu_cf521x, "5214", 1}, - { mcfisa_a|mcfhwdiv|mcfisa_aa|mcfemac, cpu_cf521x, "5216", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf5329, "5327", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf5329, "5328", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf528x, "5280", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf528x, "5281", 1}, - { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac, cpu_cf528x, "5282", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, cpu_cf5208, "5207", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, cpu_cf5213, "5211", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, cpu_cf5213, "5212", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf521x, "5214", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf521x, "5216", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf5329, "5327", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf5329, "5328", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf528x, "5280", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf528x, "5281", 1}, + { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, cpu_cf528x, "5282", 1}, { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac, cpu_cf5407, "cfv4", 1 }, { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat, cpu_cf547x, "cfv4e", 1 }, @@ -1700,11 +1706,13 @@ m68k_ip (char *instring) case 'J': if (opP->mode != CONTROL || opP->reg < USP - || opP->reg > last_movec_reg) + || opP->reg > last_movec_reg + || !control_regs) losing++; else { const enum m68k_register *rp; + for (rp = control_regs; *rp; rp++) if (*rp == opP->reg) break; @@ -7271,6 +7279,8 @@ md_parse_option (int c, char *arg) m68k_set_cpu (arg + 4, 1, 0); else if (m68k_set_extension (arg, 0, 1)) ; + else if (m68k_set_arch (arg, 0, 1)) + ; else if (m68k_set_cpu (arg, 0, 1)) ; else @@ -7289,35 +7299,42 @@ md_parse_option (int c, char *arg) static void m68k_init_arch (void) { - unsigned arch_of_chip = 0; - if (not_current_architecture & current_architecture) { as_bad (_("architecture features both enabled and disabled")); not_current_architecture &= ~current_architecture; } if (selected_arch) + current_architecture |= selected_arch->arch; + else + current_architecture |= selected_cpu->arch; + + current_architecture &= ~not_current_architecture; + + if (selected_cpu) { - arch_of_chip = selected_arch->arch; - current_chip = selected_arch->chip; - if (selected_cpu && (arch_of_chip & ~selected_cpu->arch)) + if (current_architecture & ~selected_cpu->arch) { - as_bad (_("selected processor is not from selected architecture")); - arch_of_chip = selected_cpu->arch; + as_bad (_("selected processor does not have all features of selected architecture")); + current_architecture + = selected_cpu->arch & ~not_current_architecture; } } - else - arch_of_chip = selected_cpu->arch; - if (selected_cpu) - current_chip = selected_cpu->chip; - current_architecture |= arch_of_chip; - current_architecture &= ~not_current_architecture; + if ((current_architecture & (cfloat | m68881)) == (cfloat | m68881)) + { + /* Determine which float is really meant. */ + if (current_architecture & (m68k_mask & ~m68881)) + current_architecture ^= cfloat; + else + current_architecture ^= m68881; + } + if ((current_architecture & m68k_mask) && (current_architecture & ~m68k_mask)) { as_bad (_ ("m68k and cf features both selected")); - if (arch_of_chip & m68k_mask) + if (current_architecture & m68k_mask) current_architecture &= m68k_mask; else current_architecture &= ~m68k_mask; @@ -7375,8 +7392,10 @@ md_show_usage (FILE *stream) "), default_cpu); for (i = 0; m68k_extensions[i].name; i++) fprintf (stream, _("\ --m[no-]%-16s enable/disable %s architecture extension\n\ -"), m68k_extensions[i].name, m68k_extensions[i].alias ? "ColdFire" : "m68k"); +-m[no-]%-16s enable/disable%s architecture extension\n\ +"), m68k_extensions[i].name, + m68k_extensions[i].alias > 0 ? " ColdFire" + : m68k_extensions[i].alias < 0 ? " m68k" : ""); fprintf (stream, _("\ -l use 1 word for refs to undefined symbols [default 2]\n\ @@ -7568,27 +7587,59 @@ m68k_elf_final_processing (void) if (current_architecture & mcfisa_a) { - /* Set coldfire specific elf flags */ - if (current_architecture & mcfisa_b) - flags |= EF_M68K_ISA_B; - else if (current_architecture & mcfisa_aa) - flags |= EF_M68K_ISA_A_PLUS; - else - flags |= EF_M68K_ISA_A; - - if (current_architecture & mcfhwdiv) - flags |= EF_M68K_HW_DIV; - - if (current_architecture & mcfusp) - flags |= EF_M68K_USP; + static const unsigned isa_features[][2] = + { + {EF_M68K_ISA_A_NODIV, mcfisa_a}, + {EF_M68K_ISA_A, mcfisa_a|mcfhwdiv}, + {EF_M68K_ISA_A_PLUS,mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp}, + {EF_M68K_ISA_B_NOUSP,mcfisa_a|mcfisa_b|mcfhwdiv}, + {EF_M68K_ISA_B, mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp}, + {0,0}, + }; + static const unsigned mac_features[][2] = + { + {EF_M68K_MAC, mcfmac}, + {EF_M68K_EMAC, mcfemac}, + {0,0}, + }; + unsigned ix; + unsigned pattern; - if (current_architecture & cfloat) - flags |= EF_M68K_FLOAT; + pattern = (current_architecture + & (mcfisa_a|mcfisa_aa|mcfisa_b|mcfhwdiv|mcfusp)); + for (ix = 0; isa_features[ix][1]; ix++) + { + if (pattern == isa_features[ix][1]) + { + flags |= isa_features[ix][0]; + break; + } + } + if (!isa_features[ix][1]) + { + cf_bad: + as_warn (_("Not a defined coldfire architecture")); + } + else + { + if (current_architecture & cfloat) + flags |= EF_M68K_FLOAT | EF_M68K_CFV4E; - if (current_architecture & mcfmac) - flags |= EF_M68K_MAC; - else if (current_architecture & mcfemac) - flags |= EF_M68K_EMAC; + pattern = current_architecture & (mcfmac|mcfemac); + if (pattern) + { + for (ix = 0; mac_features[ix][1]; ix++) + { + if (pattern == mac_features[ix][1]) + { + flags |= mac_features[ix][0]; + break; + } + } + if (!mac_features[ix][1]) + goto cf_bad; + } + } } elf_elfheader (stdoutput)->e_flags |= flags; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 7f91b24a99f..28adf506561 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-03-06 Nathan Sidwell + + * gas/m68k/arch-cpu-1.s: Tweak. + * gas/m68k/arch-cpu-1.d: Tweak. + 2006-02-28 Jan Beulich * gas/all/altmacro.s: Adjust. diff --git a/gas/testsuite/gas/m68k/arch-cpu-1.d b/gas/testsuite/gas/m68k/arch-cpu-1.d index 4195926bd7c..421010d0839 100644 --- a/gas/testsuite/gas/m68k/arch-cpu-1.d +++ b/gas/testsuite/gas/m68k/arch-cpu-1.d @@ -3,7 +3,7 @@ .*: file format elf32-m68k -private flags = 22: \[isa A\+\] \[emac\] +private flags = 21: \[isa A\] \[nodiv\] \[emac\] Disassembly of section .text: diff --git a/gas/testsuite/gas/m68k/arch-cpu-1.s b/gas/testsuite/gas/m68k/arch-cpu-1.s index e0bfead5b17..48d621bd69b 100644 --- a/gas/testsuite/gas/m68k/arch-cpu-1.s +++ b/gas/testsuite/gas/m68k/arch-cpu-1.s @@ -1,4 +1,4 @@ - .arch isaaplus,no-div,emac + .arch isaa,no-div,emac .cpu 5329 mac.w %d1l,%a1u,<<,%acc0 diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 27665852b0d..3270871cd29 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,12 @@ +2006-03-06 Nathan Sidwell + + * m68k.h (EF_M68K_ISA_MASK, EF_M68K_ISA_A, + EF_M68K_ISA_A_PLUS, EF_M68K_ISA_B, EF_M68K_ISA_C): Adjust. + (EF_M68K_ISA_A_NODIV, EF_M68K_ISA_B_NOUSP): New. + (EF_M68K_HW_DIV, EF_M68K_USP): Remove. + (EF_M68K_MAC, EF_M68K_EMAC, EF_M68K_FLOAT): Adjust. + (EF_M68K_EMAC_B): New. + 2006-03-03 Bjoern Haase * avr.h (R_AVR_MS8_LDI,R_AVR_MS8_LDI_NEG): Add. diff --git a/include/elf/m68k.h b/include/elf/m68k.h index 929cd60f482..08d0c441988 100644 --- a/include/elf/m68k.h +++ b/include/elf/m68k.h @@ -58,16 +58,18 @@ END_RELOC_NUMBERS (R_68K_max) /* We use the bottom 8 bits to encode information about the coldfire variant. */ -#define EF_M68K_ISA_MASK 0x07 /* Which ISA */ -#define EF_M68K_ISA_A 0x01 -#define EF_M68K_ISA_A_PLUS 0x02 -#define EF_M68K_ISA_B 0x03 -#define EF_M68K_HW_DIV 0x08 /* Has HW divide */ +#define EF_M68K_ISA_MASK 0x0F /* Which ISA */ +#define EF_M68K_ISA_A_NODIV 0x01 /* ISA A except for div */ +#define EF_M68K_ISA_A 0x02 +#define EF_M68K_ISA_A_PLUS 0x03 +#define EF_M68K_ISA_B_NOUSP 0x04 /* ISA_B except for USP */ +#define EF_M68K_ISA_B 0x05 +#define EF_M68K_ISA_C 0x06 #define EF_M68K_MAC_MASK 0x30 -#define EF_M68K_MAC 0x10 /* Has MAC */ -#define EF_M68K_EMAC 0x20 /* Has EMAC */ -#define EF_M68K_USP 0x40 /* Has USP insns */ -#define EF_M68K_FLOAT 0x80 /* Has float insns */ +#define EF_M68K_MAC 0x10 /* MAC */ +#define EF_M68K_EMAC 0x20 /* EMAC */ +#define EF_M68K_EMAC_B 0x30 /* EMAC_B */ +#define EF_M68K_FLOAT 0x40 /* Has float insns */ #define EF_M68K_CF_MASK 0xFF #endif diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a8e2d96041d..aacef8feda0 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-03-06 Nathan Sidwell + + * ld-m68k: New tests. + 2006-03-03 Richard Sandiford * ld-i386/vxworks1-static.d, ld-i386/vxworks2.s, diff --git a/ld/testsuite/ld-m68k/isaa-mac.d b/ld/testsuite/ld-m68k/isaa-mac.d new file mode 100644 index 00000000000..79b809a0c0c --- /dev/null +++ b/ld/testsuite/ld-m68k/isaa-mac.d @@ -0,0 +1,7 @@ + +.*: file format elf32-m68k + +Program Header: +#... +private flags = 12: \[isa A\] \[mac\] + diff --git a/ld/testsuite/ld-m68k/isaa-mac.s b/ld/testsuite/ld-m68k/isaa-mac.s new file mode 100644 index 00000000000..e3ec277c9e0 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaa-mac.s @@ -0,0 +1,3 @@ + .arch isaa,mac + + nop diff --git a/ld/testsuite/ld-m68k/isaa-nodiv.s b/ld/testsuite/ld-m68k/isaa-nodiv.s new file mode 100644 index 00000000000..de327f1e451 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaa-nodiv.s @@ -0,0 +1,3 @@ + .arch isaa,no-div + + nop diff --git a/ld/testsuite/ld-m68k/isaa.d b/ld/testsuite/ld-m68k/isaa.d new file mode 100644 index 00000000000..48e4fa279c8 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaa.d @@ -0,0 +1,7 @@ + +.*: file format elf32-m68k + +Program Header: +#... +private flags = 2: \[isa A\] + diff --git a/ld/testsuite/ld-m68k/isaa.s b/ld/testsuite/ld-m68k/isaa.s new file mode 100644 index 00000000000..f4675c13013 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaa.s @@ -0,0 +1,3 @@ + .arch isaa + + nop diff --git a/ld/testsuite/ld-m68k/isaaplus.d b/ld/testsuite/ld-m68k/isaaplus.d new file mode 100644 index 00000000000..88623ce7df6 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaaplus.d @@ -0,0 +1,7 @@ + +.*: file format elf32-m68k + +Program Header: +#... +private flags = 3: \[isa A\+\] + diff --git a/ld/testsuite/ld-m68k/isaaplus.s b/ld/testsuite/ld-m68k/isaaplus.s new file mode 100644 index 00000000000..5b0a0b82bd9 --- /dev/null +++ b/ld/testsuite/ld-m68k/isaaplus.s @@ -0,0 +1,3 @@ + .arch isaaplus + + nop diff --git a/ld/testsuite/ld-m68k/isab-float.d b/ld/testsuite/ld-m68k/isab-float.d new file mode 100644 index 00000000000..3547ea71c35 --- /dev/null +++ b/ld/testsuite/ld-m68k/isab-float.d @@ -0,0 +1,7 @@ + +.*: file format elf32-m68k + +Program Header: +#... +private flags = 8045: \[cfv4e\] \[isa B\] \[float\] + diff --git a/ld/testsuite/ld-m68k/isab-float.s b/ld/testsuite/ld-m68k/isab-float.s new file mode 100644 index 00000000000..3889d0d61e1 --- /dev/null +++ b/ld/testsuite/ld-m68k/isab-float.s @@ -0,0 +1,3 @@ + .arch isab,float + + nop diff --git a/ld/testsuite/ld-m68k/isab-nousp.s b/ld/testsuite/ld-m68k/isab-nousp.s new file mode 100644 index 00000000000..1e52357754e --- /dev/null +++ b/ld/testsuite/ld-m68k/isab-nousp.s @@ -0,0 +1,3 @@ + .arch isab,no-usp + + nop diff --git a/ld/testsuite/ld-m68k/isab.d b/ld/testsuite/ld-m68k/isab.d new file mode 100644 index 00000000000..c5b0134566b --- /dev/null +++ b/ld/testsuite/ld-m68k/isab.d @@ -0,0 +1,7 @@ + +.*: file format elf32-m68k + +Program Header: +#... +private flags = 5: \[isa B\] + diff --git a/ld/testsuite/ld-m68k/isab.s b/ld/testsuite/ld-m68k/isab.s new file mode 100644 index 00000000000..3f93db7540b --- /dev/null +++ b/ld/testsuite/ld-m68k/isab.s @@ -0,0 +1,3 @@ + .arch isab + + nop diff --git a/ld/testsuite/ld-m68k/m68k.exp b/ld/testsuite/ld-m68k/m68k.exp new file mode 100644 index 00000000000..5323317486c --- /dev/null +++ b/ld/testsuite/ld-m68k/m68k.exp @@ -0,0 +1,47 @@ +# Expect script for run_dump_test based ld-m68k tests. +# Copyright 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. +# +# Test m68k object merging + +if { ![is_elf_format] || ![istarget m68k-*-*] } { + return +} + +# List contains test-items with 3 items followed by 2 lists: +# 0:name 1:ld options 2:assembler options +# 3:filenames of assembler files 4: action and options. 5: name of output file + +# Actions: +# objdump: Apply objdump options on result. Compare with regex (last arg). +# nm: Apply nm options on result. Compare with regex (last arg). +# readelf: Apply readelf options on result. Compare with regex (last arg). + +set m68k_mergeok_tests { + {"merge isa-a isa-a:nodiv" "-T merge.ld" "" + {isaa.s isaa-nodiv.s} {{objdump -p isaa.d}} "isaa"} + {"merge isa-a isa-b" "-T merge.ld" "" + {isaa.s isab.s} {{objdump -p isab.d}} "isab"} + {"merge isa-a isa-aplus" "-T merge.ld" "" + {isaa.s isaaplus.s} {{objdump -p isaaplus.d}} "isaplus"} + {"merge isa-b isa-b:nousp" "-T merge.ld" "" + {isab.s isab-nousp.s} {{objdump -p isab.d}} "isab"} + {"merge isa-a isa-a:mac" "-T merge.ld" "" + {isaa.s isaa-mac.s} {{objdump -p isaa-mac.d}} "isaa-mac"} + {"merge isa-b isa-b:float" "-T merge.ld" "" + {isab.s isab-float.s} {{objdump -p isab-float.d}} "isab-float"}} + +run_ld_link_tests $m68k_mergeok_tests diff --git a/ld/testsuite/ld-m68k/merge.ld b/ld/testsuite/ld-m68k/merge.ld new file mode 100644 index 00000000000..ed2acfe1d53 --- /dev/null +++ b/ld/testsuite/ld-m68k/merge.ld @@ -0,0 +1,9 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", + "elf32-m68k") +OUTPUT_ARCH(m68k) +ENTRY(_start) + +SECTIONS { + + .text : {_start = .; *(.text)} +}