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]

[3/8] solib handler rework: solib-som / solib-pa64


Hello,

this converts the solib-som and solib-pa64 handlers to the cross-platform
form.  Note that solib-pa64 is not really cross-platform because it does
rely on platform libraries; however, there was support for building the
file on at least one non-native platform (32-bit HP/UX) via conditional
compilation.  (This is necessary as the tdep file refers to functions
exported from the solib file.)

This patch changes the conditional to allow building the non-native stub
version on *all* platforms except the native 64-bit HP/UX.  This is done
by adding a configure check for the special platform header file that the
real pa64 support requires.

Bye,
Ulrich


ChangeLog:

	* configure.tgt: Remove hppa*64*-*-hpux11* special case.
	* config/pa/hppa64.mt: Delete file.
	* config/pa/hppahpux.mt (MT_CFLAGS): Remove.
	(TDEPFILES): Move somread.o to ...
	* config/pa/hpux.mh (NATDEPFILES): ... here.

	* configure.ac: Add check for elf_hp.h header.
	* config.in, configure: Regenerate.
	* solib-pa64.c: Conditionalize compilation on #ifdef HAVE_ELF_HP_H
	instead of #ifndef PA_SOM_ONLY.  Include "solib.h".
	(pa64_solib_select): Take gdbarch instead of tdep argument.  Call
	set_solib_ops instead of modifying current_target_so_ops.
	* solib-pa64.h (pa64_solib_select): Update prototype.
	* solib-som.c: Remove include of "som.h".  Include "solib.h".
	(som_solib_select): Take gdbarch instead of tdep argument.  Call
	set_solib_ops instead of modifying current_target_so_ops.
	* solib-som.h (som_solib_select): Update prototype.
	* hppa-hpux-tdep.c (hppa_hpux_som_init_abi): Pass gdbarch instead
	of tdep to som_solib_select call.
	(hppa_hpux_elf_init_abi): Pass gdbarch instead of tdep to
	pa64_solib_select call.
	* Makefile.in: Update dependencies.

diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-10-16 01:26:22.000000000 +0200
+++ gdb-head/gdb/Makefile.in	2007-10-16 01:26:07.000000000 +0200
@@ -2637,10 +2637,10 @@ solib-osf.o: solib-osf.c $(defs_h) $(gdb
 	$(symfile_h) $(objfiles_h) $(target_h) $(inferior_h) $(solist_h)
 solib-pa64.o: solib-pa64.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(gdbcore_h) $(target_h) $(inferior_h) $(hppa_tdep_h) \
-	$(solist_h) $(solib_pa64_h)
-solib-som.o: solib-som.c $(defs_h) $(som_h) $(symtab_h) $(bfd_h) \
-	$(symfile_h) $(objfiles_h) $(gdbcore_h) $(target_h) $(inferior_h) \
-	$(hppa_tdep_h) $(solist_h)
+	$(solist_h) $(solib_h) $(solib_pa64_h)
+solib-som.o: solib-som.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \
+	$(objfiles_h) $(gdbcore_h) $(target_h) $(inferior_h) \
+	$(hppa_tdep_h) $(solist_h) $(solib_h)
 solib-sunos.o: solib-sunos.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) \
 	$(symfile_h) $(objfiles_h) $(gdbcore_h) $(inferior_h) $(solist_h) \
 	$(bcache_h) $(regcache_h)
diff -urNp gdb-orig/gdb/config/pa/hppa64.mt gdb-head/gdb/config/pa/hppa64.mt
--- gdb-orig/gdb/config/pa/hppa64.mt	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/config/pa/hppa64.mt	1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-# Target: HP PA-RISC 2.0 running HPUX 11.00 in wide mode
-TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o solib-som.o solib-pa64.o somread.o solib.o
diff -urNp gdb-orig/gdb/config/pa/hppahpux.mt gdb-head/gdb/config/pa/hppahpux.mt
--- gdb-orig/gdb/config/pa/hppahpux.mt	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/config/pa/hppahpux.mt	2007-10-16 01:24:39.000000000 +0200
@@ -1,3 +1,2 @@
 # Target: HP PA-RISC running hpux
