This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: extending elf32-i386 BFD backend
- From: "Graeme Peterson" <gp at qnx dot com>
- To: drow at mvista dot com (Daniel Jacobowitz)
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 22 Mar 2002 13:34:47 -0500 (EST)
- Subject: Re: extending elf32-i386 BFD backend
Thanks, Daniel. I had considered this, but as you say, it's
not the cleanest design. Here we go!
Any pointers/URLs on adding a new BFD target?
Thanks.
GP
>
> On Fri, Mar 22, 2002 at 12:42:12PM -0500, Graeme Peterson wrote:
> > Hi, all.
> >
> > I'm working on the i386-pc-nto-qnx support for binutils.
> > QNX now has Copyright Assignment, and the ntox86 support
> > is ready for submission, with one exception.
> >
> > Throughout elf.c, there are checks to see if a segment
> > is loadable (or not):
> >
> > if (segment->type == PT_LOAD)
> >
> > or
> >
> > if (phdr->p_type == PT_LOAD)
> >
> > QNX6 has 2 other loadable ptypes defined in our sys/elf.h
> >
> > PT_COMPRESS = 0x4000
> > PT_SEGREL = 0x4001
> >
> > Nick Clifton has been very helpful (Thanks Nick!), and suggests
> > I add a new BFD backend function, and then have a macro in
> > bfd/elf.c :
> >
> > #define IS_LOADABLE_SEGMENT(abfd, seg, bed) \
> > (bed->is_loadable_segment \
> > ? bed->is_loadable_segment (abfd, seg) \
> > : (seg)->type == PT_LOAD)
> >
> > The only way (I think) I know to do that is to copy elf32-i386.c,
> > rename it to something like elfqnx-i386.c, add the BFD backend
> > extension, and put the support in config.bfd, Makefile.in, targets.c...
> > (I have never added a new BFD backend, so the above may not be
> > right).
>
> The general way to do this is in BFD is:
> - prefix the definition with #ifndef IS_LOADABLE_SEGMENT
> - Create elfqnx-i386.c which defines it and #include "elf32-i386.c"
>
> (Not the cleanest design, perhaps, but it's what we've got right
> now...)
>
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer
>