This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

[7/8] solib handler rework: remove solib-legacy


Hello,

the most popular solib handler, solib-svr4, is already mostly prepared
for cross-configurations.  The only exception is the solib-legacy support
which remains in use with native configurations that do not install a
solib_svr4_fetch_link_map_offsets gdbarch callback.

Note that there remain only three targets that did not already do so:
alpha-linux, ia64-linux, and i386-gnu.  As these are all glibc targets,
the default svr4_lp64/ilp32_fetch_link_map_offsets handlers should work.
(I've verifies this on ia64-linux; I cannot test the other two targets.)

In addition, there were a number of target that still linked against
solib-legacy.o in their TDEPFILES, even though this was actually
unnecessary as they did already install solib_svr4_fetch_link_map_offsets
handlers.  These were arm-linux, m32r-linux, powerpc-linux, and s390-linux.
The patch simply removes those obsolete entries.

This makes the whole solib-legacy.c infrastructure itself obsolete.

Bye,
Ulrich



ChangeLog:

	* solib-svr4.c (legacy_svr4_fetch_link_map_offsets_hook): Remove.
	(solib_svr4_init): Initialize fetch_link_map_offsets to NULL.
	* solib-svr4.h (legacy_svr4_fetch_link_map_offsets_hook): Remove.
	* solib-legacy.c: Remove file.

	* config/alpha/alpha-linux.mt (TDEPFILES): Remove solib-legacy.o.
	* config/arm/linux.mt (TDEPFILES): Likewise.
	* config/i386/i386gnu.mh (NATDEPFILES): Likewise.
	* config/ia64/linux.mt (TDEPFILES): Likewise.
	* config/m32r/linux.mt (TDEPFILES): Likewise.
	* config/powerpc/linux.mt (TDEPFILES): Likewise.
	* config/s390/s390.mt (TDEPFILES): Likewise.

	* alpha-linux-tdep.c (alpha_linux_init_abi): Call
	set_solib_svr4_fetch_link_map_offsets.
	* i386gnu-tdep.c (i386gnu_init_abi): Likewise.
	* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.

	* i386gnu-tdep.h: Include "solib-svr4.h".
	* Makefile.in: Update dependencies.


diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-10-16 00:58:34.000000000 +0200
+++ gdb-head/gdb/Makefile.in	2007-10-16 01:00:57.000000000 +0200
@@ -2138,7 +2138,8 @@ i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_
 i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
 	$(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) \
 	$(gnu_nat_h) $(i387_tdep_h) $(gregset_h)
-i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(osabi_h) $(i386_tdep_h)
+i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(osabi_h) $(solib_svr4_h) \
+	$(i386_tdep_h)
 i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
 	$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
 	$(gregset_h) $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
@@ -2637,7 +2638,6 @@ solib-frv.o: solib-frv.c $(defs_h) $(gdb
 solib-irix.o: solib-irix.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) \
 	$(solib_h) $(solib_irix_h)
-solib-legacy.o: solib-legacy.c $(defs_h) $(gdbcore_h) $(solib_svr4_h)
 solib-null.o: solib-null.c $(defs_h) $(solist_h)
 solib-osf.o: solib-osf.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
 	$(symfile_h) $(objfiles_h) $(target_h) $(inferior_h) $(solist_h)
diff -urNp gdb-orig/gdb/alpha-linux-tdep.c gdb-head/gdb/alpha-linux-tdep.c
--- gdb-orig/gdb/alpha-linux-tdep.c	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/alpha-linux-tdep.c	2007-10-16 00:58:52.000000000 +0200
@@ -224,6 +224,9 @@ alpha_linux_init_abi (struct gdbarch_inf
 
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_lp64_fetch_link_map_offsets);
+
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
diff -urNp gdb-orig/gdb/config/alpha/alpha-linux.mt gdb-head/gdb/config/alpha/alpha-linux.mt
--- gdb-orig/gdb/config/alpha/alpha-linux.mt	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/alpha/alpha-linux.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,3 +1,3 @@
 # Target: Little-endian Alpha
 TDEPFILES= alpha-tdep.o alpha-mdebug-tdep.o alpha-linux-tdep.o \
-	   solib.o solib-svr4.o solib-legacy.o
+	   solib.o solib-svr4.o
diff -urNp gdb-orig/gdb/config/arm/linux.mt gdb-head/gdb/config/arm/linux.mt
--- gdb-orig/gdb/config/arm/linux.mt	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/arm/linux.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,5 +1,4 @@
 # Target: ARM based machine running GNU/Linux
 TDEPFILES= arm-tdep.o arm-linux-tdep.o glibc-tdep.o solib.o \
-  solib-svr4.o solib-legacy.o symfile-mem.o \
-  corelow.o
+  solib-svr4.o symfile-mem.o corelow.o
 
diff -urNp gdb-orig/gdb/config/i386/i386gnu.mh gdb-head/gdb/config/i386/i386gnu.mh
--- gdb-orig/gdb/config/i386/i386gnu.mh	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/i386/i386gnu.mh	2007-10-16 00:58:52.000000000 +0200
@@ -1,6 +1,6 @@
 # Host: Intel 386 running the GNU Hurd
 NATDEPFILES= i386gnu-nat.o gnu-nat.o corelow.o core-regset.o \
-	     fork-child.o solib.o solib-svr4.o solib-legacy.o \
+	     fork-child.o solib.o solib-svr4.o \
 	     notify_S.o process_reply_S.o msg_reply_S.o \
 	     msg_U.o exc_request_U.o exc_request_S.o
 
diff -urNp gdb-orig/gdb/config/ia64/linux.mt gdb-head/gdb/config/ia64/linux.mt
--- gdb-orig/gdb/config/ia64/linux.mt	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/ia64/linux.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,3 +1,2 @@
 # Target: Intel IA-64 running GNU/Linux
-TDEPFILES= ia64-tdep.o ia64-linux-tdep.o \
-	solib.o solib-svr4.o solib-legacy.o symfile-mem.o
+TDEPFILES= ia64-tdep.o ia64-linux-tdep.o solib.o solib-svr4.o symfile-mem.o
diff -urNp gdb-orig/gdb/config/m32r/linux.mt gdb-head/gdb/config/m32r/linux.mt
--- gdb-orig/gdb/config/m32r/linux.mt	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/m32r/linux.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,5 +1,5 @@
 # Target: Renesas M32R running GNU/Linux
-TDEPFILES= m32r-tdep.o m32r-linux-tdep.o remote-m32r-sdi.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o symfile-mem.o
+TDEPFILES= m32r-tdep.o m32r-linux-tdep.o remote-m32r-sdi.o glibc-tdep.o solib.o solib-svr4.o symfile-mem.o
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/m32r/libsim.a
diff -urNp gdb-orig/gdb/config/powerpc/linux.mt gdb-head/gdb/config/powerpc/linux.mt
--- gdb-orig/gdb/config/powerpc/linux.mt	2007-10-16 00:43:12.000000000 +0200
+++ gdb-head/gdb/config/powerpc/linux.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,6 +1,6 @@
 # Target: Motorola PPC on Linux
 TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \
-	solib-svr4.o solib-legacy.o corelow.o symfile-mem.o
+	solib-svr4.o corelow.o symfile-mem.o
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/ppc/libsim.a
diff -urNp gdb-orig/gdb/config/s390/s390.mt gdb-head/gdb/config/s390/s390.mt
--- gdb-orig/gdb/config/s390/s390.mt	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/config/s390/s390.mt	2007-10-16 00:58:52.000000000 +0200
@@ -1,2 +1,2 @@
 # Target: S390 running Linux
-TDEPFILES=s390-tdep.o solib.o solib-svr4.o solib-legacy.o
+TDEPFILES=s390-tdep.o solib.o solib-svr4.o
diff -urNp gdb-orig/gdb/i386gnu-tdep.c gdb-head/gdb/i386gnu-tdep.c
--- gdb-orig/gdb/i386gnu-tdep.c	2007-10-15 23:35:36.000000000 +0200
+++ gdb-head/gdb/i386gnu-tdep.c	2007-10-16 01:00:36.000000000 +0200
@@ -18,6 +18,7 @@
 
 #include "defs.h"
 #include "osabi.h"
+#include "solib-svr4.h"
 
 #include "i386-tdep.h"
 
@@ -29,6 +30,9 @@ i386gnu_init_abi (struct gdbarch_info in
   /* GNU uses ELF.  */
   i386_elf_init_abi (info, gdbarch);
 
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
   tdep->jb_pc_offset = 20;	/* From <bits/setjmp.h>.  */
 }
 
diff -urNp gdb-orig/gdb/ia64-linux-tdep.c gdb-head/gdb/ia64-linux-tdep.c
--- gdb-orig/gdb/ia64-linux-tdep.c	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/ia64-linux-tdep.c	2007-10-16 00:58:52.000000000 +0200
@@ -130,6 +130,9 @@ ia64_linux_init_abi (struct gdbarch_info
 
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_lp64_fetch_link_map_offsets);
+
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
diff -urNp gdb-orig/gdb/solib-legacy.c gdb-head/gdb/solib-legacy.c
--- gdb-orig/gdb/solib-legacy.c	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/solib-legacy.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,132 +0,0 @@
-/* Provide legacy r_debug and link_map support for SVR4-like native targets.
-
-   Copyright (C) 2000, 2001, 2006, 2007 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 3 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, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "solib-svr4.h"
-
-#ifdef HAVE_LINK_H
-
-#ifdef HAVE_NLIST_H
-/* nlist.h needs to be included before link.h on some older *BSD systems. */
-#include <nlist.h>
-#endif
-
-#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 HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS
-      lmo.r_version_offset = offsetof (struct r_debug, r_version);
-      lmo.r_version_size = fieldsize (struct r_debug, r_version);
-      lmo.r_map_offset = offsetof (struct r_debug, r_map);
-      lmo.r_ldsomap_offset = -1;
-
-      lmo.link_map_size = sizeof (struct link_map);
-
-      lmo.l_addr_offset = offsetof (struct link_map, l_addr);
-      lmo.l_next_offset = offsetof (struct link_map, l_next);
-      lmo.l_ld_offset = offsetof (struct link_map, l_ld);
-      lmo.l_prev_offset = offsetof (struct link_map, l_prev);
-      lmo.l_name_offset = offsetof (struct link_map, l_name);
-#else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS) */
-#ifdef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS
-      lmo.link_map_size = sizeof (struct link_map);
-
-      lmo.l_addr_offset = offsetof (struct link_map, lm_addr);
-      lmo.l_next_offset = offsetof (struct link_map, lm_next);
-      /* FIXME: Is this the right field name, or is it available at all?  */
-      lmo.l_ld_offset = offsetof (struct link_map, lm_ld);
-      lmo.l_name_offset = offsetof (struct link_map, lm_name);
-#else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS) */
-#if HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
-      lmo.link_map_size = sizeof (struct so_map);
-
-      lmo.l_addr_offset = offsetof (struct so_map, som_addr);
-      lmo.l_next_offset = offsetof (struct so_map, som_next);
-      lmo.l_name_offset = offsetof (struct so_map, som_path);
-      /* FIXME: Is the address of the dynamic table available?  */
-      lmo.l_ld_offset = -1;
-#endif /* HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
-#endif /* HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
-#endif /* HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS */
-    }
-
-#if defined (HAVE_STRUCT_LINK_MAP32)
-  if (lmp32 == 0)
-    {
-      lmp32 = &lmo32;
-
-      lmo32.r_version_offset = offsetof (struct r_debug32, r_version);
-      lmo32.r_version_size = fieldsize (struct r_debug32, r_version);
-      lmo32.r_map_offset = offsetof (struct r_debug32, r_map);
-      lmo32.r_ldsomap_offset = -1;
-
-      lmo32.link_map_size = sizeof (struct link_map32);
-
-      lmo32.l_addr_offset = offsetof (struct link_map32, l_addr);
-      lmo32.l_next_offset = offsetof (struct link_map32, l_next);
-      lmo32.l_prev_offset = offsetof (struct link_map32, l_prev);
-      lmo32.l_name_offset = offsetof (struct link_map32, l_name);
-    }
-#endif /* defined (HAVE_STRUCT_LINK_MAP32) */
-
-#if defined (HAVE_STRUCT_LINK_MAP32)
-  if (exec_bfd != NULL)
-    {
-      if (bfd_get_arch_size (exec_bfd) == 32)
-	return lmp32;
-    }
-  if (gdbarch_ptr_bit (current_gdbarch) == 32)
-    return lmp32;
-#endif
-  return lmp;
-}
-
-#endif /* HAVE_LINK_H */
-
-extern initialize_file_ftype _initialize_svr4_lm; /* -Wmissing-prototypes */
-
-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 -urNp gdb-orig/gdb/solib-svr4.c gdb-head/gdb/solib-svr4.c
--- gdb-orig/gdb/solib-svr4.c	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/solib-svr4.c	2007-10-16 00:58:52.000000000 +0200
@@ -46,10 +46,6 @@
 static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
 static int svr4_have_link_map_offsets (void);
 
-/* This hook is set to a function that provides native link map
-   offsets if the code in solib-legacy.c is linked in.  */
-struct link_map_offsets *(*legacy_svr4_fetch_link_map_offsets_hook) (void);
-
 /* Link map info to include in an allocated so_list entry */
 
 struct lm_info
@@ -1448,7 +1444,7 @@ solib_svr4_init (struct obstack *obstack
   struct solib_svr4_ops *ops;
 
   ops = OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
-  ops->fetch_link_map_offsets = legacy_svr4_fetch_link_map_offsets_hook;
+  ops->fetch_link_map_offsets = NULL;
   return ops;
 }
 
diff -urNp gdb-orig/gdb/solib-svr4.h gdb-head/gdb/solib-svr4.h
--- gdb-orig/gdb/solib-svr4.h	2007-10-15 23:31:50.000000000 +0200
+++ gdb-head/gdb/solib-svr4.h	2007-10-16 00:58:52.000000000 +0200
@@ -72,11 +72,6 @@ extern void set_solib_svr4_fetch_link_ma
    link map for the given objfile.  */
 extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
 
-/* 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);
-
 /* Fetch (and possibly build) an appropriate `struct link_map_offsets'
    for ILP32 and LP64 SVR4 systems.  */
 extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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