[RFC] Cross core support

Daniel Jacobowitz dmj+@andrew.cmu.edu
Thu Jun 28 11:25:00 GMT 2001


On Thu, Jun 28, 2001 at 07:04:09PM +0100, Nick Clifton wrote:
> Hi Daniel,
> 
>   This reply is really more of case of letting you know that your
>   message did not fall on (entirely) deaf ears.  Unfortunately I am
>   not sure what the best thing to do in this situation is either.

Nice to know someone is listening :)

> > My inclination is to provide a table for each note type of the total size of
> > the note structure on a particular platform and the offsets of the fields we
> > are interested in.  It seems very unlikely that we would find two notes of
> > the same type and the same size on different platforms where all the fields
> > we want did not correspond.  However, that solution's a little hokey.
> 
>   Yeah it is a bit hokey.  The definitions in the table ought to be
>   protected with #ifdefs, so that if the table is built on a native
>   system the values in the table can be compared against the real
>   values in the procfs.h header and the compilation abort if they are
>   wrong.  That way at least changes in the header will be noticed once
>   a native build is performed.

I'm not entirely sure what you mean by "protected by ifdefs"; how would
that help us compare them against the native values?

> > Does anyone know of a counterexample, or a better way to provide the
> > necessary information?  I suppose it could use a hook in target-specific
> > files of BFD, but I'd rather avoid that, since I suppose it would need to be
> > added to the bfd vector in that case.
> 
>   Why would that be a bad thing ?  Actually you could add it to the
>   elf_backend_data structure so you only have to modify ELF ports, and
>   in fact since they use elfXX-target.h you would only have to modify
>   the ports that you are interested in.

That's true, I am only looking at ELF here.  My ignorance of BFD is
showing.  So I could add what I am interested in to elf_backend_data,
and replace things in elf.c like:

#if defined (HAVE_PRSTATUS_T)
    case NT_PRSTATUS:
      return elfcore_grok_prstatus (abfd, note);
#endif

with something along the lines of:
  if (bed->elf_backend_grok_prstatus)
    return (*bed->elf_backend_grok_prstatus) (abfd, note);

I'd still need to do something relatively hokey, I expect, since there
could be multiple ia32 ELF targets with differently formatted cores
(say, Linux/x86 and Solaris/x86).  However, we could then special-case
those appropriately if there was a backend function for it.

Does this sound reasonable?  If so, I'll try to work out a way to do
this with minimal code duplication for parsing all the different note
types, and send a patch later today or tomorrow.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list