X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fcpu-nios2.c;h=1e8f521bee08b28ce3223df8b6945f3d1ce09671;hb=965b1d80832fde9ba17a8b5f11b578a8f9e10581;hp=57539db14d25c55d16828a503c42d0180b4e1d4b;hpb=dfc87947b5ac6d6382c225449d4fdce411c7ee66;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/cpu-nios2.c b/bfd/cpu-nios2.c index 57539db14d..1e8f521bee 100644 --- a/bfd/cpu-nios2.c +++ b/bfd/cpu-nios2.c @@ -24,6 +24,26 @@ #include "bfd.h" #include "libbfd.h" +static const bfd_arch_info_type * +nios2_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 == bfd_mach_nios2) + return a; + else if (b->mach == bfd_mach_nios2) + return b; + else if (a->mach != b->mach) + return NULL; + + return a; +} + #define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ { \ BITS_WORD, /* bits in a word */ \ @@ -35,10 +55,20 @@ PRINT, \ 3, \ DEFAULT, \ - bfd_default_compatible, \ + nios2_compatible, \ bfd_default_scan, \ bfd_arch_default_fill, \ NEXT \ } -const bfd_arch_info_type bfd_nios2_arch = N (32, 32, 0, "nios2", TRUE, NULL); +#define NIOS2R1_NEXT &arch_info_struct[0] +#define NIOS2R2_NEXT &arch_info_struct[1] + +static const bfd_arch_info_type arch_info_struct[] = +{ + N (32, 32, bfd_mach_nios2r1, "nios2:r1", FALSE, NIOS2R2_NEXT), + N (32, 32, bfd_mach_nios2r2, "nios2:r2", FALSE, NULL), +}; + +const bfd_arch_info_type bfd_nios2_arch = + N (32, 32, 0, "nios2", TRUE, NIOS2R1_NEXT);