[linux-unicore] Re: [PATCH] unicore32: Add bfd configure support

  • From: 刘智猷 <liuzhiyou.cs@xxxxxxxxx>
  • To: linux-unicore@xxxxxxxxxxxxx
  • Date: Thu, 27 Dec 2012 13:38:22 +0800

2012/12/24  <gxt@xxxxxxxxxxxxxxx>:
> From: Guan Xuetao <gxt@xxxxxxxxxxxxxxx>
>
> This patch adds bfd configure support based on 2.19.1, including empty 
> elf32-unicore32.c.
> Now, configuration step can smoothly work, though only bfd is correctly 
> configured.
>
> Signed-off-by: Guan Xuetao <gxt@xxxxxxxxxxxxxxx>
> ---
>  bfd/archures.c        |    3 +++
>  bfd/config.bfd        |    5 +++++
>  bfd/configure         |    1 +
>  bfd/elf32-unicore32.c |   21 +++++++++++++++++++++
>  bfd/targets.c         |    2 ++
>  config.sub            |    1 +
>  6 files changed, 33 insertions(+), 0 deletions(-)
>  create mode 100644 bfd/elf32-unicore32.c
>
> diff --git a/bfd/archures.c b/bfd/archures.c
> index aa49499..d03a77c 100644
> --- a/bfd/archures.c
> +++ b/bfd/archures.c
> @@ -375,6 +375,7 @@ DESCRIPTION
>  .  bfd_arch_score,     {* Sunplus score *}
>  .  bfd_arch_openrisc,  {* OpenRISC *}
>  .  bfd_arch_mmix,      {* Donald Knuth's educational processor.  *}
> +.  bfd_arch_unicore32,  {* UniCore32 *}
>  .  bfd_arch_xstormy16,
>  .#define bfd_mach_xstormy16    1
>  .  bfd_arch_msp430,    {* Texas Instruments MSP430 architecture.  *}
> @@ -501,6 +502,7 @@ extern const bfd_arch_info_type bfd_tic30_arch;
>  extern const bfd_arch_info_type bfd_tic4x_arch;
>  extern const bfd_arch_info_type bfd_tic54x_arch;
>  extern const bfd_arch_info_type bfd_tic80_arch;
> +extern const bfd_arch_info_type bfd_unicore32_arch;
>  extern const bfd_arch_info_type bfd_v850_arch;
>  extern const bfd_arch_info_type bfd_vax_arch;
>  extern const bfd_arch_info_type bfd_we32k_arch;
> @@ -570,6 +572,7 @@ static const bfd_arch_info_type * const 
> bfd_archures_list[] =
>      &bfd_tic4x_arch,
>      &bfd_tic54x_arch,
>      &bfd_tic80_arch,
> +    &bfd_unicore32_arch,
>      &bfd_v850_arch,
>      &bfd_vax_arch,
>      &bfd_w65_arch,
> diff --git a/bfd/config.bfd b/bfd/config.bfd
> index 9309502..b5e90fe 100644
> --- a/bfd/config.bfd
> +++ b/bfd/config.bfd
> @@ -102,6 +102,7 @@ sparc*)              targ_archs=bfd_sparc_arch ;;
>  spu*)            targ_archs=bfd_spu_arch ;;
>  strongarm*)     targ_archs=bfd_arm_arch ;;
>  thumb*)                 targ_archs=bfd_arm_arch ;;
> +unicore32*)     targ_archs=bfd_unicore32_arch ;;
>  v850*)          targ_archs=bfd_v850_arch ;;
>  x86_64*)        targ_archs=bfd_i386_arch ;;
>  xscale*)        targ_archs=bfd_arm_arch ;;
> @@ -1432,6 +1433,10 @@ case "${targ}" in
>      targ_underscore=yes
>      ;;
>
> +  unicore32-*-linux-gnu)
> +    targ_defvec=bfd_elf32_unicore32_vec
> +    ;;
> +
>    v850-*-*)
>      targ_defvec=bfd_elf32_v850_vec
>      ;;
> diff --git a/bfd/configure b/bfd/configure
> index 61c8d23..1152fd6 100755
> --- a/bfd/configure
> +++ b/bfd/configure
> @@ -19742,6 +19742,7 @@ do
>      bfd_elf32_spu_vec)         tb="$tb elf32-spu.lo elf32.lo $elf" ;;
>      bfd_elf32_tradbigmips_vec)  tb="$tb elf32-mips.lo elfxx-mips.lo 
> elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
>      bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo 
> elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
> +    bfd_elf32_unicore32_vec)   tb="$tb elf32-unicore32.lo elf32.lo $elf" ;;
>      bfd_elf32_us_cris_vec)     tb="$tb elf32-cris.lo elf32.lo $elf" ;;
>      bfd_elf32_v850_vec)                tb="$tb elf32-v850.lo elf32.lo $elf" 
> ;;
>      bfd_elf32_vax_vec)         tb="$tb elf32-vax.lo elf32.lo $elf" ;;
> diff --git a/bfd/elf32-unicore32.c b/bfd/elf32-unicore32.c
> new file mode 100644
> index 0000000..a8416e2
> --- /dev/null
> +++ b/bfd/elf32-unicore32.c
> @@ -0,0 +1,21 @@
> +/*
> + * 32-bit ELF support for UniCore32
> + * Contributed by Guan Xuetao <gxt@xxxxxxxxxxxxxxx>
> + * This file is part of BFD, the Binary File Descriptor library.
> + */
> +
> +#include "sysdep.h"
> +#include "bfd.h"
> +#include "libbfd.h"
> +#include "elf-bfd.h"
> +#include "libiberty.h"
> +
> +
> +#define ELF_ARCH                       bfd_arch_unicore32
> +#define ELF_MACHINE_CODE               EM_UNICORE32
> +#define ELF_MAXPAGESIZE                        0x1000
> +
> +#define TARGET_LITTLE_SYM              bfd_elf32_unicore32_vec
> +#define TARGET_LITTLE_NAME             "elf32-unicore32"
> +
> +#include "elf32-target.h"
> diff --git a/bfd/targets.c b/bfd/targets.c
> index dc644c2..6e274bd 100644
> --- a/bfd/targets.c
> +++ b/bfd/targets.c
> @@ -662,6 +662,7 @@ extern const bfd_target bfd_elf32_sparc_vxworks_vec;
>  extern const bfd_target bfd_elf32_spu_vec;
>  extern const bfd_target bfd_elf32_tradbigmips_vec;
>  extern const bfd_target bfd_elf32_tradlittlemips_vec;
> +extern const bfd_target bfd_elf32_unicore32_vec;
>  extern const bfd_target bfd_elf32_us_cris_vec;
>  extern const bfd_target bfd_elf32_v850_vec;
>  extern const bfd_target bfd_elf32_vax_vec;
> @@ -1000,6 +1001,7 @@ static const bfd_target * const _bfd_target_vector[] =
>         &bfd_elf32_spu_vec,
>         &bfd_elf32_tradbigmips_vec,
>         &bfd_elf32_tradlittlemips_vec,
> +       &bfd_elf32_unicore32_vec,
>         &bfd_elf32_us_cris_vec,
>         &bfd_elf32_v850_vec,
>         &bfd_elf32_vax_vec,
> diff --git a/config.sub b/config.sub
> index 63bfff0..eededb9 100755
> --- a/config.sub
> +++ b/config.sub
> @@ -285,6 +285,7 @@ case $basic_machine in
>         | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
>         | spu | strongarm \
>         | tahoe | thumb | tic4x | tic80 | tron \
> +       | unicore32 \
>         | v850 | v850e \
>         | we32k \
>         | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
> --
> 1.7.0.4
>
>

管老师,

这个Patch在我这里也没问题. 我已经apply了. 谢谢!

不过有两个问题:
1) 我们以后就先在2.19.1这个版本上做修改是吗?
2) 您patch基于的repo和我的似乎不太一样, 我需要--ignore-whitespace才能apply您的patch.
我感觉这样还是不大好, 您觉得呢?

祝好,
智猷

Other related posts: