> -----邮件原件----- > 发件人: linux-unicore-bounce@xxxxxxxxxxxxx > [mailto:linux-unicore-bounce@xxxxxxxxxxxxx] 代表 LIU Zhiyou > 发送时间: Sunday, January 20, 2013 13:23 > 收件人: gxt@xxxxxxxxxxxxxxx; linux-unicore@xxxxxxxxxxxxx > 抄送: LIU Zhiyou > 主题: [linux-unicore] [PATCH/binutils] Building support for opcodes. > > This patch is for building supporting of opcodes. It's based on the bfd-buiding > patch. After applied, $ make runs into > > This target is no longer supported in gas > > opcodes/unicore32-opc.c, opcodes/unicore32-dis.c and > include/opcode/unicore32.h are just stubs now and we are supposed to > implement the unicore32 backend in these files. Cheers! > --- > include/dis-asm.h | 3 ++- > include/opcode/unicore32.h | 26 ++++++++++++++++++++++++++ > opcodes/Makefile.am | 10 +++++++++- > opcodes/Makefile.in | 11 ++++++++++- > opcodes/configure | 1 + > opcodes/configure.in | 1 + > opcodes/disassemble.c | 6 ++++++ > opcodes/unicore32-dis.c | 34 ++++++++++++++++++++++++++++++++++ > opcodes/unicore32-opc.c | 26 ++++++++++++++++++++++++++ > 9 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 > include/opcode/unicore32.h create mode 100644 opcodes/unicore32-dis.c > create mode 100644 opcodes/unicore32-opc.c > > diff --git a/include/dis-asm.h b/include/dis-asm.h index 25d44fc..10ab8be > 100644 > --- a/include/dis-asm.h > +++ b/include/dis-asm.h > @@ -255,7 +255,7 @@ extern int print_insn_little_arm (bfd_vma, > disassemble_info *); > extern int print_insn_little_mips (bfd_vma, disassemble_info *); > extern int print_insn_little_or32 (bfd_vma, disassemble_info *); > extern int print_insn_little_powerpc (bfd_vma, disassemble_info *); > -extern int print_insn_little_score (bfd_vma, disassemble_info *); > +extern int print_insn_little_score (bfd_vma, disassemble_info *); 请不要引入类似上面的改动 > extern int print_insn_lm32 (bfd_vma, disassemble_info *); > extern int print_insn_m32c (bfd_vma, disassemble_info *); > extern int print_insn_m32r (bfd_vma, disassemble_info *); > @@ -292,6 +292,7 @@ extern int print_insn_tic6x (bfd_vma, > disassemble_info *); > extern int print_insn_tic80 (bfd_vma, disassemble_info *); > extern int print_insn_tilegx (bfd_vma, disassemble_info *); > extern int print_insn_tilepro (bfd_vma, disassemble_info *); > +extern int print_insn_unicore32 (bfd_vma, disassemble_info *); > extern int print_insn_v850 (bfd_vma, disassemble_info *); > extern int print_insn_vax (bfd_vma, disassemble_info *); > extern int print_insn_w65 (bfd_vma, disassemble_info *); > diff --git a/include/opcode/unicore32.h b/include/opcode/unicore32.h new file > mode 100644 index 0000000..b5fe8e0 > --- /dev/null > +++ b/include/opcode/unicore32.h > @@ -0,0 +1,26 @@ > +/* unicore32.h -- Header file for UniCore32 opcode and register tables. > + Copyright 2013 Free Software Foundation, Inc. > + Contributed by LIU Zhiyou > + > + This file is part of GAS, GDB and the GNU binutils. > + > + GAS, GDB, and GNU binutils 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, or (at your > + option) any later version. > + > + GAS, GDB, and GNU binutils are distributed in the hope that they 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 _UNICORE32_H_ > +#define _UNICORE32_H Typo > + > +/* Just a stub */ > + > +#endif > diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index > 3e6ceeb..c920cb5 100644 > --- a/opcodes/Makefile.am > +++ b/opcodes/Makefile.am > @@ -12,6 +12,8 @@ BFDDIR = $(srcdir)/../bfd WARN_CFLAGS = > @WARN_CFLAGS@ NO_WERROR = @NO_WERROR@ > NO_WMISSING_FIELD_INITIALIZERS = > @NO_WMISSING_FIELD_INITIALIZERS@ > +# For development > +NO_WUNUSED_FUNCTION = -Wno-unused-function > AM_CFLAGS = $(WARN_CFLAGS) > > COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(INCLUDES) $(AM_CPPFLAGS) \ > @@ -227,6 +229,8 @@ TARGET_LIBOPCODES_CFILES = \ > tilegx-opc.c \ > tilepro-dis.c \ > tilepro-opc.c \ > + unicore32-dis.c \ > + unicore32-opc.c \ > v850-dis.c \ > v850-opc.c \ > vax-dis.c \ > @@ -243,7 +247,7 @@ TARGET_LIBOPCODES_CFILES = \ > xstormy16-opc.c \ > xtensa-dis.c \ > xgate-dis.c \ > - xgate-opc.c \ > + xgate-opc.c \ > z80-dis.c \ > z8k-dis.c > > @@ -561,6 +565,10 @@ mips-opc.lo: mips-opc.c > mips16-opc.lo: mips16-opc.c > $(LTCOMPILE) $(NO_WMISSING_FIELD_INITIALIZERS) -c -o $@ $< > > +# For development > +unicore32-opc.lo: unicore32-opc.c > + $(LTCOMPILE) $(NO_WMISSING_FIELD_INITIALIZERS) > $(NO_WUNUSED_FUNCTION) > +-c -o $@ $< > + > $(srcdir)/rx-decode.c: @MAINT@ $(srcdir)/rx-decode.opc > opc2c$(EXEEXT_FOR_BUILD) > ./opc2c$(EXEEXT_FOR_BUILD) $(srcdir)/rx-decode.opc > > $(srcdir)/rx-decode.c > > diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 56d4734..7409065 > 100644 > --- a/opcodes/Makefile.in > +++ b/opcodes/Makefile.in > @@ -293,6 +293,8 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd > SUBDIRS = . po INCDIR = $(srcdir)/../include BFDDIR = $(srcdir)/../bfd > +# For development > +NO_WUNUSED_FUNCTION = -Wno-unused-function 为何需要额外增加这个Warning? > AM_CFLAGS = $(WARN_CFLAGS) > COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(INCLUDES) $(AM_CPPFLAGS) \ > $(CFLAGS_FOR_BUILD) > @@ -498,6 +500,8 @@ TARGET_LIBOPCODES_CFILES = \ > tilegx-opc.c \ > tilepro-dis.c \ > tilepro-opc.c \ > + unicore32-dis.c \ > + unicore32-opc.c \ > v850-dis.c \ > v850-opc.c \ > vax-dis.c \ > @@ -514,7 +518,7 @@ TARGET_LIBOPCODES_CFILES = \ > xstormy16-opc.c \ > xtensa-dis.c \ > xgate-dis.c \ > - xgate-opc.c \ > + xgate-opc.c \ 同上 > z80-dis.c \ > z8k-dis.c > > @@ -894,6 +898,8 @@ distclean-compile: > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/tilegx-opc.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/tilepro-dis.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/tilepro-opc.Plo@am__quote@ > +@AMDEP_TRUE@@am__include@ > +@am__quote@./$(DEPDIR)/unicore32-dis.Plo@am__quote@ > +@AMDEP_TRUE@@am__include@ > +@am__quote@./$(DEPDIR)/unicore32-opc.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/v850-dis.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/v850-opc.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ > @am__quote@./$(DEPDIR)/vax-dis.Plo@am__quote@ > @@ -1417,6 +1423,9 @@ mips-opc.lo: mips-opc.c > mips16-opc.lo: mips16-opc.c > $(LTCOMPILE) $(NO_WMISSING_FIELD_INITIALIZERS) -c -o $@ $< > > +unicore32-opc.lo: unicore32-opc.c > + $(LTCOMPILE) $(NO_WMISSING_FIELD_INITIALIZERS) > $(NO_WUNUSED_FUNCTION) > +-c -o $@ $< > + > $(srcdir)/rx-decode.c: @MAINT@ $(srcdir)/rx-decode.opc > opc2c$(EXEEXT_FOR_BUILD) > ./opc2c$(EXEEXT_FOR_BUILD) $(srcdir)/rx-decode.opc > > $(srcdir)/rx-decode.c > > diff --git a/opcodes/configure b/opcodes/configure index cd8a371..312e9e7 > 100755 > --- a/opcodes/configure > +++ b/opcodes/configure > @@ -12578,6 +12578,7 @@ if test x${all_targets} = xfalse ; then > bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;; > bfd_tilegx_arch) ta="$ta tilegx-dis.lo tilegx-opc.lo" ;; > bfd_tilepro_arch) ta="$ta tilepro-dis.lo tilepro-opc.lo" ;; > + bfd_unicore32_arch) ta="$ta unicore32-dis.lo unicore32-opc.lo" ;; > bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > diff --git a/opcodes/configure.in b/opcodes/configure.in index 7370d5f..2e431b7 > 100644 > --- a/opcodes/configure.in > +++ b/opcodes/configure.in > @@ -315,6 +315,7 @@ if test x${all_targets} = xfalse ; then > bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;; > bfd_tilegx_arch) ta="$ta tilegx-dis.lo tilegx-opc.lo" ;; > bfd_tilepro_arch) ta="$ta tilepro-dis.lo tilepro-opc.lo" ;; > + bfd_unicore32_arch) ta="$ta unicore32-dis.lo unicore32-opc.lo" ;; > bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;; > diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index > b3ff6ff..cbd5398 100644 > --- a/opcodes/disassemble.c > +++ b/opcodes/disassemble.c > @@ -87,6 +87,7 @@ > #define ARCH_tic80 > #define ARCH_tilegx > #define ARCH_tilepro > +#define ARCH_unicore32 > #define ARCH_v850 > #define ARCH_vax > #define ARCH_w65 > @@ -434,6 +435,11 @@ disassembler (abfd) > disassemble = print_insn_tic80; > break; > #endif > +#ifdef ARCH_unicore32 > + case bfd_arch_unicore32: > + disassemble = print_insn_unicore32; > + break; > +#endif > #ifdef ARCH_v850 > case bfd_arch_v850: > case bfd_arch_v850_rh850: > diff --git a/opcodes/unicore32-dis.c b/opcodes/unicore32-dis.c new file mode > 100644 index 0000000..6cba4e3 > --- /dev/null > +++ b/opcodes/unicore32-dis.c > @@ -0,0 +1,34 @@ > +/* Assemble and disassemble functions for UniCore32 processor > + Copyright 2013 Free Software Foundation, Inc. > + Contributed by LIU Zhiyou (liuzhiyou.cs@xxxxxxxxx). > + > + This file is part of GAS, GDB and the GNU binutils. > + > + 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, 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. > + */ > + > +#include "sysdep.h" > +#include "dis-asm.h" > +#include "opcode/unicore32.h" > +#include "libiberty.h" > + > +#define ILLEGAL "illegal" > + > +/* stub */ > +int > +print_insn_unicore32 (bfd_vma memaddr ATTRIBUTE_UNUSED, > + struct disassemble_info *info ATTRIBUTE_UNUSED) > { > + return 0; > +} > diff --git a/opcodes/unicore32-opc.c b/opcodes/unicore32-opc.c new file mode > 100644 index 0000000..087949a > --- /dev/null > +++ b/opcodes/unicore32-opc.c > @@ -0,0 +1,26 @@ > +/* unicore32-opc.c -- Table of opcodes for the UniCore32 processor. > + Copyright 2013 Free Software Foundation, Inc. > + Contributed by LIU Zhiyou (liuzhiyou.cs@xxxxxxxxx) > + > + This file is part of the GNU opcodes library. > + > + This library 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, or (at your option) > + any later version. > + > + It 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. > + */ > + > +#include "sysdep.h" > +#include "dis-asm.h" > +#include "opcode/unicore32.h" > +#include "libiberty.h" > + > +/* Just a stub */ > -- > 1.8.1.1