* config/mips/tm-linux.h: Delete.
	* mips-linux-tdep.c (mips_svr4_so_ops): New.
	(mips_linux_in_dynsym_resolve_code): Make static.  Use
	svr4_in_dynsym_resolve_code.
	(mips_linux_init_abi): Initialize mips_svr4_so_ops.  Call
	set_solib_ops.
	* solib-svr4.c (svr4_in_dynsym_resolve_code, svr4_so_ops): Make
	global.
	* solib-svr4.h (svr4_so_ops, svr4_in_dynsym_resolve_code): Declare.
	* Makefile.in (mips-linux-tdep.o): Update.
	* solib.c (set_solib_ops): New.
	(current_target_so_ops): Update comment.
	* solib.h (set_solib_ops): New prototype.
+2007-05-16  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * config/mips/linux.mt (DEPRECATED_TM_FILE): Delete.
+       * config/mips/tm-linux.h: Delete.
+       * mips-linux-tdep.c (mips_svr4_so_ops): New.
+       (mips_linux_in_dynsym_resolve_code): Make static.  Use
+       svr4_in_dynsym_resolve_code.
+       (mips_linux_init_abi): Initialize mips_svr4_so_ops.  Call
+       set_solib_ops.
+       * solib-svr4.c (svr4_in_dynsym_resolve_code, svr4_so_ops): Make
+       global.
+       * solib-svr4.h (svr4_so_ops, svr4_in_dynsym_resolve_code): Declare.
+       * Makefile.in (mips-linux-tdep.o): Update.
+       * solib.c (set_solib_ops): New.
+       (current_target_so_ops): Update comment.
+       * solib.h (set_solib_ops): New prototype.
+
 2007-05-16  Chris Dearman  <chris@mips.com>
 
        * printcmd.c (do_examine): Fix typos in a comment.
 
        $(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \
        $(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \
        $(tramp_frame_h) $(gdbtypes_h) $(solib_h) $(symtab_h) \
-       $(mips_linux_tdep_h)
+       $(mips_linux_tdep_h) $(solist_h) $(solib_svr4_h)
 mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(target_h) $(mips_tdep_h) $(mipsnbsd_tdep_h) $(inf_ptrace_h)
 mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
 
 # Target: Linux/MIPS
 TDEPFILES= mips-tdep.o mips-linux-tdep.o corelow.o \
        solib.o solib-svr4.o symfile-mem.o
-DEPRECATED_TM_FILE= tm-linux.h
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/mips/libsim.a
 
 #include "tramp-frame.h"
 #include "gdbtypes.h"
 #include "solib.h"
+#include "solib-svr4.h"
+#include "solist.h"
 #include "symtab.h"
 #include "mips-linux-tdep.h"
 
+static struct target_so_ops mips_svr4_so_ops;
+
 /* Figure out where the longjmp will land.
    We expect the first arg to be a pointer to the jmp_buf structure
    from which we extract the pc (MIPS_LINUX_JB_PC) that we will land
 /* Return non-zero iff PC belongs to the dynamic linker resolution
    code or to a stub.  */
 
-int
+static int
 mips_linux_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   /* Check whether PC is in the dynamic linker.  This also checks
      whether it is in the .plt section, which MIPS does not use.  */
-  if (in_solib_dynsym_resolve_code (pc))
+  if (svr4_in_dynsym_resolve_code (pc))
     return 1;
 
   /* Pattern match for the stub.  It would be nice if there were a
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
+
+  /* Initialize this lazily, to avoid an initialization order
+     dependency on solib-svr4.c's _initialize routine.  */
+  if (mips_svr4_so_ops.in_dynsym_resolve_code == NULL)
+    {
+      mips_svr4_so_ops = svr4_so_ops;
+      mips_svr4_so_ops.in_dynsym_resolve_code
+       = mips_linux_in_dynsym_resolve_code;
+    }
+  set_solib_ops (gdbarch, &mips_svr4_so_ops);
 }
 
 void
 
 static CORE_ADDR interp_plt_sect_low;
 static CORE_ADDR interp_plt_sect_high;
 
-static int
+int
 svr4_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
 }
 \f
 
-static struct target_so_ops svr4_so_ops;
+struct target_so_ops svr4_so_ops;
 
 extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */
 
 
 #define SOLIB_SVR4_H
 
 struct objfile;
+struct target_so_ops;
+
+extern struct target_so_ops svr4_so_ops;
 
 /* Critical offsets and sizes which describe struct r_debug and
    struct link_map on SVR4-like targets.  All offsets and sizes are
 extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
 extern struct link_map_offsets *svr4_lp64_fetch_link_map_offsets (void);
 
+/* Return 1 if PC lies in the dynamic symbol resolution code of the
+   SVR4 run time loader.  */
+int svr4_in_dynsym_resolve_code (CORE_ADDR pc);
+
 #endif /* solib-svr4.h */
 
   struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
   return *ops;
 }
+
+/* Set the solib operations for GDBARCH to NEW_OPS.  */
+
+void
+set_solib_ops (struct gdbarch *gdbarch, struct target_so_ops *new_ops)
+{
+  struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+  *ops = new_ops;
+}
 \f
 
 /* external data declarations */
 
-/* FIXME: gdbarch needs to control this variable */
+/* FIXME: gdbarch needs to control this variable, or else every
+   configuration needs to call set_solib_ops.  */
 struct target_so_ops *current_target_so_ops;
 
 /* local data declarations */
 
 /* Forward decl's for prototypes */
 struct so_list;
 struct target_ops;
+struct target_so_ops;
 
 /* Called when we free all symtabs, to free the shared library information
    as well. */
 
 extern void no_shared_libraries (char *ignored, int from_tty);
 
+/* Set the solib operations for GDBARCH to NEW_OPS.  */
+
+extern void set_solib_ops (struct gdbarch *gdbarch,
+                          struct target_so_ops *new_ops);
+
 #endif /* SOLIB_H */