This is the mail archive of the 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 ?

On Fri, Sep 21, 2012 at 12:26 AM, Shawn <> wrote:
> On 2012å09æ21æ 01:27, Ian Lance Taylor wrote:
>> On Wed, Sep 19, 2012 at 11:41 PM, Shawn <> wrote:
>>>      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.
>> Although gold is part of the binutils, it does not use BFD.  So to
>> port gold it would suffice to just change the top level configure and
>> make files.
> Thanks Ian, that's great, GOLD is a nice work. I plan to take the
> gold/ & elfcpp/powerpc.h as my start point.
> But I still have some questions. At first I have tried to compile the gold
> separately with following command :
> ======================================
> ~/Work/binutils/binutils-mpu-2.22/gold/configure
> --prefix=/home/xiesl/Tools/binutils/
> make
> but error occurs:
> ======================================
> /home/xiesl/Work/binutils/binutils-mpu-2.22/gold/ fatal
> errorï ../bfd/bfdver.hïno such file or directory
> compilation interrupted.
> make[2]: *** [options.o] error 1
> make[2]:leaving `/tmp/build'
> make[1]: *** [all-recursive] error 1
> make[1]:leaving `/tmp/build'
> make: *** [all] error 2
> So can I compile the gold separately ?

No, you're right, the unmodified sources do require that the BFD
library be built.  But the only file that is required from BFD is in
fact bfdver.h, and it is only used for the output of gold --version
and --help.  You could write your own copy of that file (look for
bfdver.h in bfd/ and not bother with the rest of BFD.  In
particular BFD does not have to actually work for your processor.

> and the run the aclocal & autoconf , but errors
> ======================================
> xiesl@ubuntu:~/Work/binutils/binutils-mpu-2.22/bfd$ aclocal
> warning: macro `AM_BINUTILS_WARNINGS' not found in library
> xiesl@ubuntu:~/Work/binutils/binutils-mpu-2.22/bfd$ autoconf
> error: possibly undefined macro: AM_BINUTILS_WARNINGS
> If this token and others are legitimate, please use m4_pattern_allow.
> See the Autoconf documentation.
> ======================================

It looks like you didn't pass the right options to aclocal.  It's
easier to simply run autoreconf.  If you really want to run aclocal,
run "aclocal -I . -I .. -I ../config".

> By the way, I have used the option "--enable-maintainer-mode" at the first
> try, Will this option update the configuration script automatically ?

It will cause the configuration script to be updated when you run
"make" if any of the inputs files are out of date.  You still have to
get the right configuration scripts the first time around.


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