This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to add a new target in binutils ?


2012/9/20 Shawn <shaolin.xie@ia.ac.cn>:
> Hi, All:
>     I'm new to binutils and I want to port a linker  to a new architecture.
> What I need is just a very basic linker , which can link static elf object
> files or static libraries into executables, no functionality for shared
> library or dynamic link.
>     I tried the Gold first,  but found it has been bounded to the binutils,
> and can't be compiled separately. so I tried to port the bintuils as a
> whole.
>     I have read the "Binutils Porting Guide To A New Target Architecture"
> written by MR.Swami.Reddy@nsc.com, which seems to be very helpful for me.
> But  I 'm stucking in some details now.
>     First I want to get a full functional configure& compile system for this
> port,  say "mpu". I begin with reviewing the example port "cr16" in the
> tutorial.   Here is what I have done:
>     1.  Download binutils-2.22.tar.gz
>     2.  copy follow file and change the name from "cr16" to "mpu"
>          a).bfd/cpu-cr16.c
>          b).bfd/elf32-cr16.c
>          c).gas/config/tc-cr16.c
>          d).gas/config/tc-cr16.h
>          e).include/elf/cr16.h
>          f).include/opcode/cr16.h
>          g).ld/emulparams/elf32cr16.sh
>          h).ld/emultempl/cr16elf.em
>          i).ld/scripttempl/elf32cr16.sc
>          j).opcodes/cr16-dis.c
>          k).opcodes/cr16-opc.c
>     3. add corresponding entry in the following configuration files:
>         a) bfd/Makefile.amb
>         b) bfd/archures.c
>         c)  bfd/bfd-in2.h
>         d)  bfd/config.bfd
>         e)  bfd/configure.in
>         f)  bfd/libbfd.h
>         g)  bfd/targets.c
>         h)  binutils/readelf.c
>         i)  config.sub
>         j)  gas/Makefile.am
>         k)  gas/configure.tgt
>         l)   include/dis-asm.h
>         m)  include/elf/common.h
>         n)  ld/Makefile.am
>         o)  ld/configure.tgt
>         p)  opcodes/Makefile.am
>         q)  opcodes/configure.in
>         r)  opcodes/disassemble.c
>
>      3)configure the script with following command:
>         ~/Work/binutils/binutils-mpu-2.22/configure  \
>         --prefix=/home/xiesl/Tools/binutils                \
>         --target=mpu-elf                                          \
>         --enable-maintainer-mode
>
>       4). run make , but error occurs:
>         configure: error: *** unknown target vector bfd_elf32_mpu_vec
>         make[1]: *** [configure-bfd] error 1
>         make[1]:leaving directory `/tmp/build'
>         make: *** [all] error 2
> ===================================
> I really hope someone can give me some advice , for porting the linker, or
> this error message. Thanks.
>
> Shawn.
>
>
>
>
>

I guess there are 2 ways to figure out this problem:
1. modify ${top}/configure.ac and run autoreconf to regenerate the
'configure' shell script.
    this is recommended but trivial and new problems may occur related
to autotools.

2. directly modify ${top}/configure shell script, add necessary info
on 'mpu'. This is dirty and rude, but
    will save some time at the beginning.

regards.
-- 
杨勇勇 (Yang Yongyong)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]