This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFC] Cross core support
Hi Daniel,
> I'm not entirely sure what you mean by "protected by ifdefs"; how
> would that help us compare them against the native values?
Sorry I wasn't very clear. I imagined you creating the table like
this:
#define NOTE_foo_OFFSET_bar 55
#ifdef HAVE_PRSTATUS_T
#if offsetof (foo,bar) != NOT_foo_OFFSET_bar
#error "Offset of 'bar' in 'foo' has chnaged."
#endif
#endif
Obviously this is just a rough idea, but my though was to make the
preprocessot check the offsets if the actual structure definitions
were available.
> 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?
Yes.
> 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.
Wow, so fast!
Cheers
Nick