This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to split embedded and linux sh targets


On Jan 16,  3:27pm, J.T. Conklin wrote:

> >>>>> "Michael" == Michael Snyder <msnyder@redhat.com> writes:
> Michael> What exactly is broken?  What are you fixing?  As far as I
> Michael> know, "sh-elf" builds, and so does "sh-linux-elf".
> 
> Because sh.mt includes solib.o and solib-svr4.o in TDEPFILES, it does
> not build on systems without SysVr4-like shared libraries.
> 
> For example, on NetBSD/i386 1.3, the sh-elf build fails like:
> 
> In file included from ../../gdb/solib-svr4.c:40:
> /usr/include/link.h:85: field `nlist' has incomplete type
> ../../gdb/solib-svr4.c: In function `default_svr4_fetch_link_map_offsets':
> ../../gdb/solib-svr4.c:146: sizeof applied to an incomplete type
> ../../gdb/solib-svr4.c:148: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:149: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:151: sizeof applied to an incomplete type
> ../../gdb/solib-svr4.c:153: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:154: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:156: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:157: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:159: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:160: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:162: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c:163: dereferencing pointer to incomplete type
> ../../gdb/solib-svr4.c: In function `elf_locate_base':
> ../../gdb/solib-svr4.c:681: `DT_NULL' undeclared (first use this function)
> ../../gdb/solib-svr4.c:681: (Each undeclared identifier is reported only once
> ../../gdb/solib-svr4.c:681: for each function it appears in.)
> ../../gdb/solib-svr4.c:683: `DT_DEBUG' undeclared (first use this function)
> 
> I suspect that this is because in 1.3, NetBSD/i386 used a SunOS like
> shared library scheme and it's link.h header is quite different than
> what you'd find on a SysVr4/ELF system.

Andrew pointed out this problem to me in the past too.  When I
reorganized the shared library code a while back, it was my intention
that solib-svr4.c be buildable everywhere.  (It won't necessarily get
used, but it is essential that it be built in order for the multiarch
dream to becomd a reality.)

We can fix this by doing one (or more?) of the following:

  1) Fix the ifdefs in default_svr4_fetch_link_map_offsets to include
     the correct patch of code automatically when HAVE_LINK_H is
     defined.  At the moment, a GDB header file must either define
     SVR4_SHARED_LIBS or not.  (Perhaps an autoconf test could
     be used for this?)

  2) Remove default_svr4_fetch_link_map_offsets from solib-svr4.c
     altogether.  Of course, this just moves the problem somewhere
     else.  It still has to be handled.  If we had all of our targets
     which depend on this code multiarched, we could just could
     make the *-tdep.c files responsible for setting up the
     fetch_link_map_offsets method.

Anyway, I'd prefer to see us fix the problem in solib-svr4.c.  (There
may still be some good reasons to split the configs though.)

> Since the shared library support is unnecessary for an embedded
> target, the easiest thing was to split apart the linux and embedded
> configs.  

It is easier, but there are embedded targets these days which are
requiring shared library support.

> The problem remains that you won't be able to build a sh-linux cross
> GDB on some systems.  I think that will require that we add a header
> file to src/include/elf (or something like that) so that solib-svr4.c
> is not dependent on any host includes.

I think this is a good idea.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]