Re: [PATCH 1/3] Implement new Linux target vectors on BFD

Pedro Alves
2013-01-31T17:19:45Z

On 01/30/2013 04:42 PM, Sergio Durigan Junior wrote:
> On Wednesday, January 30 2013, Alan Modra wrote:

>> Duplicating targets isn't a really good idea.

> Hm, thank you for the explanation, it didn't occurred to me.

Indeed. Thanks.

>> You may have noticed that we've already made a mess of targets for
>> ARM, i386, x86_64 and powerpc. I'd rather not see the same happen for
>> powerpc64 without a really good reason.
>
> Right. Now I am stuck with this, then. While Pedro wants this feature
> to be Linux-specific, now there is this problem with target
> duplication.

It's not about what I want. It's about the fact that different
targets/OSs have different prpsinfo etc. structures.

> I will look for other solutions here, but if you alreay have some idea
> on how to handle it, I'd be glad to read.

My idea is to cut the middle man. AFAICS, only GDB wants to generate
core files presently. GDB has a whole OS/arch sniffer mechanism in
place, where we know which target/arch/OS it is that is being
debugged. So rather than having bfd know which prpsinfo layout we
want, and shoehorn different elf_internal_prpsinfo & friends
structures through the elfcore_write_note/va_args generic interface,
skip the bfd vector, and add new entry points in bfd for each possible
output, and have GDB pick the one it needs. Since most Linux archs
have the same prpsinfo32 and prpsinfo64 layout, we just put the
default Linux implementations in elf.c. PPC32, being the odd one out,
gets its own implementation. I'll send updated bfd and gdb patches
as response to this email.

--
Pedro Alves