diff options
40 files changed, 294 insertions, 140 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 97f93bd..f5fe415 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,69 @@ 2001-03-09 Kevin Buettner <kevinb@redhat.com> + * Makefile.in (solib-svr4.o): Depend on solib-svr4.c, not solib.c. + (solib-legacy.o): New makefile target. + * solib-legacy.c: New file. + * solib-svr4.h (SVR4_FETCH_LINK_MAP_OFFSETS): Delete. + (default_svr4_fetch_link_map_offsets): Delete. + (set_solib_svr4_fetch_link_map_offsets): Declare. + (legacy_svr4_fetch_link_map_offsets_hook): Declare. + * solib-svr4.c (elf/common.h): Include. + (link.h): Only include for SunOS shared library support. + (_SYSCALL32): Don't define. + (SVR4_FETCH_LINK_MAP_OFFSETS): Define. + (default_svr4_fetch_link_map_offsets): Made static; added forward + declaration. + (fetch_link_map_offsets): New static global. + (legacy_svr4_fetch_link_map_offsets_hook): New global variable. + (default_svr4_fetch_link_map_offsets): Rewritten. The guts + of what used to be in this function now reside in + legacy_svr4_fetch_link_map_offsets() in solib-legacy.c. + (open_symbol_file_object): Fix declaration in SunOS section + of the code. + (set_solib_svr4_fetch_link_map_offsets): New extern function. + (init_fetch_link_map_offsets): New static function. + (_initialize_svr4_solib): Put static global fetch_link_map_offsets + under multiarch control. + + * config/alpha/alpha-linux.mt (TDEPFILES): Add solib-legacy.o to + list. + * config/alpha/fbsd.mh (NATDEPFILES): Likewise. + * config/arm/linux.mt (TDEPFILES): Likewise. + * config/i386/fbsd.mh (NATDEPFILES): Likewise. + * config/i386/i386dgux.mh (NATDEPFILES): Likewise. + * config/i386/i386gnu.mh (NATDEPFILES): Likewise. + * config/i386/i386sco5.mh (NATDEPFILES): Likewise. + * config/i386/i386sol2.mt (TDEPFILES): Likewise. + * config/i386/i386v4.mh (NATDEPFILES): Likewise. + * config/i386/i386v42mp.mh (NATDEPFILES): Likewise. + * config/i386/linux.mt (TDEPFILES): Likewise. + * config/i386/nbsd.mh (NATDEPFILES): Likewise. + * config/i386/nbsdelf.mh (NATDEPFILES): Likewise. + * config/i386/ncr3000.mt (TDEPFILES): Likewise. + * config/i386/ptx4.mh (XDEPFILES): Likewise. + * config/i386/sun386.mt (TDEPFILES): Likewise. + * config/ia64/linux.mt (TDEPFILES): Likewise. + * config/m68k/linux.mt (TDEPFILES): Likewise. + * config/m68k/m68kv4.mh (NATDEPFILES): Likewise. + * config/m68k/nbsd.mh (NATDEPFILES): Likewise. + * config/m68k/sun2os4.mt (TDEPFILES): Likewise. + * config/m68k/sun3os4.mt (TDEPFILES): Likewise. + * config/m88k/delta88v4.mh (NATDEPFILES): Likewise. + * config/mips/mipsv4.mh (NATDEPFILES): Likewise. + * config/ns32k/nbsd.mh (NATDEPFILES): Likewise. + * config/powerpc/linux.mt (TDEPFILES): Likewise. + * config/powerpc/nbsd.mh (NATDEPFILES): Likewise. + * config/powerpc/solaris.mh (NATDEPFILES): Likewise. + * config/sh/linux.mt (TDEPFILES): Likewise. + * config/sparc/linux.mt (TDEPFILES): Likewise. + * config/sparc/nbsd.mh (NATDEPFILES): Likewise. + * config/sparc/nbsdelf.mh (NATDEPFILES): Likewise. + * config/sparc/sp64linux.mt (TDEPFILES): Likewise. + * config/sparc/sun4os4.mt (TDEPFILES): Likewise. + * config/sparc/sun4sol2.mh (NATDEPFILES): Likewise. + +2001-03-09 Kevin Buettner <kevinb@redhat.com> + * utils.c (xmrealloc, xcalloc): Return NULL for zero-sized requests. 2001-03-09 Andrew Cagney <ac131313@redhat.com> diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 3a6c5c3..3a925f6 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1905,10 +1905,12 @@ mon960-rom.o: mon960-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \ solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ objfiles.h gnu-regex.h symfile.h target.h gdb_string.h solist.h -solib-svr4.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ +solib-svr4.o: solib-svr4.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ objfiles.h gnu-regex.h symfile.h target.h gdb_string.h solist.h \ solib-svr4.h $(regcache_h) +solib-legacy.o: solib-legacy.c $(defs_h) $(gdbcore_h) solib-svr4.h + source.o: source.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \ $(gdbcore_h) language.h objfiles.h gnu-regex.h symfile.h $(symtab_h) \ gdb_string.h source.h completer.h linespec.h diff --git a/gdb/config/alpha/alpha-linux.mt b/gdb/config/alpha/alpha-linux.mt index a487907..dd1c8e2 100644 --- a/gdb/config/alpha/alpha-linux.mt +++ b/gdb/config/alpha/alpha-linux.mt @@ -1,3 +1,3 @@ # Target: Little-endian Alpha -TDEPFILES= alpha-tdep.o solib.o solib-svr4.o +TDEPFILES= alpha-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-alphalinux.h diff --git a/gdb/config/alpha/fbsd.mh b/gdb/config/alpha/fbsd.mh index 17fb44d..f59bca5 100644 --- a/gdb/config/alpha/fbsd.mh +++ b/gdb/config/alpha/fbsd.mh @@ -1,6 +1,7 @@ # Host: FreeBSD/Alpha XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o \ +NATDEPFILES= fork-child.o infptrace.o inftarg.o \ + solib.o solib-svr4.o solib-legacy.o \ corelow.o core-regset.o alphabsd-nat.o XM_FILE= xm-fbsd.h NAT_FILE= nm-fbsd.h diff --git a/gdb/config/arm/linux.mt b/gdb/config/arm/linux.mt index 827447c..a02289d 100644 --- a/gdb/config/arm/linux.mt +++ b/gdb/config/arm/linux.mt @@ -1,5 +1,5 @@ # Target: ARM based machine running GNU/Linux TM_FILE= tm-linux.h -TDEPFILES= arm-tdep.o arm-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= arm-tdep.o arm-linux-tdep.o solib.o solib-svr4.o solib-legacy.o GDBSERVER_DEPFILES= low-linux.o diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh index f2a01fa..4a99e15 100644 --- a/gdb/config/i386/fbsd.mh +++ b/gdb/config/i386/fbsd.mh @@ -1,6 +1,6 @@ # Host: Intel 386 running FreeBSD XDEPFILES= # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o corelow.o core-aout.o core-regset.o i387-nat.o i386bsd-nat.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i387-nat.o i386bsd-nat.o XM_FILE= xm-fbsd.h NAT_FILE= nm-fbsd.h diff --git a/gdb/config/i386/i386dgux.mh b/gdb/config/i386/i386dgux.mh index ca74480..bbf9f91 100644 --- a/gdb/config/i386/i386dgux.mh +++ b/gdb/config/i386/i386dgux.mh @@ -6,5 +6,6 @@ XDEPFILES= XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-i386v4.h -NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \ +NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ + solib.o solib-svr4.o solib-legacy.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/i386/i386gnu.mh b/gdb/config/i386/i386gnu.mh index e871eff..8f84c87 100644 --- a/gdb/config/i386/i386gnu.mh +++ b/gdb/config/i386/i386gnu.mh @@ -1,6 +1,6 @@ # Host: Intel 386 running the GNU Hurd XDEPFILES= i387-tdep.o -NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o solib-svr4.o corelow.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o +NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o solib-svr4.o solib-legacy.o corelow.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o XM_FILE= xm-i386gnu.h NAT_FILE= nm-gnu.h MH_CFLAGS = -D_GNU_SOURCE diff --git a/gdb/config/i386/i386sco5.mh b/gdb/config/i386/i386sco5.mh index d53a2df..be71e77 100644 --- a/gdb/config/i386/i386sco5.mh +++ b/gdb/config/i386/i386sco5.mh @@ -13,5 +13,5 @@ XM_CLIBS= -lPW -lsocket NAT_FILE= nm-i386sco5.h NATDEPFILES= infptrace.o inftarg.o fork-child.o corefile.o core-aout.o \ - corelow.o i386v-nat.o solib.o solib-svr4.o + corelow.o i386v-nat.o solib.o solib-svr4.o solib-legacy.o diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt index 0c4524e..86d93a3 100644 --- a/gdb/config/i386/i386sol2.mt +++ b/gdb/config/i386/i386sol2.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running SVR4 -TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o +TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-i386sol2.h diff --git a/gdb/config/i386/i386v4.mh b/gdb/config/i386/i386v4.mh index b203a23..50347ab 100644 --- a/gdb/config/i386/i386v4.mh +++ b/gdb/config/i386/i386v4.mh @@ -6,5 +6,6 @@ XDEPFILES= XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-i386v4.h -NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \ +NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ + solib.o solib-svr4.o solib-legacy.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/i386/i386v42mp.mh b/gdb/config/i386/i386v42mp.mh index b696f2f..27123c0 100644 --- a/gdb/config/i386/i386v42mp.mh +++ b/gdb/config/i386/i386v42mp.mh @@ -8,6 +8,7 @@ XM_CLIBS= -lsocket -lnsl # we don't want nm-i386v4.h since that defines LOSING_POLL which isn't # appropriate for i386v42mp NAT_FILE= nm-i386v42mp.h -NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \ +NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ + solib.o solib-svr4.o solib-legacy.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o uw-thread.o diff --git a/gdb/config/i386/linux.mt b/gdb/config/i386/linux.mt index 1721827..963fbdd 100644 --- a/gdb/config/i386/linux.mt +++ b/gdb/config/i386/linux.mt @@ -1,5 +1,6 @@ # Target: Intel 386 running GNU/Linux -TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o solib.o solib-svr4.o +TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o \ + solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h GDBSERVER_DEPFILES= low-linux.o diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsd.mh index dce0eb5..f059608 100644 --- a/gdb/config/i386/nbsd.mh +++ b/gdb/config/i386/nbsd.mh @@ -1,5 +1,6 @@ # Host: Intel 386 running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o \ + solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh index 10e22dc..1a49ce0 100644 --- a/gdb/config/i386/nbsdelf.mh +++ b/gdb/config/i386/nbsdelf.mh @@ -1,5 +1,5 @@ # Host: Intel 386 running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsdelf.h diff --git a/gdb/config/i386/ncr3000.mt b/gdb/config/i386/ncr3000.mt index 6ebefc5..11bc474 100644 --- a/gdb/config/i386/ncr3000.mt +++ b/gdb/config/i386/ncr3000.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running SVR4 -TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o +TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-i386v4.h diff --git a/gdb/config/i386/ptx4.mh b/gdb/config/i386/ptx4.mh index ba951f0..8650063 100644 --- a/gdb/config/i386/ptx4.mh +++ b/gdb/config/i386/ptx4.mh @@ -1,7 +1,8 @@ # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387 XM_FILE= xm-ptx4.h -XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o solib.o solib-svr4.o core-regset.o +XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o \ + core-regset.o solib.o solib-svr4.o solib-legacy.o XM_CLIBS= -lseq NAT_FILE= nm-ptx4.h diff --git a/gdb/config/i386/sun386.mt b/gdb/config/i386/sun386.mt index 152a4a3..2cbe3cd 100644 --- a/gdb/config/i386/sun386.mt +++ b/gdb/config/i386/sun386.mt @@ -1,3 +1,3 @@ # Target: Sun 386i target configuration file. -TDEPFILES= i386-tdep.o solib.o solib-svr4.o +TDEPFILES= i386-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-sun386.h diff --git a/gdb/config/ia64/linux.mt b/gdb/config/ia64/linux.mt index e536ef2..c9a5c3c 100644 --- a/gdb/config/ia64/linux.mt +++ b/gdb/config/ia64/linux.mt @@ -1,5 +1,6 @@ # Target: Intel IA-64 running GNU/Linux -TDEPFILES= ia64-tdep.o ia64-aix-tdep.o ia64-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= ia64-tdep.o ia64-aix-tdep.o ia64-linux-tdep.o \ + solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h GDBSERVER_DEPFILES= low-linux.o diff --git a/gdb/config/m68k/linux.mt b/gdb/config/m68k/linux.mt index 6c4abff..7598fc5 100644 --- a/gdb/config/m68k/linux.mt +++ b/gdb/config/m68k/linux.mt @@ -1,3 +1,3 @@ # Target: Motorola m68k with a.out and ELF -TDEPFILES= m68k-tdep.o solib.o solib-svr4.o +TDEPFILES= m68k-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h diff --git a/gdb/config/m68k/m68kv4.mh b/gdb/config/m68k/m68kv4.mh index 08171ab..e825bee 100644 --- a/gdb/config/m68k/m68kv4.mh +++ b/gdb/config/m68k/m68kv4.mh @@ -4,5 +4,5 @@ XM_FILE= xm-m68kv4.h XDEPFILES= NAT_FILE= nm-sysv4.h -NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o procfs.o \ - proc-api.o proc-events.o proc-flags.o proc-why.o +NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o solib-legacy.o \ + fork-child.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/m68k/nbsd.mh b/gdb/config/m68k/nbsd.mh index 4300ff9..f02abd4 100644 --- a/gdb/config/m68k/nbsd.mh +++ b/gdb/config/m68k/nbsd.mh @@ -1,5 +1,5 @@ # Host: Motorola m68k running NetBSD XDEPFILES= -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o solib.o solib-svr4.o +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/m68k/sun2os4.mt b/gdb/config/m68k/sun2os4.mt index 20211a3..7176b16 100644 --- a/gdb/config/m68k/sun2os4.mt +++ b/gdb/config/m68k/sun2os4.mt @@ -1,3 +1,3 @@ # Target: Sun 2, running SunOS 4 -TDEPFILES= solib.o solib-svr4.o m68k-tdep.o +TDEPFILES= solib.o solib-svr4.o solib-legacy.o m68k-tdep.o TM_FILE= tm-sun2os4.h diff --git a/gdb/config/m68k/sun3os4.mt b/gdb/config/m68k/sun3os4.mt index 248b8ad..65e799f 100644 --- a/gdb/config/m68k/sun3os4.mt +++ b/gdb/config/m68k/sun3os4.mt @@ -1,3 +1,3 @@ # Target: Sun 3, running SunOS 4, as a target system -TDEPFILES= solib.o solib-svr4.o m68k-tdep.o +TDEPFILES= solib.o solib-svr4.o solib-legacy.o m68k-tdep.o TM_FILE= tm-sun3os4.h diff --git a/gdb/config/m88k/delta88v4.mh b/gdb/config/m88k/delta88v4.mh index a225c18..4138a1a 100644 --- a/gdb/config/m88k/delta88v4.mh +++ b/gdb/config/m88k/delta88v4.mh @@ -4,5 +4,6 @@ XM_FILE= xm-delta88v4.h XDEPFILES= NAT_FILE= nm-delta88v4.h -NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o solib.o solib-svr4.o \ +NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o \ + solib.o solib-svr4.o solib-legacy.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/mips/mipsv4.mh b/gdb/config/mips/mipsv4.mh index 61d0ce2..1a6104b 100644 --- a/gdb/config/mips/mipsv4.mh +++ b/gdb/config/mips/mipsv4.mh @@ -1,5 +1,6 @@ # Host: Mips running SVR4 XM_FILE= xm-mipsv4.h NAT_FILE= ../nm-sysv4.h -NATDEPFILES= fork-child.o mipsv4-nat.o corelow.o core-regset.o solib.o solib-svr4.o \ +NATDEPFILES= fork-child.o mipsv4-nat.o corelow.o core-regset.o \ + solib.o solib-svr4.o solib-legacy.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsd.mh index 711cbe4..42d8b8d 100644 --- a/gdb/config/ns32k/nbsd.mh +++ b/gdb/config/ns32k/nbsd.mh @@ -1,5 +1,5 @@ # Host: PC532 running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt index b809a6e..0e3d068 100644 --- a/gdb/config/powerpc/linux.mt +++ b/gdb/config/powerpc/linux.mt @@ -1,3 +1,3 @@ # Target: Motorola PPC on Linux -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh index ea10d86..4232bfd 100644 --- a/gdb/config/powerpc/nbsd.mh +++ b/gdb/config/powerpc/nbsd.mh @@ -1,5 +1,5 @@ # Host: PowerPC, running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/powerpc/solaris.mh b/gdb/config/powerpc/solaris.mh index 29ad094..8600cb0 100644 --- a/gdb/config/powerpc/solaris.mh +++ b/gdb/config/powerpc/solaris.mh @@ -5,8 +5,8 @@ XDEPFILES= XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-solaris.h -NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \ - proc-api.o proc-events.o proc-flags.o proc-why.o +NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o solib-legacy.o \ + fork-child.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o # If you are compiling with Sun's compiler, add the -xs option to CC # (e.g. `make CC="cc -xs"'). diff --git a/gdb/config/sh/linux.mt b/gdb/config/sh/linux.mt index 0653432..8f217cc 100644 --- a/gdb/config/sh/linux.mt +++ b/gdb/config/sh/linux.mt @@ -1,5 +1,5 @@ # Target: Hitachi Super-H running GNU/Linux -TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o solib.o solib-svr4.o +TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h SIM_OBS = remote-sim.o diff --git a/gdb/config/sparc/linux.mt b/gdb/config/sparc/linux.mt index 186c650..d6cf773 100644 --- a/gdb/config/sparc/linux.mt +++ b/gdb/config/sparc/linux.mt @@ -1,3 +1,3 @@ # Target: Sparcstation, running Linux -TDEPFILES= sparc-tdep.o solib.o solib-svr4.o +TDEPFILES= sparc-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h diff --git a/gdb/config/sparc/nbsd.mh b/gdb/config/sparc/nbsd.mh index 1ea8750..4a7d457 100644 --- a/gdb/config/sparc/nbsd.mh +++ b/gdb/config/sparc/nbsd.mh @@ -1,6 +1,6 @@ # Host: Sun 4 or Sparcstation, running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h HOST_IPC=-DBSD_IPC diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh index ebba3ab..6b08691 100644 --- a/gdb/config/sparc/nbsdelf.mh +++ b/gdb/config/sparc/nbsdelf.mh @@ -1,6 +1,6 @@ # Host: Sun 4 or Sparcstation, running NetBSD XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsdelf.h HOST_IPC=-DBSD_IPC diff --git a/gdb/config/sparc/sp64linux.mt b/gdb/config/sparc/sp64linux.mt index b42c4c0..d7d642e 100644 --- a/gdb/config/sparc/sp64linux.mt +++ b/gdb/config/sparc/sp64linux.mt @@ -1,3 +1,3 @@ # Target: UltraSPARC, running Linux 64bit programs -TDEPFILES= sparc-tdep.o solib.o solib-svr4.o +TDEPFILES= sparc-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-sp64linux.h diff --git a/gdb/config/sparc/sun4os4.mt b/gdb/config/sparc/sun4os4.mt index 0dd4bc0..54d7853 100644 --- a/gdb/config/sparc/sun4os4.mt +++ b/gdb/config/sparc/sun4os4.mt @@ -1,3 +1,3 @@ # Target: Sun 4 or Sparcstation, running SunOS 4 -TDEPFILES= sparc-tdep.o solib.o solib-svr4.o +TDEPFILES= sparc-tdep.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-sun4os4.h diff --git a/gdb/config/sparc/sun4sol2.mh b/gdb/config/sparc/sun4sol2.mh index 9d24697..8063e16 100644 --- a/gdb/config/sparc/sun4sol2.mh +++ b/gdb/config/sparc/sun4sol2.mh @@ -5,8 +5,8 @@ XDEPFILES= XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-sun4sol2.h -NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \ - proc-api.o proc-events.o proc-flags.o proc-why.o +NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o solib-legacy.o \ + fork-child.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o # /usr/include/v9 is needed only by core-sol2.c when including # v9/sys/privregs.h, or rather the headers it in turn includes. diff --git a/gdb/solib-legacy.c b/gdb/solib-legacy.c new file mode 100644 index 0000000..29ed014 --- /dev/null +++ b/gdb/solib-legacy.c @@ -0,0 +1,127 @@ +/* Provide legacy r_debug and link_map support for SVR4-like native targets. + Copyright 2000, 2001 + Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define _SYSCALL32 /* for Sparc64 cross Sparc32 */ +#include "defs.h" +#include "gdbcore.h" +#include "solib-svr4.h" + +#ifdef HAVE_LINK_H +#include <link.h> + +/* Fetch (and possibly build) an appropriate link_map_offsets structure + for native targets using struct definitions from link.h. */ + +static struct link_map_offsets * +legacy_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = 0; +#if defined (HAVE_STRUCT_LINK_MAP32) + static struct link_map_offsets lmo32; + static struct link_map_offsets *lmp32 = 0; +#endif + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) +#endif +#define fieldsize(TYPE, MEMBER) (sizeof (((TYPE *)0)->MEMBER)) + + if (lmp == 0) + { + lmp = &lmo; + +#ifdef SVR4_SHARED_LIBS + lmo.r_debug_size = sizeof (struct r_debug); + + lmo.r_map_offset = offsetof (struct r_debug, r_map); + lmo.r_map_size = fieldsize (struct r_debug, r_map); + + lmo.link_map_size = sizeof (struct link_map); + + lmo.l_addr_offset = offsetof (struct link_map, l_addr); + lmo.l_addr_size = fieldsize (struct link_map, l_addr); + + lmo.l_next_offset = offsetof (struct link_map, l_next); + lmo.l_next_size = fieldsize (struct link_map, l_next); + + lmo.l_prev_offset = offsetof (struct link_map, l_prev); + lmo.l_prev_size = fieldsize (struct link_map, l_prev); + + lmo.l_name_offset = offsetof (struct link_map, l_name); + lmo.l_name_size = fieldsize (struct link_map, l_name); +#else /* !SVR4_SHARED_LIBS */ + lmo.link_map_size = sizeof (struct link_map); + + lmo.l_addr_offset = offsetof (struct link_map, lm_addr); + lmo.l_addr_size = fieldsize (struct link_map, lm_addr); + + lmo.l_next_offset = offsetof (struct link_map, lm_next); + lmo.l_next_size = fieldsize (struct link_map, lm_next); + + lmo.l_name_offset = offsetof (struct link_map, lm_name); + lmo.l_name_size = fieldsize (struct link_map, lm_name); +#endif /* SVR4_SHARED_LIBS */ + } + +#if defined (HAVE_STRUCT_LINK_MAP32) + if (lmp32 == 0) + { + lmp32 = &lmo32; + + lmo32.r_debug_size = sizeof (struct r_debug32); + + lmo32.r_map_offset = offsetof (struct r_debug32, r_map); + lmo32.r_map_size = fieldsize (struct r_debug32, r_map); + + lmo32.link_map_size = sizeof (struct link_map32); + + lmo32.l_addr_offset = offsetof (struct link_map32, l_addr); + lmo32.l_addr_size = fieldsize (struct link_map32, l_addr); + + lmo32.l_next_offset = offsetof (struct link_map32, l_next); + lmo32.l_next_size = fieldsize (struct link_map32, l_next); + + lmo32.l_prev_offset = offsetof (struct link_map32, l_prev); + lmo32.l_prev_size = fieldsize (struct link_map32, l_prev); + + lmo32.l_name_offset = offsetof (struct link_map32, l_name); + lmo32.l_name_size = fieldsize (struct link_map32, l_name); + } +#endif /* defined (HAVE_STRUCT_LINK_MAP32) */ + +#if defined (HAVE_STRUCT_LINK_MAP32) + if (bfd_get_arch_size (exec_bfd) == 32) + return lmp32; + else +#endif + return lmp; +} + +#endif /* HAVE_LINK_H */ + +void +_initialize_svr4_lm (void) +{ +#ifdef HAVE_LINK_H + legacy_svr4_fetch_link_map_offsets_hook = legacy_svr4_fetch_link_map_offsets; +#endif /* HAVE_LINK_H */ +} diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index eafa1b7..bad1c20 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define _SYSCALL32 /* for Sparc64 cross Sparc32 */ #include "defs.h" #include "regcache.h" @@ -34,12 +33,10 @@ #ifndef SVR4_SHARED_LIBS /* SunOS shared libs need the nlist structure. */ #include <a.out.h> +#include <link.h> #else #include "elf/external.h" -#endif - -#ifdef HAVE_LINK_H -#include <link.h> +#include "elf/common.h" #endif #include "symtab.h" @@ -59,6 +56,19 @@ #include "solist.h" #include "solib-svr4.h" +#ifndef SVR4_FETCH_LINK_MAP_OFFSETS +#define SVR4_FETCH_LINK_MAP_OFFSETS() fetch_link_map_offsets () +#endif + +static struct link_map_offsets *default_svr4_fetch_link_map_offsets (void); +static struct link_map_offsets *(*fetch_link_map_offsets)(void) = + default_svr4_fetch_link_map_offsets; + +/* legacy_svr4_fetch_link_map_offsets_hook is a pointer to a function + which is used to fetch link map offsets. It will only be set + by solib-legacy.c, if at all. */ +struct link_map_offsets *(*legacy_svr4_fetch_link_map_offsets_hook)(void) = 0; + /* Link map info to include in an allocated so_list entry */ struct lm_info @@ -122,101 +132,24 @@ static char *main_name_list[] = /* Fetch (and possibly build) an appropriate link_map_offsets structure - for native targets using struct definitions from link.h. */ + for native targets using struct definitions from link.h. + + Note: For non-native targets (i.e. cross-debugging situations), + you need to define a target specific fetch_link_map_offsets() + function and call set_solib_svr4_fetch_link_map_offsets () to + register this function. */ -struct link_map_offsets * +static struct link_map_offsets * default_svr4_fetch_link_map_offsets (void) { -#ifdef HAVE_LINK_H - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = 0; -#if defined (HAVE_STRUCT_LINK_MAP32) - static struct link_map_offsets lmo32; - static struct link_map_offsets *lmp32 = 0; -#endif - -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif -#define fieldsize(TYPE, MEMBER) (sizeof (((TYPE *)0)->MEMBER)) - - if (lmp == 0) - { - lmp = &lmo; - -#ifdef SVR4_SHARED_LIBS - lmo.r_debug_size = sizeof (struct r_debug); - - lmo.r_map_offset = offsetof (struct r_debug, r_map); - lmo.r_map_size = fieldsize (struct r_debug, r_map); - - lmo.link_map_size = sizeof (struct link_map); - - lmo.l_addr_offset = offsetof (struct link_map, l_addr); - lmo.l_addr_size = fieldsize (struct link_map, l_addr); - - lmo.l_next_offset = offsetof (struct link_map, l_next); - lmo.l_next_size = fieldsize (struct link_map, l_next); - - lmo.l_prev_offset = offsetof (struct link_map, l_prev); - lmo.l_prev_size = fieldsize (struct link_map, l_prev); - - lmo.l_name_offset = offsetof (struct link_map, l_name); - lmo.l_name_size = fieldsize (struct link_map, l_name); -#else /* !SVR4_SHARED_LIBS */ - lmo.link_map_size = sizeof (struct link_map); - - lmo.l_addr_offset = offsetof (struct link_map, lm_addr); - lmo.l_addr_size = fieldsize (struct link_map, lm_addr); - - lmo.l_next_offset = offsetof (struct link_map, lm_next); - lmo.l_next_size = fieldsize (struct link_map, lm_next); - - lmo.l_name_offset = offsetof (struct link_map, lm_name); - lmo.l_name_size = fieldsize (struct link_map, lm_name); -#endif /* SVR4_SHARED_LIBS */ - } - -#if defined (HAVE_STRUCT_LINK_MAP32) - if (lmp32 == 0) + if (legacy_svr4_fetch_link_map_offsets_hook) + return legacy_svr4_fetch_link_map_offsets_hook (); + else { - lmp32 = &lmo32; - - lmo32.r_debug_size = sizeof (struct r_debug32); - - lmo32.r_map_offset = offsetof (struct r_debug32, r_map); - lmo32.r_map_size = fieldsize (struct r_debug32, r_map); - - lmo32.link_map_size = sizeof (struct link_map32); - - lmo32.l_addr_offset = offsetof (struct link_map32, l_addr); - lmo32.l_addr_size = fieldsize (struct link_map32, l_addr); - - lmo32.l_next_offset = offsetof (struct link_map32, l_next); - lmo32.l_next_size = fieldsize (struct link_map32, l_next); - - lmo32.l_prev_offset = offsetof (struct link_map32, l_prev); - lmo32.l_prev_size = fieldsize (struct link_map32, l_prev); - - lmo32.l_name_offset = offsetof (struct link_map32, l_name); - lmo32.l_name_size = fieldsize (struct link_map32, l_name); + internal_error (__FILE__, __LINE__, +"default_svr4_fetch_link_map_offsets called without legacy link_map support enabled."); + return 0; } -#endif /* defined (HAVE_STRUCT_LINK_MAP32) */ - -#if defined (HAVE_STRUCT_LINK_MAP32) - if (bfd_get_arch_size (exec_bfd) == 32) - return lmp32; - else -#endif - return lmp; - -#else - - internal_error (__FILE__, __LINE__, - "default_svr4_fetch_link_map_offsets called without HAVE_LINK_H defined."); - return 0; - -#endif /* HAVE_LINK_H */ } /* Macro to extract an address from a solib structure. @@ -951,7 +884,7 @@ open_symbol_file_object (void *from_ttyp) #else static int -open_symbol_file_object (int *from_ttyp) +open_symbol_file_object (void *from_ttyp) { return 1; } @@ -1688,11 +1621,27 @@ svr4_relocate_section_addresses (struct so_list *so, sec->endaddr += LM_ADDR (so); } +void +set_solib_svr4_fetch_link_map_offsets (struct link_map_offsets *(*flmo) (void)) +{ + fetch_link_map_offsets = flmo; +} + +static void +init_fetch_link_map_offsets (void) +{ + set_solib_svr4_fetch_link_map_offsets (default_svr4_fetch_link_map_offsets); +} + static struct target_so_ops svr4_so_ops; void _initialize_svr4_solib (void) { + register_gdbarch_swap (&fetch_link_map_offsets, + sizeof (fetch_link_map_offsets), + init_fetch_link_map_offsets); + svr4_so_ops.relocate_section_addresses = svr4_relocate_section_addresses; svr4_so_ops.free_so = svr4_free_so; svr4_so_ops.clear_solib = svr4_clear_solib; @@ -1700,7 +1649,6 @@ _initialize_svr4_solib (void) svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling; svr4_so_ops.current_sos = svr4_current_sos; svr4_so_ops.open_symbol_file_object = open_symbol_file_object; - svr4_so_ops.open_symbol_file_object = open_symbol_file_object; svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code; /* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */ diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index d0ce954..c2ee1d3 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -64,7 +64,10 @@ struct link_map_offsets int l_name_size; }; -#ifndef SVR4_FETCH_LINK_MAP_OFFSETS -extern struct link_map_offsets *default_svr4_fetch_link_map_offsets (void); -#define SVR4_FETCH_LINK_MAP_OFFSETS() default_svr4_fetch_link_map_offsets () -#endif +extern void set_solib_svr4_fetch_link_map_offsets ( + struct link_map_offsets *(*func) (void)); + +/* legacy_svr4_fetch_link_map_offsets_hook is a pointer to a function + which is used to fetch link map offsets. It will only be set + by solib-legacy.c, if at all. */ +extern struct link_map_offsets *(*legacy_svr4_fetch_link_map_offsets_hook)(void); |