From c0988387ae0f9065d64b8f66606c1e7bc69a5e2a Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 21 Feb 2004 19:11:36 +0000 Subject: [PATCH] Fix PR build/1549. * i386obsd-tdep.c: Update copyright years. Include "solib-svr4.h". (i386obsd_init_abi): Don't set regset_from_core_section here. (i386obsd_aout_init_abi): New function. Set regset_from_core_section here. (i386obsd_elf_init_abi): New function. (_initialize_i386obsd_tdep): Register OS/ABI for OpenBSD ELF. * Makefile.in (i386obsd-tdep.o): Update dependecies. * config/i386/obsd.mt (TDEPFILES): Add solib.o and solib-svr4.o. (TM_FILE): Set to tm-nbsd.h. * config/i386/obsd.mh (NATDEPFILES): Remove solib.o and solib-sunos.o. --- gdb/ChangeLog | 15 +++++++++++++++ gdb/Makefile.in | 2 +- gdb/config/i386/obsd.mh | 5 ++--- gdb/config/i386/obsd.mt | 7 ++++--- gdb/i386obsd-tdep.c | 44 ++++++++++++++++++++++++++++++++++++++------ 5 files changed, 60 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f7f7cb0bda..162a09f43c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,20 @@ 2004-02-21 Mark Kettenis + Fix PR build/1549. + * i386obsd-tdep.c: Update copyright years. Include + "solib-svr4.h". + (i386obsd_init_abi): Don't set regset_from_core_section here. + (i386obsd_aout_init_abi): New function. Set + regset_from_core_section here. + (i386obsd_elf_init_abi): New function. + (_initialize_i386obsd_tdep): Register OS/ABI for OpenBSD ELF. + * Makefile.in (i386obsd-tdep.o): Update dependecies. + * config/i386/obsd.mt (TDEPFILES): Add solib.o and solib-svr4.o. + (TM_FILE): Set to tm-nbsd.h. + + * config/i386/obsd.mh (NATDEPFILES): Remove solib.o and + solib-sunos.o. + * solib-svr4.h: Update copyright year. (svr4_ilp32_fetch_link_map_offsets) (svr4_lp64_fetch_link_map_offsets): New prototype. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index cb2b3090e7..7e179a83d5 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1850,7 +1850,7 @@ i386-nto-tdep.o: i386-nto-tdep.c $(gdb_string_h) $(gdb_assert_h) $(defs_h) \ i386obsd-nat.o: i386obsd-nat.c $(defs_h) $(i386_tdep_h) i386obsd-tdep.o: i386obsd-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \ $(regcache_h) $(regset_h) $(osabi_h) $(gdb_assert_h) $(gdb_string_h) \ - $(i386_tdep_h) $(i387_tdep_h) + $(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h) i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(osabi_h) \ $(i386_tdep_h) i386-stub.o: i386-stub.c diff --git a/gdb/config/i386/obsd.mh b/gdb/config/i386/obsd.mh index ec22fcb67a..316f04f923 100644 --- a/gdb/config/i386/obsd.mh +++ b/gdb/config/i386/obsd.mh @@ -1,10 +1,9 @@ -# Host: Intel 386 running OpenBSD +# Host: OpenBSD/i386 ELF XM_FILE= xm-i386.h NAT_FILE= nm-obsd.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o i386obsd-nat.o \ - solib.o solib-sunos.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o i386obsd-nat.o # The OpenBSD yacc generates yyname and yyrule tables that conflict at # link time if we define YYDEBUG to a non-zero value. diff --git a/gdb/config/i386/obsd.mt b/gdb/config/i386/obsd.mt index 72ec51311c..c49ae606c5 100644 --- a/gdb/config/i386/obsd.mt +++ b/gdb/config/i386/obsd.mt @@ -1,3 +1,4 @@ -# Target: Intel 386 running OpenBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o corelow.o -TM_FILE= tm-i386.h +# Target: OpenBSD/i386 +TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o corelow.o \ + solib.o solib-svr4.o +TM_FILE= tm-nbsd.h diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c index 26ba4d9c87..be9e735cb3 100644 --- a/gdb/i386obsd-tdep.c +++ b/gdb/i386obsd-tdep.c @@ -1,6 +1,7 @@ /* Target-dependent code for OpenBSD/i386. - Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003 + Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -32,6 +33,7 @@ #include "i386-tdep.h" #include "i387-tdep.h" +#include "solib-svr4.h" /* From . */ static int i386obsd_r_reg_offset[] = @@ -130,10 +132,6 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->gregset_num_regs = ARRAY_SIZE (i386obsd_r_reg_offset); tdep->sizeof_gregset = 16 * 4; - /* OpenBSD has a single register set. */ - set_gdbarch_regset_from_core_section - (gdbarch, i386obsd_aout_regset_from_core_section); - /* OpenBSD uses -freg-struct-return by default. */ tdep->struct_return = reg_struct_return; @@ -146,6 +144,38 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sc_reg_offset = i386obsd_sc_reg_offset; tdep->sc_num_regs = ARRAY_SIZE (i386obsd_sc_reg_offset); } + +/* OpenBSD a.out. */ + +static void +i386obsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + i386obsd_init_abi (info, gdbarch); + + /* OpenBSD a.out has a single register set. */ + set_gdbarch_regset_from_core_section + (gdbarch, i386obsd_aout_regset_from_core_section); +} + +/* OpenBSD ELF. */ + +static void +i386obsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* It's still OpenBSD. */ + i386obsd_init_abi (info, gdbarch); + + /* But ELF-based. */ + i386_elf_init_abi (info, gdbarch); + + /* OpenBSD ELF uses SVR4-style shared libraries. */ + set_gdbarch_in_solib_call_trampoline + (gdbarch, generic_in_solib_call_trampoline); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); +} /* Provide a prototype to silence -Wmissing-prototypes. */ @@ -161,5 +191,7 @@ _initialize_i386obsd_tdep (void) #define GDB_OSABI_OPENBSD_AOUT GDB_OSABI_NETBSD_AOUT gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD_AOUT, - i386obsd_init_abi); + i386obsd_aout_init_abi); + gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD_ELF, + i386obsd_elf_init_abi); } -- 2.11.0