Re: problem with fetch_link_map_offsets

Kris Warkentin
2003-06-10T14:53:49Z

> > > Yeah but....a QNX binary is just an ordinary elf binary. There are no
> > > special sections or magic in there for the sniffer to catch. Hence my
> > > problem. Perhaps it should be returning unknown so that another
sniffer
> > > (like my one liner) could get it?
> > >
> >
> > NetBSD binaries look like ordinary ELF too, as do Linux. The only way
to
> > resolve this is to arange for the crt0.o file to contain some magic that
> > GDB can find. Normally this is a special .note section.
> >
> > Can you not arrange for QNX binaries to have such a note and then add
> that.
>
> Perhaps. I'll have to talk to some of the folk here. I think it would be
> really handy to be able to recognize one of our binaries. Thanks for the
> suggestion.

Here's a fix that works right now: If I put the code below into
generic_elf_osabi_sniff_abi_tag_sections(), the sniffer does its job. The
problem with this is that it will only work on dynamically linked binaries.
Convenient as a stop-gap and for a certain amount of backwards
compatability. I think the .note.qnxnto.ident section is still a good idea
though. I tried putting one into our crtbegin.o but then programs were core
dumping so I'm doing something wrong there. I'll have to talk to the OS
folks.

cheers,

Kris

/* QNX Neutrino has ldqnx.so as its linker. */
if (strcmp (name, ".interp") == 0 && sectsize > 0)
{
char *buf = alloca(sectsize);
bfd_get_section_contents(abfd, sect, buf, 0, sectsize);
buf[sectsize] = '\0'; /* Safety first boys and girls. */
if(strstr(buf, "ldqnx.so"))
*os_ident_ptr = GDB_OSABI_QNXNTO;
return;
}