diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2015-07-01 15:55:28 -0700 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2015-07-01 15:55:28 -0700 |
commit | 965b1d80832fde9ba17a8b5f11b578a8f9e10581 (patch) | |
tree | 050d75d12b3342269911e3db42256309a1adaac1 /bfd/cpu-nios2.c | |
parent | dfc87947b5ac6d6382c225449d4fdce411c7ee66 (diff) | |
download | gdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.zip gdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.tar.gz gdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.tar.bz2 |
Add Nios II arch flags and compatibility tests
2015-07-01 Sandra Loosemore <sandra@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
bfd/
* archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New.
* bfd-in2.h: Regenerated.
* cpu-nios2.c (nios2_compatible): New.
(N): Use nios2_compatible instead of bfd_default_compatible.
(NIOS2R1_NEXT, NIOS2R2_NEXT): Define.
(arch_info_struct): New.
(bfd_nios2_arch): Chain to NIOS2R1_NEXT.
* elf32-nios2.c (is_nios2_elf): New.
(nios2_elf32_merge_private_bfd_data): New.
(nios2_elf32_object_p): New.
(bfd_elf32_bfd_merge_private_bfd_data): Define.
(elf_backend_object_p): Define.
gas/
* config/tc-nios2.c: Adjust includes.
(OPTION_MARCH): Define.
(md_longopts): Add -march option.
(nios2_architecture): New.
(nios2_use_arch): New.
(md_parse_option): Handle OPTION_MARCH.
(md_show_usage): Document -march.
(md_begin): Set arch in BFD.
(nios2_elf_final_processing): New.
* config/tc-nios2.h (elf_tc_final_processing): Define.
(nios2_elf_final_processing): New.
* doc/c-nios2.texi (-march): Add documentation.
include/elf/
* nios2.h (EF_NIOS2_ARCH_R1, EF_NIOS2_ARCH_R2): Define.
ld/testsuite/
* ld-nios2/mixed1a.d: New.
* ld-nios2/mixed1a.s: New.
* ld-nios2/mixed1b.d: New.
* ld-nios2/mixed1b.s: New.
* ld-nios2/nios2.exp: Build the new compatibility tests.
Diffstat (limited to 'bfd/cpu-nios2.c')
-rw-r--r-- | bfd/cpu-nios2.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/bfd/cpu-nios2.c b/bfd/cpu-nios2.c index 57539db..1e8f521 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); |