-MT_CFLAGS = -DPA_SOM_ONLY=1
-TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o somread.o solib-som.o solib-pa64.o solib.o
+TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o solib-som.o solib-pa64.o solib.o
diff -urNp gdb-orig/gdb/config/pa/hpux.mh gdb-head/gdb/config/pa/hpux.mh
--- gdb-orig/gdb/config/pa/hpux.mh	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/config/pa/hpux.mh	2007-10-16 01:24:39.000000000 +0200
@@ -1,3 +1,3 @@
 # Host: PA-RISC HP-UX
 NATDEPFILES= fork-child.o inf-ptrace.o inf-ttrace.o \
-	hppa-hpux-nat.o corelow.o
+	hppa-hpux-nat.o corelow.o somread.o
diff -urNp gdb-orig/gdb/config.in gdb-head/gdb/config.in
--- gdb-orig/gdb/config.in	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/config.in	2007-10-16 01:24:39.000000000 +0200
@@ -113,6 +113,9 @@
 /* Define if ELF support should be included. */
 #undef HAVE_ELF
 
+/* Define to 1 if you have the <elf_hp.h> header file. */
+#undef HAVE_ELF_HP_H
+
 /* Define to 1 if your system has the etext variable. */
 #undef HAVE_ETEXT
 
diff -urNp gdb-orig/gdb/configure gdb-head/gdb/configure
--- gdb-orig/gdb/configure	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/configure	2007-10-16 01:24:39.000000000 +0200
@@ -11335,6 +11335,158 @@ fi
 done
 
 
+# Check for HP/UX 64-bit shared library support
+
+for ac_header in elf_hp.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
 # FIXME: kettenis/20030102: In most cases we include these
 # unconditionally, so what's the point in checking these?
 
diff -urNp gdb-orig/gdb/configure.ac gdb-head/gdb/configure.ac
--- gdb-orig/gdb/configure.ac	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/configure.ac	2007-10-16 01:24:39.000000000 +0200
@@ -457,6 +457,9 @@ AC_CHECK_HEADERS(term.h, [], [],
 #endif
 ])
 
+# Check for HP/UX 64-bit shared library support
+AC_CHECK_HEADERS(elf_hp.h)
+
 # FIXME: kettenis/20030102: In most cases we include these
 # unconditionally, so what's the point in checking these?
 AC_CHECK_HEADERS(ctype.h time.h)
diff -urNp gdb-orig/gdb/configure.tgt gdb-head/gdb/configure.tgt
--- gdb-orig/gdb/configure.tgt	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/configure.tgt	2007-10-16 01:24:39.000000000 +0200
@@ -101,7 +101,6 @@ frv-*-*)		gdb_target=frv ;;
 
 h8300-*-*)		gdb_target=h8300 ;;
 
-hppa*64*-*-hpux11*)	gdb_target=hppa64 ;;
 hppa*-*-hpux*)		gdb_target=hppahpux ;;
 hppa*-*-linux*)		gdb_target=linux ;;
 hppa*-*-openbsd*)	gdb_target=obsd ;;
diff -urNp gdb-orig/gdb/hppa-hpux-tdep.c gdb-head/gdb/hppa-hpux-tdep.c
--- gdb-orig/gdb/hppa-hpux-tdep.c	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/hppa-hpux-tdep.c	2007-10-16 01:24:39.000000000 +0200
@@ -1496,7 +1496,7 @@ hppa_hpux_som_init_abi (struct gdbarch_i
   tdep->find_global_pointer = hppa32_hpux_find_global_pointer;
 
   hppa_hpux_init_abi (info, gdbarch);
-  som_solib_select (tdep);
+  som_solib_select (gdbarch);
 }
 
 static void
@@ -1508,7 +1508,7 @@ hppa_hpux_elf_init_abi (struct gdbarch_i
   tdep->find_global_pointer = hppa64_hpux_find_global_pointer;
 
   hppa_hpux_init_abi (info, gdbarch);
-  pa64_solib_select (tdep);
+  pa64_solib_select (gdbarch);
 }
 
 static enum gdb_osabi
diff -urNp gdb-orig/gdb/solib-pa64.c gdb-head/gdb/solib-pa64.c
--- gdb-orig/gdb/solib-pa64.c	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/solib-pa64.c	2007-10-16 01:24:39.000000000 +0200
@@ -39,12 +39,14 @@
 
 #include "hppa-tdep.h"
 #include "solist.h"
