From ccf00f21795678e609af3faa0437cc216f039907 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 27 Apr 2005 20:48:25 +0000 Subject: * sh-tdep.c (sh_linux_svr4_fetch_link_map_offsets): Remove function. (sh_gdbarch_init): Remove redundant prototype. * sh-linux-tdep.c: New file. * config/sh/tm-linux.h (sh_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. * config/sh/linux.mt (TDEPFILES): Add sh64-tdep.o, remove solib-legacy.o. * Makefile.in (sh-linux-tdep.o): New. --- gdb/ChangeLog | 10 ++++++++++ gdb/Makefile.in | 1 + gdb/config/sh/linux.mt | 6 ++++-- gdb/config/sh/tm-linux.h | 4 ---- gdb/sh-linux-tdep.c | 42 ++++++++++++++++++++++++++++++++++++++++++ gdb/sh-tdep.c | 44 +------------------------------------------- 6 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 gdb/sh-linux-tdep.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 49f45af..c7d160d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2005-04-27 Mark Kettenis + * sh-tdep.c (sh_linux_svr4_fetch_link_map_offsets): Remove function. + (sh_gdbarch_init): Remove redundant prototype. + * sh-linux-tdep.c: New file. + * config/sh/tm-linux.h (sh_linux_svr4_fetch_link_map_offsets): + Remove prototype. + (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. + * config/sh/linux.mt (TDEPFILES): Add sh64-tdep.o, remove + solib-legacy.o. + * Makefile.in (sh-linux-tdep.o): New. + * solib-svr4.c: Update copyright year. Include "gdb_assert.h". (SVR4_FETCH_LINK_MAP_OFFSETS): Don't define if not already defined. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a64d403..ea8ec3e 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2505,6 +2505,7 @@ shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \ $(osabi_h) $(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) \ $(shnbsd_tdep_h) sh-stub.o: sh-stub.c +sh-linux-tdep.o: sh-linux-tdep.c $(defs_h) $(osabi_h) $(solib_svr4_h) sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(dwarf2_frame_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \ $(value_h) $(dis_asm_h) $(inferior_h) $(gdb_string_h) \ diff --git a/gdb/config/sh/linux.mt b/gdb/config/sh/linux.mt index 629d49b..4f6e926 100644 --- a/gdb/config/sh/linux.mt +++ b/gdb/config/sh/linux.mt @@ -1,5 +1,7 @@ -# Target: Renesas 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 solib-legacy.o symfile-mem.o +# Target: GNU/Linux Super-H +TDEPFILES= sh-tdep.o sh64-tdep.o sh-linux-tdep.o \ + monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o \ + solib.o solib-svr4.o symfile-mem.o DEPRECATED_TM_FILE= tm-linux.h SIM_OBS = remote-sim.o diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h index 0117d81..797041d 100644 --- a/gdb/config/sh/tm-linux.h +++ b/gdb/config/sh/tm-linux.h @@ -26,7 +26,3 @@ /* Pull in sh-target defs */ #include "sh/tm-sh.h" -/* Use target_specific function to define link map offsets. */ -extern struct link_map_offsets *sh_linux_svr4_fetch_link_map_offsets (void); -#define SVR4_FETCH_LINK_MAP_OFFSETS() sh_linux_svr4_fetch_link_map_offsets () - diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c new file mode 100644 index 0000000..540545a --- /dev/null +++ b/gdb/sh-linux-tdep.c @@ -0,0 +1,42 @@ +/* Target-dependent code for GNU/Linux Super-H. + + Copyright 2005 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. */ + +#include "defs.h" +#include "osabi.h" + +#include "solib-svr4.h" + +static void +sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + /* GNU/Linux uses SVR4-style shared libraries. */ + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); +} + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern void _initialize_sh_linux_tdep (void); + +void +_initialize_sh_linux_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_LINUX, sh_linux_init_abi); +} diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 0689989..15e89e9 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2152,47 +2152,6 @@ sh_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, } } -/* Fetch (and possibly build) an appropriate link_map_offsets structure - for native i386 linux targets using the struct offsets defined in - link.h (but without actual reference to that file). - - This makes it possible to access i386-linux shared libraries from - a gdb that was not built on an i386-linux host (for cross debugging). - */ - -struct link_map_offsets * -sh_linux_svr4_fetch_link_map_offsets (void) -{ - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = 0; - - if (lmp == 0) - { - lmp = &lmo; - - lmo.r_debug_size = 8; /* 20 not actual size but all we need */ - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; /* 552 not actual size but all we need */ - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - static int sh_dsp_register_sim_regno (int nr) { @@ -2513,8 +2472,7 @@ sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) } return 0; } - -static gdbarch_init_ftype sh_gdbarch_init; + static struct gdbarch * sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) -- cgit v1.1