From: Daniel Jacobowitz Date: Wed, 16 May 2007 14:07:56 +0000 (+0000) Subject: * config/mips/linux.mt (DEPRECATED_TM_FILE): Delete. X-Git-Tag: binutils-2_18-branchpoint~719 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d522c902eb745c9d99e88d1c62c7bb4d23f4ddd;p=external%2Fbinutils.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a867139..1b1e492 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2007-05-16 Daniel Jacobowitz + + * 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 * printcmd.c (do_examine): Fix typos in a comment. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index db74f87..fe3bfad 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2342,7 +2342,7 @@ mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ $(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) \ diff --git a/gdb/config/mips/linux.mt b/gdb/config/mips/linux.mt index 8ff463d..f45d647 100644 --- a/gdb/config/mips/linux.mt +++ b/gdb/config/mips/linux.mt @@ -1,7 +1,6 @@ # 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 diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 4ca20ac..ff0b124 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -34,9 +34,13 @@ #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 @@ -617,12 +621,12 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name) /* 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 @@ -1060,6 +1064,16 @@ mips_linux_init_abi (struct gdbarch_info info, /* 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 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 105ff33..7867d45 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -901,7 +901,7 @@ static CORE_ADDR interp_text_sect_high; 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) @@ -1556,7 +1556,7 @@ svr4_lp64_fetch_link_map_offsets (void) } -static struct target_so_ops svr4_so_ops; +struct target_so_ops svr4_so_ops; extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index ea0080a..3cb2e31 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -23,6 +23,9 @@ #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 @@ -81,4 +84,8 @@ extern struct link_map_offsets *(*legacy_svr4_fetch_link_map_offsets_hook) (void 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 */ diff --git a/gdb/solib.c b/gdb/solib.c index 0b5e2e3..d260c12 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -67,11 +67,21 @@ solib_ops (struct gdbarch *gdbarch) 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; +} /* 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 */ diff --git a/gdb/solib.h b/gdb/solib.h index 0ab9efc..b937dce 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -26,6 +26,7 @@ /* 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. */ @@ -57,4 +58,9 @@ extern int in_solib_dynsym_resolve_code (CORE_ADDR); 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 */