+#include "solib.h"
 #include "solib-pa64.h"
 
 #undef SOLIB_PA64_DBG
 
-/* If we are building for a SOM-only target, then we don't need this.  */
-#ifndef PA_SOM_ONLY
+/* We can build this file only when running natively on 64-bit HP/UX.
+   We check for that by checking for the elf_hp.h header file.  */
+#ifdef HAVE_ELF_HP_H
 
 /* FIXME: kettenis/20041213: These includes should be eliminated.  */
 #include <dlfcn.h>
@@ -657,9 +659,10 @@ _initialize_pa64_solib (void)
   memset (&dld_cache, 0, sizeof (dld_cache));
 }
 
-void pa64_solib_select (struct gdbarch_tdep *tdep)
+void pa64_solib_select (struct gdbarch *gdbarch)
 {
-  current_target_so_ops = &pa64_so_ops;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  set_solib_ops (gdbarch, &pa64_so_ops);
 
   tdep->solib_thread_start_addr = pa64_solib_thread_start_addr;
   tdep->solib_get_got_by_pc = pa64_solib_get_got_by_pc;
@@ -667,7 +670,7 @@ void pa64_solib_select (struct gdbarch_t
   tdep->solib_get_text_base = pa64_solib_get_text_base;
 }
 
-#else /* PA_SOM_ONLY */
+#else /* HAVE_ELF_HP_H */
 
 extern initialize_file_ftype _initialize_pa64_solib; /* -Wmissing-prototypes */
 
@@ -676,7 +679,7 @@ _initialize_pa64_solib (void)
 {
 }
 
-void pa64_solib_select (struct gdbarch_tdep *tdep)
+void pa64_solib_select (struct gdbarch *gdbarch)
 {
   /* For a SOM-only target, there is no pa64 solib support.  This is needed
      for hppa-hpux-tdep.c to build.  */
diff -urNp gdb-orig/gdb/solib-pa64.h gdb-head/gdb/solib-pa64.h
--- gdb-orig/gdb/solib-pa64.h	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/solib-pa64.h	2007-10-16 01:24:39.000000000 +0200
@@ -20,6 +20,6 @@
 #ifndef SOLIB_PA64_H
 #define SOLIB_PA64_H
 
-void pa64_solib_select (struct gdbarch_tdep *tdep);
+void pa64_solib_select (struct gdbarch *gdbarch);
 
 #endif
diff -urNp gdb-orig/gdb/solib-som.c gdb-head/gdb/solib-som.c
--- gdb-orig/gdb/solib-som.c	2007-10-16 01:18:44.000000000 +0200
+++ gdb-head/gdb/solib-som.c	2007-10-16 01:24:59.000000000 +0200
@@ -18,7 +18,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "som.h"
 #include "symtab.h"
 #include "bfd.h"
 #include "symfile.h"
@@ -29,6 +28,7 @@
 
 #include "hppa-tdep.h"
 #include "solist.h"
+#include "solib.h"
 
 #undef SOLIB_SOM_DBG 
 
@@ -759,9 +759,10 @@ _initialize_som_solib (void)
   som_so_ops.in_dynsym_resolve_code = som_in_dynsym_resolve_code;
 }
 
-void som_solib_select (struct gdbarch_tdep *tdep)
+void som_solib_select (struct gdbarch *gdbarch)
 {
-  current_target_so_ops = &som_so_ops;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  set_solib_ops (gdbarch, &som_so_ops);
 
   tdep->solib_thread_start_addr = som_solib_thread_start_addr;
   tdep->solib_get_got_by_pc = som_solib_get_got_by_pc;
diff -urNp gdb-orig/gdb/solib-som.h gdb-head/gdb/solib-som.h
--- gdb-orig/gdb/solib-som.h	2007-10-16 01:18:25.000000000 +0200
+++ gdb-head/gdb/solib-som.h	2007-10-16 01:24:39.000000000 +0200
@@ -22,9 +22,9 @@
 
 struct objfile;
 struct section_offsets;
-struct gdbarch_tdep;
+struct gdbarch;
 
-void som_solib_select (struct gdbarch_tdep *tdep);
+void som_solib_select (struct gdbarch *gdbarch);
 
 int som_solib_section_offsets (struct objfile *objfile,
 			       struct section_offsets *offsets);
-- 
  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]