From cc0748930ba913902f812f99c6ff426df255a1e0 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 16 Apr 2009 15:39:46 +0000 Subject: [PATCH] Add new binutils target: moxie --- ChangeLog | 5 +++ configure | 6 +++- configure.ac | 4 +++ include/dis-asm.h | 1 + include/elf/ChangeLog | 5 +++ include/elf/common.h | 2 ++ include/elf/moxie.h | 31 ++++++++++++++++ include/opcode/ChangeLog | 4 +++ include/opcode/moxie.h | 68 +++++++++++++++++++++++++++++++++++ newlib/libm/common/s_lrint.c | 2 +- newlib/libm/common/sf_lrint.c | 2 +- 11 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 include/elf/moxie.h create mode 100644 include/opcode/moxie.h diff --git a/ChangeLog b/ChangeLog index 7aba867eb..3ae61a1cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-15 Anthony Green + + * configure.ac: Ditto. + * configure: Rebuilt. + 2009-04-09 Kaveh R. Ghazi * configure.ac: Bump minimum GMP/MPFR versions to 4.2 and 2.3.1. diff --git a/configure b/configure index bfb1d6b81..8559109b6 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -2409,6 +2409,10 @@ case "${target}" in frv-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; + moxie-*-*) + noconfigdirs="$noconfigdirs ${libgcj}" + noconfigdirs="$noconfigdirs gprof" + ;; h8300*-*-*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; diff --git a/configure.ac b/configure.ac index fd9612264..ee63082d6 100644 --- a/configure.ac +++ b/configure.ac @@ -644,6 +644,10 @@ case "${target}" in frv-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; + moxie-*-*) + noconfigdirs="$noconfigdirs ${libgcj}" + noconfigdirs="$noconfigdirs gprof" + ;; h8300*-*-*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; diff --git a/include/dis-asm.h b/include/dis-asm.h index d5d14c675..95d141ffa 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -259,6 +259,7 @@ extern int print_insn_mep (bfd_vma, disassemble_info *); extern int print_insn_mmix (bfd_vma, disassemble_info *); extern int print_insn_mn10200 (bfd_vma, disassemble_info *); extern int print_insn_mn10300 (bfd_vma, disassemble_info *); +extern int print_insn_moxie (bfd_vma, disassemble_info *); extern int print_insn_msp430 (bfd_vma, disassemble_info *); extern int print_insn_mt (bfd_vma, disassemble_info *); extern int print_insn_ns32k (bfd_vma, disassemble_info *); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index f6e73fd87..c7dc5e364 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,8 @@ +2009-04-15 Anthony Green + + * common.h (EM_MOXIE): Define. + * moxie.h: New file. + 2009-04-07 DJ Delorie * mep.h (EF_MEP_CPU_C5): New. diff --git a/include/elf/common.h b/include/elf/common.h index a669507d3..a343daaf3 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -339,6 +339,8 @@ #define EM_CYGNUS_MEP 0xF00D /* Toshiba MeP */ +#define EM_MOXIE 0xFEED /* Moxie */ + /* Old Sunplus S+core7 backend magic number. Written in the absence of an ABI. */ #define EM_SCORE_OLD 95 diff --git a/include/elf/moxie.h b/include/elf/moxie.h new file mode 100644 index 000000000..49781a6c1 --- /dev/null +++ b/include/elf/moxie.h @@ -0,0 +1,31 @@ +/* moxie ELF support for BFD. + Copyright 2009 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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. */ + +#ifndef _ELF_MOXIE_H +#define _ELF_MOXIE_H + +#include "elf/reloc-macros.h" + +/* Relocation types. */ +START_RELOC_NUMBERS (elf_moxie_reloc_type) + RELOC_NUMBER (R_MOXIE_NONE, 0) + RELOC_NUMBER (R_MOXIE_32, 1) +END_RELOC_NUMBERS (R_MOXIE_max) + +#endif /* _ELF_MOXIE_H */ diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index ad7bc61a3..0985425fb 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,7 @@ +2009-04-15 Anthony Green + + * moxie.h: Created. + 2009-04-06 DJ Delorie * h8300.h: Add relaxation attributes to MOVA opcodes. diff --git a/include/opcode/moxie.h b/include/opcode/moxie.h new file mode 100644 index 000000000..c996fe584 --- /dev/null +++ b/include/opcode/moxie.h @@ -0,0 +1,68 @@ +/* Definitions for decoding the moxie opcode table. + Copyright 2009 Free Software Foundation, Inc. + Contributed by Anthony Green (green@moxielogic.com). + + This program 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 3 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. */ + +/* Form 1 instructions come in different flavors: + + Some have no arguments (MOXIE_F1_NARG) + Some only use the A operand (MOXIE_F1_A) + Some use A and B registers (MOXIE_F1_AB) + Some use A and consume a 4 byte immediate value (MOXIE_F1_A4) + Some use just a 4 byte immediate value (MOXIE_F1_4) + Some use B and an indirect A (MOXIE_F1_AiB) + Some use A and an indirect B (MOXIE_F1_ABi) + Some consume a 4 byte immediate value and use X (MOXIE_F1_4A) + Some use B and an indirect A plus 4 bytes (MOXIE_F1_AiB4) + Some use A and an indirect B plus 4 bytes (MOXIE_F1_ABi4) + + Form 2 instructions also come in different flavors: + + Some have no arguments (MOXIE_F2_NARG) + Some use the A register and an 8-bit value (MOXIE_F2_A8V) + + Form 3 instructions also come in different flavors: + + Some have no arguments (MOXIE_F3_NARG). */ + +#define MOXIE_F1_NARG 0x100 +#define MOXIE_F1_A 0x101 +#define MOXIE_F1_AB 0x102 +/* #define MOXIE_F1_ABC 0x103 */ +#define MOXIE_F1_A4 0x104 +#define MOXIE_F1_4 0x105 +#define MOXIE_F1_AiB 0x106 +#define MOXIE_F1_ABi 0x107 +#define MOXIE_F1_4A 0x108 +#define MOXIE_F1_AiB4 0x109 +#define MOXIE_F1_ABi4 0x10a + +#define MOXIE_F2_NARG 0x200 +#define MOXIE_F2_A8V 0x201 + +#define MOXIE_F3_NARG 0x300 + +typedef struct moxie_opc_info_t +{ + short opcode; + unsigned itype; + const char * name; +} moxie_opc_info_t; + +extern const moxie_opc_info_t moxie_form1_opc_info[64]; +extern const moxie_opc_info_t moxie_form2_opc_info[4]; +extern const moxie_opc_info_t moxie_form3_opc_info[4]; diff --git a/newlib/libm/common/s_lrint.c b/newlib/libm/common/s_lrint.c index 5c15dd5e7..af94af709 100644 --- a/newlib/libm/common/s_lrint.c +++ b/newlib/libm/common/s_lrint.c @@ -110,7 +110,7 @@ TWO52[2]={ GET_HIGH_WORD(i0, t); /* Detect the all-zeros representation of plus and minus zero, which fails the calculation below. */ - if ((i0 & ~(1 << 31)) == 0) + if ((i0 & ~(1L << 31)) == 0) return 0; j0 = ((i0 & 0x7ff00000) >> 20) - 1023; i0 &= 0x000fffff; diff --git a/newlib/libm/common/sf_lrint.c b/newlib/libm/common/sf_lrint.c index 045a62f03..3c58c5d10 100644 --- a/newlib/libm/common/sf_lrint.c +++ b/newlib/libm/common/sf_lrint.c @@ -71,7 +71,7 @@ TWO23[2]={ GET_FLOAT_WORD (i0, t); /* Detect the all-zeros representation of plus and minus zero, which fails the calculation below. */ - if ((i0 & ~(1 << 31)) == 0) + if ((i0 & ~(1L << 31)) == 0) return 0; j0 = ((i0 >> 23) & 0xff) - 0x7f; i0 &= 0x7fffff;