This commit was manufactured by cvs2svn to create branch 'jimb-
ppc64-linux-20030528-branch'.

Sprout from cagney_fileio-20030521-branch 2003-05-21 19:52:40 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2003-05-28 00:00:02 UTC gdbadmin <gdbadmin@sourceware.org> '*** empty log message ***':
    ChangeLog
    Makefile.in
    Makefile.tpl
    bfd/ChangeLog
    bfd/elf64-mips.c
    bfd/elfn32-mips.c
    bfd/elfxx-mips.c
    bfd/som.h
    bfd/version.h
    configure
    gdb/ChangeLog
    gdb/Makefile.in
    gdb/ada-lang.h
    gdb/ada-valprint.c
    gdb/blockframe.c
    gdb/coffread.c
    gdb/config/m68k/tm-linux.h
    gdb/config/m68k/tm-m68k.h
    gdb/config/pa/tm-hppah.h
    gdb/config/sparc/tm-sparc.h
    gdb/configure.tgt
    gdb/disasm.c
    gdb/dummy-frame.c
    gdb/dwarf2expr.c
    gdb/dwarf2loc.c
    gdb/findvar.c
    gdb/frame.c
    gdb/hppa-tdep.c
    gdb/hpread.c
    gdb/infptrace.c
    gdb/jv-valprint.c
    gdb/m68k-tdep.c
    gdb/m68k-tdep.h
    gdb/m68klinux-tdep.c
    gdb/objc-lang.c
    gdb/p-valprint.c
    gdb/sparc-tdep.c
    gdb/sparcnbsd-tdep.c
    gdb/stabsread.c
    gdb/stabsread.h
    gdb/stack.c
    gdb/testsuite/ChangeLog
    gdb/testsuite/gdb.base/corefile.exp
    gdb/version.in
    include/opcode/ChangeLog
    include/opcode/i860.h
    opcodes/ChangeLog
    opcodes/i860-dis.c
    readline/ChangeLog.gdb
    readline/aclocal.m4
    readline/configure
diff --git a/ChangeLog b/ChangeLog
index 1c21e6a..6f0b06e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-05-21  DJ Delorie  <dj@redhat.com>
+	
+	* Makefile.tpl (configure-target-libiberty): Depend only on gcc, not
+	newlib or libgloss.
+	* Makefile.in: Regenerate.
+
+2003-05-21  DJ Delorie  <dj@redhat.com>
+
+	* Makefile.tpl: Add missing empty maybe-check-gcc target.
+	* Makefile.in: Regenerate.
+
 2003-05-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
 
 	* configure.in: Use curly braces in the definition of tooldir.
diff --git a/Makefile.in b/Makefile.in
index a98c099..7511bc0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7817,6 +7817,7 @@
 	  LANGUAGES="c c++" all
 
 .PHONY: check-gcc
+maybe-check-gcc:
 check-gcc:
 	@if [ -f ./gcc/Makefile ] ; then \
 	  r=`${PWD}`; export r; \
@@ -7980,7 +7981,7 @@
 configure-target-examples: $(ALL_GCC_C)
 configure-target-libgloss: $(ALL_GCC)
 all-target-libgloss: maybe-configure-target-newlib
-configure-target-libiberty: $(ALL_GCC_C)
+configure-target-libiberty: $(ALL_GCC)
 configure-target-libtermcap: $(ALL_GCC_C)
 configure-target-newlib: $(ALL_GCC)
 configure-target-rda: $(ALL_GCC_C)
diff --git a/Makefile.tpl b/Makefile.tpl
index f0f5968..c07fed6 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -1270,6 +1270,7 @@
 	  LANGUAGES="c c++" all
 
 .PHONY: check-gcc
+maybe-check-gcc:
 check-gcc:
 	@if [ -f ./gcc/Makefile ] ; then \
 	  r=`${PWD}`; export r; \
@@ -1433,7 +1434,7 @@
 configure-target-examples: $(ALL_GCC_C)
 configure-target-libgloss: $(ALL_GCC)
 all-target-libgloss: maybe-configure-target-newlib
-configure-target-libiberty: $(ALL_GCC_C)
+configure-target-libiberty: $(ALL_GCC)
 configure-target-libtermcap: $(ALL_GCC_C)
 configure-target-newlib: $(ALL_GCC)
 configure-target-rda: $(ALL_GCC_C)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4b44b40..612884f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,30 @@
+2003-05-27  Richard Sandiford  <rsandifo@redhat.com>
+
+	* elfxx-mips.c (mips_elf_hash_sort_data): Fix formattting.
+	(mips_elf_link_hash_table): Likewise.
+
+2003-05-22  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+	* elf64-mips.c (elf_mips_gnu_rel16_s2): Add internally used
+	R_MIPS_GNU_REL16_S2 support.
+	(bfd_elf64_bfd_reloc_type_lookup): Use it.
+	(mips_elf64_rtype_to_howto): Use it.
+	* elfn32-mips.c (elf_mips_gnu_rel16_s2): Add internally used
+	R_MIPS_GNU_REL16_S2 support.
+	(bfd_elf32_bfd_reloc_type_lookup): Use it.
+	(mips_elf_n32_rtype_to_howto): Use it.
+
+2003-05-21  Stuart F. Downing  <sdowning@fame.com>
+
+	* som.h: Define PA_2_0 before including a.out.h
+
+2003-05-07  Eric Christopher  <echristo@redhat.com>
+	    Alexandre Oliva   <aoliva@redhat.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Adjust
+	pic tests, change to warning.
+	(_bfd_mips_elf_final_link): Remove EF_MIPS_CPIC flag setting.
+
 2003-05-21  Marcus Comstedt  <marcus@mc.pp.se>
 
 	* config.bfd: Check for a target triplet of shl-...-netbsdelf as
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 6e7321c..a43b3da 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1227,6 +1227,38 @@
 	 0,			/* dst_mask */
 	 FALSE);		/* pcrel_offset */
 
+/* 16 bit offset for pc-relative branches.  */
+static reloc_howto_type elf_mips_gnu_rel16_s2 =
+  HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_GNU_REL16_S2",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0x0000ffff,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 TRUE);			/* pcrel_offset */
+
+/* 16 bit offset for pc-relative branches.  */
+static reloc_howto_type elf_mips_gnu_rela16_s2 =
+  HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MIPS_GNU_REL16_S2",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 TRUE);			/* pcrel_offset */
+
 /* Swap in a MIPS 64-bit Rel reloc.  */
 
 static void
@@ -1960,6 +1992,8 @@
       return &elf_mips_gnu_vtinherit_howto;
     case BFD_RELOC_VTABLE_ENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case BFD_RELOC_16_PCREL_S2:
+      return &elf_mips_gnu_rela16_s2;
     default:
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -1983,6 +2017,11 @@
       return &elf_mips_gnu_vtinherit_howto;
     case R_MIPS_GNU_VTENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case R_MIPS_GNU_REL16_S2:
+      if (rela_p)
+	return &elf_mips_gnu_rela16_s2;
+      else
+	return &elf_mips_gnu_rel16_s2;
     default:
       BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
       if (rela_p)
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index ab255fa..2e49948 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -1199,6 +1199,38 @@
 	 0,			/* dst_mask */
 	 FALSE);		/* pcrel_offset */
 
+/* 16 bit offset for pc-relative branches.  */
+static reloc_howto_type elf_mips_gnu_rel16_s2 =
+  HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 mips_elf_generic_reloc, /* special_function */
+	 "R_MIPS_GNU_REL16_S2",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0x0000ffff,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 TRUE);			/* pcrel_offset */
+
+/* 16 bit offset for pc-relative branches.  */
+static reloc_howto_type elf_mips_gnu_rela16_s2 =
+  HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 mips_elf_generic_reloc, /* special_function */
+	 "R_MIPS_GNU_REL16_S2",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 TRUE);			/* pcrel_offset */
+
 /* This is derived from bfd_elf_generic_reloc.  NewABI allows us to have
    several relocations against the same address.  The addend is derived
    from the addends of preceding relocations.  If we don't need to
@@ -1897,6 +1929,8 @@
       return &elf_mips_gnu_vtinherit_howto;
     case BFD_RELOC_VTABLE_ENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case BFD_RELOC_16_PCREL_S2:
+      return &elf_mips_gnu_rela16_s2;
     default:
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -1920,6 +1954,11 @@
       return &elf_mips_gnu_vtinherit_howto;
     case R_MIPS_GNU_VTENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case R_MIPS_GNU_REL16_S2:
+      if (rela_p)
+	return &elf_mips_gnu_rela16_s2;
+      else
+	return &elf_mips_gnu_rel16_s2;
     default:
       BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
       if (rela_p)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 72516f7..bede3e6 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -163,8 +163,7 @@
   long min_got_dynindx;
   /* The greatest dynamic symbol table index corresponding to a symbol
      with a GOT entry that is not referenced (e.g., a dynamic symbol
-     with dynamic relocations pointing to it from non-primary
-     GOTs).  */
+     with dynamic relocations pointing to it from non-primary GOTs).  */
   long max_unref_got_dynindx;
   /* The greatest dynamic symbol table index not corresponding to a
      symbol without a GOT entry.  */
@@ -1719,15 +1718,15 @@
 
   if (abfd == NULL)
     return 0;
-  
+
   sgot = mips_elf_got_section (abfd, TRUE);
   if (sgot == NULL || mips_elf_section_data (sgot) == NULL)
     return 0;
-  
+
   g = mips_elf_section_data (sgot)->u.got_info;
   if (g == NULL || g->global_gotsym == NULL)
     return 0;
-    
+
   return g->global_gotsym->dynindx;
 }
 
@@ -1770,7 +1769,7 @@
   if (g->bfd2got && ibfd)
     {
       struct mips_got_entry e, *p;
-      
+
       BFD_ASSERT (h->dynindx >= 0);
 
       g = mips_elf_got_for_ibfd (g, ibfd);
@@ -1828,7 +1827,7 @@
 
   if (!entry)
     return MINUS_ONE;
-  
+
   index = entry->gotidx;
 
   if (offsetp)
@@ -1886,7 +1885,7 @@
   g = mips_elf_got_info (dynobj, &sgot);
   gp = _bfd_get_gp_value (output_bfd)
     + mips_elf_adjust_gp (output_bfd, g, input_bfd);
-  
+
   return sgot->output_section->vma + sgot->output_offset + index - gp;
 }
 
@@ -1918,14 +1917,14 @@
 						   INSERT);
   if (*loc)
     return *loc;
-      
+
   entry.gotidx = MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
 
   *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
 
   if (! *loc)
     return NULL;
-	      
+
   memcpy (*loc, &entry, sizeof entry);
 
   if (g->assigned_gotno >= g->local_gotno)
@@ -1965,7 +1964,7 @@
   g = mips_elf_got_info (dynobj, NULL);
 
   hsd.low = NULL;
-  hsd.max_unref_got_dynindx = 
+  hsd.max_unref_got_dynindx =
   hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount
     /* In the multi-got case, assigned_gotno of the master got_info
        indicate the number of entries that aren't referenced in the
@@ -2079,7 +2078,7 @@
 
   if (! *loc)
     return FALSE;
-	      
+
   entry.gotidx = -1;
   memcpy (*loc, &entry, sizeof entry);
 
@@ -2121,7 +2120,7 @@
 
   if (! *loc)
     return FALSE;
-	      
+
   memcpy (*loc, &entry, sizeof entry);
 
   return TRUE;
@@ -2187,7 +2186,7 @@
   struct mips_got_info *g;
   struct mips_elf_bfd2got_hash bfdgot_entry, *bfdgot;
   void **bfdgotp;
-  
+
   /* Find the got_info for this GOT entry's input bfd.  Create one if
      none exists.  */
   bfdgot_entry.bfd = entry->abfd;
@@ -2239,7 +2238,7 @@
   entryp = htab_find_slot (g->got_entries, entry, INSERT);
   if (*entryp != NULL)
     return 1;
-  
+
   *entryp = entry;
 
   if (entry->symndx >= 0 || entry->d.h->forced_local)
@@ -2268,7 +2267,7 @@
   unsigned int lcount = bfd2got->g->local_gotno;
   unsigned int gcount = bfd2got->g->global_gotno;
   unsigned int maxcnt = arg->max_count;
-  
+
   /* If we don't have a primary GOT and this is not too big, use it as
      a starting point for the primary GOT.  */
   if (! arg->primary && lcount + gcount <= maxcnt)
@@ -2336,7 +2335,7 @@
     {
       bfd2got->g->next = arg->current;
       arg->current = bfd2got->g;
-      
+
       arg->current_count = lcount + gcount;
     }
 
@@ -2417,7 +2416,7 @@
 
       if (entry->d.h == h)
 	return 1;
-      
+
       entry->d.h = h;
 
       /* If we can't find this entry with the new bfd hash, re-insert
@@ -2437,7 +2436,7 @@
       /* We might want to decrement the global_gotno count, but it's
 	 either too early or too late for that at this point.  */
     }
-  
+
   return 1;
 }
 
@@ -2478,7 +2477,7 @@
   BFD_ASSERT (g->next);
 
   g = g->next;
-  
+
   return (g->local_gotno + g->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
 }
 
@@ -2566,7 +2565,7 @@
   {
     struct mips_elf_bfd2got_hash *bfdgot;
     void **bfdgotp;
-  
+
     bfdgot = (struct mips_elf_bfd2got_hash *)bfd_alloc
       (abfd, sizeof (struct mips_elf_bfd2got_hash));
 
@@ -2592,7 +2591,7 @@
      the cache.  Also, knowing that every external symbol has a GOT
      helps speed up the resolution of local symbols too, so GNU/Linux
      follows IRIX's practice.
-     
+
      The number 2 is used by mips_elf_sort_hash_table_f to count
      global GOT symbols that are unreferenced in the primary GOT, with
      an initial dynamic index computed from gg->assigned_gotno, where
@@ -2665,10 +2664,10 @@
 
   got->_raw_size = (gg->next->local_gotno
 		    + gg->next->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
-  
+
   return TRUE;
 }
-     
+
 
 /* Returns the first relocation of type r_type found, beginning with
    RELOCATION.  RELEND is one-past-the-end of the relocation table.  */
@@ -5370,12 +5369,12 @@
 	    {
 	      struct mips_elf_link_hash_entry *hmips =
 		(struct mips_elf_link_hash_entry *) h;
-	      
+
 	      while (hmips->root.root.type == bfd_link_hash_indirect
 		     || hmips->root.root.type == bfd_link_hash_warning)
 		hmips = (struct mips_elf_link_hash_entry *)
 		  hmips->root.root.u.i.link;
-	  
+
 	      if ((hmips->root.root.type == bfd_link_hash_defined
 		   || hmips->root.root.type == bfd_link_hash_defweak)
 		  && hmips->root.root.u.def.section
@@ -5599,7 +5598,7 @@
 	  while (h->root.root.type == bfd_link_hash_indirect
 		 || h->root.root.type == bfd_link_hash_warning)
 	    h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-	  
+
 	  /* If a symbol is undefined, or if it may be overridden,
 	     skip it.  */
 	  if (! ((h->root.root.type == bfd_link_hash_defined
@@ -5662,7 +5661,7 @@
       /* Check that it's in range.  */
       if (sym_offset < -0x8000 || sym_offset >= 0x8000)
 	continue;
-      
+
       /* Get the section contents if we haven't done so already.  */
       if (contents == NULL)
 	{
@@ -5711,7 +5710,7 @@
     }
   return TRUE;
 
- relax_return:  
+ relax_return:
   if (free_contents != NULL)
     free (free_contents);
   return FALSE;
@@ -5857,7 +5856,7 @@
   if (dynobj == NULL)
     /* Relocatable links don't have it.  */
     return TRUE;
-  
+
   g = mips_elf_got_info (dynobj, &s);
   if (s == NULL)
     return TRUE;
@@ -6022,7 +6021,7 @@
 	  struct mips_got_info *g = gg;
 	  struct mips_elf_set_global_got_offset_arg set_got_offset_arg;
 	  unsigned int needed_relocs = 0;
-	  
+
 	  if (gg->next)
 	    {
 	      set_got_offset_arg.value = MIPS_ELF_GOT_SIZE (output_bfd);
@@ -6782,7 +6781,7 @@
       e.abfd = output_bfd;
       e.symndx = -1;
       e.d.h = (struct mips_elf_link_hash_entry *)h;
-      
+
       if (info->shared
 	  || h->root.type == bfd_link_hash_undefined
 	  || h->root.type == bfd_link_hash_undefweak)
@@ -8380,17 +8379,6 @@
     scRData, scSData, scSBss, scBss
   };
 
-  /* If all the things we linked together were PIC, but we're
-     producing an executable (rather than a shared object), then the
-     resulting file is CPIC (i.e., it calls PIC code.)  */
-  if (!info->shared
-      && !info->relocateable
-      && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC)
-    {
-      elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC;
-      elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC;
-    }
-
   /* We'd carefully arranged the dynamic symbol indices, and then the
      generic size_dynamic_sections renumbered them out from under us.
      Rather than trying somehow to prevent the renumbering, just do
@@ -9250,25 +9238,22 @@
 
   ok = TRUE;
 
-  if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC))
+  if (((new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0)
+      != ((old_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0))
     {
-      new_flags &= ~EF_MIPS_PIC;
-      old_flags &= ~EF_MIPS_PIC;
       (*_bfd_error_handler)
-	(_("%s: linking PIC files with non-PIC files"),
+	(_("%s: warning: linking PIC files with non-PIC files"),
 	 bfd_archive_filename (ibfd));
-      ok = FALSE;
+      ok = TRUE;
     }
 
-  if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC))
-    {
-      new_flags &= ~EF_MIPS_CPIC;
-      old_flags &= ~EF_MIPS_CPIC;
-      (*_bfd_error_handler)
-	(_("%s: linking abicalls files with non-abicalls files"),
-	 bfd_archive_filename (ibfd));
-      ok = FALSE;
-    }
+  if (new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC))
+    elf_elfheader (obfd)->e_flags |= EF_MIPS_CPIC;
+  if (! (new_flags & EF_MIPS_PIC))
+    elf_elfheader (obfd)->e_flags &= ~EF_MIPS_PIC;
+
+  new_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC);
+  old_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC);
 
   /* Compare the ISAs.  */
   if (mips_32bit_flags_p (old_flags) != mips_32bit_flags_p (new_flags))
diff --git a/bfd/som.h b/bfd/som.h
index 12ac666..20b8a81 100644
--- a/bfd/som.h
+++ b/bfd/som.h
@@ -27,6 +27,9 @@
 
 #include "libhppa.h"
 
+/* Enable PA2.0 if available */
+#define PA_2_0
+
 #include <a.out.h>
 #include <lst.h>
 #include <ar.h>
diff --git a/bfd/version.h b/bfd/version.h
index 0e17386..f9de765 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030521
+#define BFD_VERSION_DATE 20030523
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING @bfd_version_string@
diff --git a/configure b/configure
index fa3d44f..e0d5acf 100755
--- a/configure
+++ b/configure
@@ -1958,7 +1958,7 @@
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='$(exec_prefix)'/${target_alias}
+tooldir='${exec_prefix}'/${target_alias}
 build_tooldir=${tooldir}
 
 # Generate a default definition for YACC.  This is used if the makefile can't
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9cf50e6..5e2bed1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,163 @@
+2003-05-26  Elena Zannoni  <ezannoni@redhat.com>
+
+	* stabsread.c (dbx_lookup_type): Make static.
+	(read_type): Ditto.
+	(add_undefined_type): Ditto.
+	* stabsread.h (dbx_lookup_type, read_type, add_undefined_type): Do
+	not export.
+
+2003-05-26  Elena Zannoni  <ezannoni@redhat.com>
+
+	* hpread.c (hpread_has_name): Make static.
+	(hpread_psymtab_to_symtab): Ditto.
+	(file_exists): Ditto.
+	(hpread_call_pxdb): Ditto.
+	(hpread_pxdb_needed): Ditto.
+	(hpread_quick_traverse): Ditto.
+	(hpread_get_header): Ditto.
+	(hpread_get_lntt): Ditto.
+	(hpread_get_slt): Ditto.
+	(class_of): Ditto.
+
+2003-05-25  Andreas Schwab  <schwab@suse.de>
+
+	* m68k-tdep.c (m68k_gdbarch_init): Set parm_boundary instead of
+	stack_align and deprecated_extra_stack_alignment_needed.
+	(m68k_stack_align): Delete.
+
+	* m68k-tdep.c (m68k_register_raw_size): Remove cast.
+	(m68k_register_virtual_size): Likewise.
+	(altos_skip_prologue): Remove obsolete function.
+	(isi_frame_num_args): Likewise.
+	(news_frame_num_args): Likewise.
+	(m68k_fix_call_dummy): Make static.
+	(m68k_push_dummy_frame): Likewise.
+	(m68k_pop_frame): Likewise.
+	(m68k_skip_prologue): Likewise.
+	(m68k_frame_init_saved_regs): Likewise.
+	(m68k_saved_pc_after_call): Likewise.
+	(m68k_get_longjmp_target): Make multi-arch.
+	(m68k_gdbarch_init): Allocate and initialize gdbarch_tdep
+	structure.  Register m68k_get_longjmp_target if enabled.
+	* m68k-tdep.h (struct gdbarch_tdep): Define.
+	* config/m68k/tm-m68k.h: Don't include "regcache.h".
+
+	* Makefile.in (config.status): Also depend on configure.tgt
+	and configure.host.
+	(m68klinux-tdep.o): Update dependencies.
+	* configure.tgt (m68*-*-linux*): Set gdb_multi_arch to 1.
+	* m68klinux-tdep.c (M68K_LINUX_JB_ELEMENT_SIZE): Define.
+	(M68K_LINUX_JB_PC): Define.
+	(m68k_linux_pc_in_sigtramp): Renamed from m68k_linux_in_sigtramp
+	and take additional parameter.
+	(m68k_linux_sigtramp_saved_pc): Update.
+	(m68k_linux_init_abi): Set jb_pc and jb_elt_size.  Register
+	m68k_linux_pc_in_sigtramp, in_plt_section,
+	find_solib_trampoline_target.
+	* config/m68k/tm-linux.h: Don't include any tm headers.
+	(START_INFERIOR_TRAPS_EXPECTED): Remove definition.
+	(JB_ELEMENT_SIZE): Likewise.
+	(JB_PC): Likewise.
+	(GET_LONGJMP_TARGET): Likewise.
+	(IN_SIGTRAMP): Likewise.
+	(SVR4_SHARED_LIBS): Define this and include "solib.h".
+
+2003-05-25  Mark Kettenis  <kettenis@gnu.org>
+
+	* sparc-tdep.c (sparc32_do_push_arguments): New function.
+	(sparc32_push_arguments): Re-implement by calling
+	sparc32_do_push_arguments.
+
+2003-05-25  Mark Kettenis  <kettenis@gnu.org>
+
+	* sparc-tdep.c (SPARC_F0_REGNUM, SPARC_F1_REGNUM, SPARC_O0_REGNUM,
+	SPARC_O1_REGNUM): New defines.
+	(sparc32_extract_return_value): Rewrite to operate on a regcache.
+	(sparc32_store_return_value): New function.
+	(sparc_extract_struct_value_address): Rewrite to operate on a
+	regcache.
+	(sparc_gdbarch_init): Don't set
+	deprecated_extract_struct_value_address.  Set
+	extract_struct_value_address instead. Don't set
+	deprecated_extract_return_value and deprecated_store_return_value
+	for 32-bit targets.  Set extract_return_value and
+	store_return_value instead.
+	* config/sparc/tm-sparc.h (DEPRECATED_STORE_RETURN_VALUE,
+	DEPRECTAED_EXTRACT_RETURN_VALUE,
+	DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Don't define these.
+	(STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE,
+	EXTRACT_STRUCT_VALUE_ADDRESS): Define these instead.
+	(sparc_store_return_value): Remove prototype.
+	(sparc32_store_return_value): New prototype.
+	(sparc32_extract_return_value, sparc_extract_struct_value_address):
+	Adjust prototypes.
+
+2003-05-24  Mark Kettenis  <kettenis@gnu.org>
+
+	* sparcnbsd-tdep.c: Include "gdb_string.h".
+
+2003-05-23  Andrew Cagney  <cagney@redhat.com>
+
+	* p-valprint.c (pascal_val_print): Replace extract_address with
+	the inline equivalent extract_unsigned_integer.
+	* jv-valprint.c (java_value_print): Ditto.
+	* ada-valprint.c (ada_val_print_1): Ditto.
+	* ada-lang.h (EXTRACT_ADDRESS): Ditto.
+
+2003-05-23  Theodore A. Roth  <troth@openavr.org>
+
+	* blockframe.c (frameless_look_for_prologue): Remove unused
+	after_prologue variable.
+
+2003-05-23  Mark Kettenis  <kettenis@gnu.org>
+
+	* blockframe.c (get_pc_function_start): Rewrite to avoid
+	asignments in if-statements.
+
+2003-05-23  Raoul Gough  <RaoulGough@yahoo.co.uk>
+
+	Committed by Elena Zannoni  <ezannoni@redhat.com>.
+  	* coffread.c(coff_symtab_read): Do relocate static symbols from PE
+	files, don't relocate absolute symbols (and do use mst_abs).
+
+2003-05-23  Andrew Cagney  <cagney@redhat.com>
+
+	* objc-lang.c: Include "gdb_assert.h".
+	(objc_op_print_tab): Use OP_NULL and PREC_NULL instead of 0.
+	(CHECK, CHECK_FATAL, __CHECK_FUNCTION): Delete macros.
+	(gdb_check, gdb_check_fatal): Delete functions.
+	(read_objc_methlist_method): Replace CHECK and CHECK_FATAL with
+	gdb_assert.
+	(parse_selector, parse_method, find_methods, find_imps): Ditto.
+	* Makefile.in (objc-lang.o): Update dependencies.
+
+2003-05-22  Ian Lance Taylor  <ian@airs.com>
+
+	* disasm.c (gdb_disassemble_info): Initialize disassemble_info
+	with fprintf_filtered, not fprintf_unfiltered.
+
+2003-05-22  Andrew Cagney  <cagney@redhat.com>
+
+	* stack.c (frame_info): Inline extract_address, replacing it with
+	extract_unsigned_integer.
+	* findvar.c (unsigned_pointer_to_address): Ditto.
+	* dwarf2loc.c (dwarf_expr_read_reg): Ditto.
+	* dwarf2expr.c (dwarf2_read_address): Ditto.
+	* frame.c (frame_pc_unwind): Update comment.
+	* dummy-frame.c (deprecated_read_register_dummy): Update comment.
+
+2003-05-22  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* infptrace.c (detach): Call print_sys_errmsg rather than
+	perror_with_name to issue warning message when errno is non-zero
+	after calling ptrace detach.
+
+2003-05-21  J. Brobecker  <brobecker@gnat.com>
+
+	* config/pa/tm-hppa.h: Delete some unused macros. Move some
+	macro definitions from here...
+	* hppa-tdep.c: ...to there.
+
 2003-05-20  Kevin Buettner  <kevinb@redhat.com>
 
 	* mips-nat.c (REGISTER_PTRACE_ADDR): Convert macro to function
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 38be4f6..c52eadc 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1157,7 +1157,7 @@
 stamp-h: config.in config.status
 	CONFIG_HEADERS=config.h:config.in $(SHELL) config.status
 
-config.status: configure
+config.status: configure configure.tgt configure.host
 	$(SHELL) config.status --recheck
 
 force:
@@ -1923,7 +1923,8 @@
 	$(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \
 	$(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h)
 m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
-	$(target_h) $(gdb_string_h) $(gdbtypes_h) $(osabi_h) $(m68k_tdep_t)
+	$(target_h) $(gdb_string_h) $(gdbtypes_h) $(osabi_h) $(regcache_h) \
+	$(objfiles_h) $(symtab_h) $(m68k_tdep_t)
 m68knbsd-nat.o: m68knbsd-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
 	$(regcache_h)
 m68knbsd-tdep.o: m68knbsd-tdep.c $(defs_h) $(gdbtypes_h) $(regcache_h)
@@ -2007,7 +2008,7 @@
 	$(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \
 	$(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) $(gdb_string_h) \
 	$(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) $(gdb_regex_h) \
-	$(regcache_h) $(block_h) $(infcall_h) $(valprint_h)
+	$(regcache_h) $(block_h) $(infcall_h) $(valprint_h) $(gdb_assert_h)
 objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
 	$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \
 	$(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index ae863bd..54e56bb 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -27,9 +27,9 @@
 
 struct block;
 
-/* A macro to reorder the bytes of an address depending on the endiannes
-   of the target */
-#define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x)))
+/* A macro to reorder the bytes of an address depending on the
+   endiannes of the target.  */
+#define EXTRACT_ADDRESS(x) ((void *) extract_unsigned_integer (&(x), sizeof (x)))
 /* A macro to reorder the bytes of an int depending on the endiannes
    of the target */
 #define EXTRACT_INT(x) ((int) extract_signed_integer (&(x), sizeof (x)))
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 11c42bf..f5f4118 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -742,9 +742,11 @@
       if (addressprint)
 	{
 	  fprintf_filtered (stream, "@");
+	  /* Extract an address, assume that the address is unsigned.  */
 	  print_address_numeric
-	    (extract_address (valaddr,
-			      TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+	    (extract_unsigned_integer (valaddr,
+				       TARGET_PTR_BIT / HOST_CHAR_BIT),
+	     1, stream);
 	  if (deref_ref)
 	    fputs_filtered (": ", stream);
 	}
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 3c71376..9f91226 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -144,7 +144,7 @@
 int
 frameless_look_for_prologue (struct frame_info *frame)
 {
-  CORE_ADDR func_start, after_prologue;
+  CORE_ADDR func_start;
 
   func_start = get_frame_func (frame);
   if (func_start)
@@ -223,28 +223,31 @@
 CORE_ADDR
 get_pc_function_start (CORE_ADDR pc)
 {
-  register struct block *bl;
-  register struct symbol *symbol;
-  register struct minimal_symbol *msymbol;
-  CORE_ADDR fstart;
+  struct block *bl;
+  struct minimal_symbol *msymbol;
 
-  if ((bl = block_for_pc (pc)) != NULL &&
-      (symbol = block_function (bl)) != NULL)
+  bl = block_for_pc (pc);
+  if (bl)
     {
-      bl = SYMBOL_BLOCK_VALUE (symbol);
-      fstart = BLOCK_START (bl);
+      struct symbol *symbol = block_function (bl);
+
+      if (symbol)
+	{
+	  bl = SYMBOL_BLOCK_VALUE (symbol);
+	  return BLOCK_START (bl);
+	}
     }
-  else if ((msymbol = lookup_minimal_symbol_by_pc (pc)) != NULL)
+
+  msymbol = lookup_minimal_symbol_by_pc (pc);
+  if (msymbol)
     {
-      fstart = SYMBOL_VALUE_ADDRESS (msymbol);
-      if (!find_pc_section (fstart))
-	return 0;
+      CORE_ADDR fstart = SYMBOL_VALUE_ADDRESS (msymbol);
+
+      if (find_pc_section (fstart))
+	return fstart;
     }
-  else
-    {
-      fstart = 0;
-    }
-  return (fstart);
+
+  return 0;
 }
 
 /* Return the symbol for the function executing in frame FRAME.  */
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 6daf7b4..81def0a 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -869,7 +869,6 @@
 	       print_address_symbolic work right without the (now
 	       gone) "set fast-symbolic-addr off" kludge.  */
 
-	    /* FIXME: should use mst_abs, and not relocate, if absolute.  */
 	    enum minimal_symbol_type ms_type;
 	    int sec;
 
@@ -891,12 +890,23 @@
 		  || cs->c_sclass == C_THUMBEXT ?
 		  mst_bss : mst_file_bss;
 	      }
+ 	    else if (cs->c_secnum == N_ABS)
+ 	      {
+ 		/* Use the correct minimal symbol type (and don't
+ 		   relocate) for absolute values. */
+ 		ms_type = mst_abs;
+ 		sec = cs_to_section (cs, objfile);
+ 		tmpaddr = cs->c_value;
+ 	      }
 	    else
 	      {
 		sec = cs_to_section (cs, objfile);
 		tmpaddr = cs->c_value;
-		if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
-		    || cs->c_sclass == C_THUMBEXT)
+ 		/* Statics in a PE file also get relocated */
+ 		if (cs->c_sclass == C_EXT
+ 		    || cs->c_sclass == C_THUMBEXTFUNC
+ 		    || cs->c_sclass == C_THUMBEXT
+ 		    || (pe_file && (cs->c_sclass == C_STAT)))
 		  tmpaddr += ANOFFSET (objfile->section_offsets, sec);
 
 		if (sec == SECT_OFF_TEXT (objfile))
diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h
index 636df0b..fc191b1 100644
--- a/gdb/config/m68k/tm-linux.h
+++ b/gdb/config/m68k/tm-linux.h
@@ -20,28 +20,11 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include "config/tm-linux.h"
-#include "m68k/tm-m68k.h"
+/* We define SVR4_SHARED_LIBS unconditionally, on the assumption that
+   link.h is available on all linux platforms.  For I386 and SH3/4, 
+   we hard-code the information rather than use link.h anyway (for 
+   the benefit of cross-debugging).  We may move to doing that for
+   other architectures as well.  */
 
-#include "regcache.h"
-
-/* Number of traps that happen between exec'ing the shell to run an
-   inferior, and when we finally get to the inferior code.  This is 2
-   on most implementations.  */
-
-#define START_INFERIOR_TRAPS_EXPECTED 2
-
-/* Offsets (in target ints) into jmp_buf.  */
-
-#define JB_ELEMENT_SIZE 4
-#define JB_PC 7
-
-/* Figure out where the longjmp will land.  Slurp the args out of the stack.
-   We expect the first arg to be a pointer to the jmp_buf structure from which
-   we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
-   This routine returns true on success */
-
-#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
-
-#define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc)
-extern int m68k_linux_in_sigtramp (CORE_ADDR pc);
+#define SVR4_SHARED_LIBS
+#include "solib.h"		/* Support for shared libraries. */
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index cb72c98..f773428 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -1,6 +1,6 @@
 /* Parameters for execution on a 68000 series machine.
    Copyright 1986, 1987, 1989, 1990, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,8 +19,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include "regcache.h"
-
 #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
 
 extern int m68k_get_longjmp_target (CORE_ADDR *);
diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h
index 070c83c..290f752 100644
--- a/gdb/config/pa/tm-hppah.h
+++ b/gdb/config/pa/tm-hppah.h
@@ -35,8 +35,10 @@
 #include "somsolib.h"
 #endif
 
+#if !GDB_MULTI_ARCH
 extern int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name);
 #define PC_IN_SIGTRAMP(pc, name) hppa_hpux_pc_in_sigtramp (pc, name)
+#endif
 
 extern void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi,
                                                   CORE_ADDR *tmp);
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index ab18477..e51eb63 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -267,17 +267,16 @@
 /* Write into appropriate registers a function return value of type
    TYPE, given in virtual format.  */
 
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
-     sparc_store_return_value (TYPE, VALBUF)
-extern void sparc_store_return_value (struct type *, char *);
+#define STORE_RETURN_VALUE(TYPE, REGCACHE, VALBUF) \
+     sparc32_store_return_value (TYPE, REGCACHE, VALBUF)
+extern void sparc32_store_return_value (struct type *, struct regcache *,
+					const void *);
 
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
+/* Extract from REGCACHE the address in which a function should return
+   its structure value.  */
 
-#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-     sparc_extract_struct_value_address (REGBUF)
-
+#define EXTRACT_STRUCT_VALUE_ADDRESS(REGCACHE) \
+     sparc_extract_struct_value_address (REGCACHE)
 extern CORE_ADDR sparc_extract_struct_value_address (char *);
 
 /* Stack must be aligned on 64-bit boundaries when synthesizing
@@ -668,9 +667,10 @@
    function return value of type TYPE, and copy that, in virtual
    format, into VALBUF.  */
 
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
-     sparc32_extract_return_value (TYPE, REGBUF, VALBUF)
-extern void sparc32_extract_return_value (struct type *, char[], char *);
+#define EXTRACT_RETURN_VALUE(TYPE, REGCACHE, VALBUF) \
+     sparc32_extract_return_value (TYPE, REGCACHE, VALBUF)
+extern void sparc32_extract_return_value (struct type *, struct regcache *,
+					  void *valbuf);
 
 #endif /* GDB_MULTI_ARCH */
 
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index fe4cc5d..955b3a4 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -130,6 +130,7 @@
 m68*-*-coff*)		gdb_target=monitor ;;
 m68*-*-elf*)		gdb_target=monitor ;;
 m68*-*-linux*)		gdb_target=linux
+			gdb_multi_arch=1
 			build_gdbserver=yes
 			;;
 m68*-*-lynxos*)		gdb_target=m68klynx ;;
diff --git a/gdb/disasm.c b/gdb/disasm.c
index c8a2029..553ca1c 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -315,7 +315,7 @@
 {
   disassemble_info di;
   INIT_DISASSEMBLE_INFO_NO_ARCH (di, file,
-				 (fprintf_ftype) fprintf_unfiltered);
+				 (fprintf_ftype) fprintf_filtered);
   di.flavour = bfd_target_unknown_flavour;
   di.memory_error_func = dis_asm_memory_error;
   di.print_address_func = dis_asm_print_address;
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index ca11bd6..94413f4 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -183,7 +183,7 @@
       /* NOTE: cagney/2002-08-12: Replaced a call to
 	 regcache_raw_read_as_address() with a call to
 	 regcache_cooked_read_unsigned().  The old, ...as_address
-	 function was eventually calling extract_unsigned_integer (via
+	 function was eventually calling extract_unsigned_integer (nee
 	 extract_address) to unpack the registers value.  The below is
 	 doing an unsigned extract so that it is functionally
 	 equivalent.  The read needs to be cooked as, otherwise, it
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 410cd54..aa391eb 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -178,7 +178,9 @@
     error ("dwarf2_read_address: Corrupted DWARF expression.");
 
   *bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
-  result = extract_address (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  /* NOTE: cagney/2003-05-22: This extract is assuming that a DWARF 2
+     address is always unsigned.  That may or may not be true.  */
+  result = extract_unsigned_integer (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
   return result;
 }
 
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 2bb4f26..9ed6b7e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -124,7 +124,9 @@
 
   frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr,
 		  &realnum, buf);
-  result = extract_address (buf, regsize);
+  /* NOTE: cagney/2003-05-22: This extract is assuming that a DWARF 2
+     address is always unsigned.  That may or may not be true.  */
+  result = extract_unsigned_integer (buf, regsize);
 
   return result;
 }
diff --git a/gdb/findvar.c b/gdb/findvar.c
index c9623bf..5d975e4 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -333,7 +333,7 @@
 CORE_ADDR
 unsigned_pointer_to_address (struct type *type, const void *buf)
 {
-  return extract_address (buf, TYPE_LENGTH (type));
+  return extract_unsigned_integer (buf, TYPE_LENGTH (type));
 }
 
 CORE_ADDR
diff --git a/gdb/frame.c b/gdb/frame.c
index fe863d6..07e0e5b 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -376,7 +376,7 @@
 	     implementation is no more than:
 	   
 	     frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
-	     return extract_address (buf, size of ISA_PC_REGNUM);
+	     return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
 
 	     Note: this method is very heavily dependent on a correct
 	     register-unwind implementation, it pays to fix that
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index e8d62db..1f78d06 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -68,11 +68,33 @@
 /* Some local constants.  */
 static const int hppa_num_regs = 128;
 
+/* Get at various relevent fields of an instruction word. */
+#define MASK_5 0x1f
+#define MASK_11 0x7ff
+#define MASK_14 0x3fff
+#define MASK_21 0x1fffff
+
+/* Define offsets into the call dummy for the target function address.
+   See comments related to CALL_DUMMY for more info.  */
+#define FUNC_LDIL_OFFSET (INSTRUCTION_SIZE * 9)
+#define FUNC_LDO_OFFSET (INSTRUCTION_SIZE * 10)
+
+/* Define offsets into the call dummy for the _sr4export address.
+   See comments related to CALL_DUMMY for more info.  */
+#define SR4EXPORT_LDIL_OFFSET (INSTRUCTION_SIZE * 12)
+#define SR4EXPORT_LDO_OFFSET (INSTRUCTION_SIZE * 13)
+
 /* To support detection of the pseudo-initial frame
    that threads have. */
 #define THREAD_INITIAL_FRAME_SYMBOL  "__pthread_exit"
 #define THREAD_INITIAL_FRAME_SYM_LEN  sizeof(THREAD_INITIAL_FRAME_SYMBOL)
 
+/* Sizes (in bytes) of the native unwind entries.  */
+#define UNWIND_ENTRY_SIZE 16
+#define STUB_UNWIND_ENTRY_SIZE 8
+
+static int get_field (unsigned word, int from, int to);
+
 static int extract_5_load (unsigned int);
 
 static unsigned extract_5R_store (unsigned int);
@@ -224,6 +246,15 @@
   return (int) ((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1);
 }
 
+/* Extract the bits at positions between FROM and TO, using HP's numbering
+   (MSB = 0). */
+
+static int
+get_field (unsigned word, int from, int to)
+{
+  return ((word) >> (31 - (to)) & ((1 << ((to) - (from) + 1)) - 1));
+}
+
 /* extract the immediate field from a ld{bhw}s instruction */
 
 static int
@@ -275,15 +306,15 @@
 
   word &= MASK_21;
   word <<= 11;
-  val = GET_FIELD (word, 20, 20);
+  val = get_field (word, 20, 20);
   val <<= 11;
-  val |= GET_FIELD (word, 9, 19);
+  val |= get_field (word, 9, 19);
   val <<= 2;
-  val |= GET_FIELD (word, 5, 6);
+  val |= get_field (word, 5, 6);
   val <<= 5;
-  val |= GET_FIELD (word, 0, 4);
+  val |= get_field (word, 0, 4);
   val <<= 2;
-  val |= GET_FIELD (word, 7, 8);
+  val |= get_field (word, 7, 8);
   return sign_extend (val, 21) << 11;
 }
 
@@ -296,15 +327,15 @@
 {
   unsigned val = 0;
 
-  val |= GET_FIELD (opnd, 11 + 14, 11 + 18);
+  val |= get_field (opnd, 11 + 14, 11 + 18);
   val <<= 2;
-  val |= GET_FIELD (opnd, 11 + 12, 11 + 13);
+  val |= get_field (opnd, 11 + 12, 11 + 13);
   val <<= 2;
-  val |= GET_FIELD (opnd, 11 + 19, 11 + 20);
+  val |= get_field (opnd, 11 + 19, 11 + 20);
   val <<= 11;
-  val |= GET_FIELD (opnd, 11 + 1, 11 + 11);
+  val |= get_field (opnd, 11 + 1, 11 + 11);
   val <<= 1;
-  val |= GET_FIELD (opnd, 11 + 0, 11 + 0);
+  val |= get_field (opnd, 11 + 0, 11 + 0);
   return word | val;
 }
 
@@ -314,9 +345,9 @@
 static int
 extract_17 (unsigned word)
 {
-  return sign_extend (GET_FIELD (word, 19, 28) |
-		      GET_FIELD (word, 29, 29) << 10 |
-		      GET_FIELD (word, 11, 15) << 11 |
+  return sign_extend (get_field (word, 19, 28) |
+		      get_field (word, 29, 29) << 10 |
+		      get_field (word, 11, 15) << 11 |
 		      (word & 0x1) << 16, 17) << 2;
 }
 
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 958507f..f955fb9 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -140,9 +140,7 @@
 
 /* Forward procedure declarations */
 
-static void set_namestring (union dnttentry *sym, char **namep,
-                            struct objfile *objfile);
-
+/* Used in somread.c.  */
 void hpread_symfile_init (struct objfile *);
 
 void do_pxdb (bfd *);
@@ -151,6 +149,9 @@
 
 void hpread_symfile_finish (struct objfile *);
 
+static void set_namestring (union dnttentry *sym, char **namep,
+                            struct objfile *objfile);
+
 static union dnttentry *hpread_get_gntt (int, struct objfile *);
 
 static union dnttentry *hpread_get_lntt (int index, struct objfile *objfile);
@@ -172,11 +173,11 @@
 
 static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
 
-int hpread_has_name (enum dntt_entry_type kind);
+static int hpread_has_name (enum dntt_entry_type kind);
 
 static void hpread_psymtab_to_symtab_1 (struct partial_symtab *);
 
-void hpread_psymtab_to_symtab (struct partial_symtab *);
+static void hpread_psymtab_to_symtab (struct partial_symtab *);
 
 static struct symtab *hpread_expand_symtab
   (struct objfile *, int, int, CORE_ADDR, int,
@@ -261,7 +262,7 @@
 #include "gdb_string.h"
 
 /* check for the existence of a file, given its full pathname */
-int
+static int
 file_exists (char *filename)
 {
   if (filename)
@@ -321,7 +322,7 @@
    NOTE: uses system function and string functions directly.
 
    Return value: 1 if ok, 0 if not */
-int
+static int
 hpread_call_pxdb (const char *file_name)
 {
   char *p;
@@ -354,7 +355,7 @@
    by PXDB, and we have thus called PXDB to do this processing
    and the file therefore needs to be re-loaded.  Otherwise
    return 0. */
-int
+static int
 hpread_pxdb_needed (bfd *sym_bfd)
 {
   asection *pinfo_section, *debug_section, *header_section;
@@ -837,7 +838,7 @@
    a file can result in a compiled object which does not have a module
    entry for it, so in such cases we create a psymtab for the file.  */
 
-int
+static int
 hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
 		       char *vt_bits, PXDB_header_ptr pxdb_header_p)
 {
@@ -1542,7 +1543,7 @@
 
 /* Get appropriate header, based on pxdb type. 
    Return value: 1 if ok, 0 if not */
-int
+static int
 hpread_get_header (struct objfile *objfile, PXDB_header_ptr pxdb_header_p)
 {
   asection *pinfo_section, *debug_section, *header_section;
@@ -2294,7 +2295,7 @@
 
 /* Various small functions to get entries in the debug symbol sections.  */
 
-union dnttentry *
+static union dnttentry *
 hpread_get_lntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
@@ -2308,7 +2309,7 @@
     &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
-union sltentry *
+static union sltentry *
 hpread_get_slt (int index, struct objfile *objfile)
 {
   return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
@@ -2588,7 +2589,7 @@
  * leave it here in case it proves useful later on. - RT).
  */
 
-int
+static int
 hpread_has_name (enum dntt_entry_type kind)
 {
   switch (kind)
@@ -2721,7 +2722,7 @@
 /* Read in all of the symbols for a given psymtab for real.
    Be verbose about it if the user wants that.  */
 
-void
+static void
 hpread_psymtab_to_symtab (struct partial_symtab *pst)
 {
   /* Get out quick if given junk.  */
@@ -5016,7 +5017,7 @@
  * Called from hpread_process_one_debug_symbol()
  * If "f" is not a member function, return NULL.
  */
-char *
+static char *
 class_of (struct type *functype)
 {
   struct type *first_param_type;
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index 1225dd8..6147cbe 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -301,8 +301,8 @@
   errno = 0;
   ptrace (PT_DETACH, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) 1,
           signal);
-  if (errno && errno != ESRCH)
-    perror_with_name ("ptrace");
+  if (errno)
+    print_sys_errmsg ("ptrace", errno);
   attach_flag = 0;
 }
 #endif /* ATTACH_DETACH */
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 8620175..ef25847 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -110,14 +110,22 @@
 		{
 		  read_memory (address, buf, sizeof (buf));
 		  address += TARGET_PTR_BIT / HOST_CHAR_BIT;
-		  element = extract_address (buf, sizeof (buf));
+		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
+                     pulls a host sized pointer out of the target and
+                     then extracts that as an address (while assuming
+                     that the address is unsigned)!  */
+		  element = extract_unsigned_integer (buf, sizeof (buf));
 		}
 
 	      for (reps = 1; i + reps < length; reps++)
 		{
 		  read_memory (address, buf, sizeof (buf));
 		  address += TARGET_PTR_BIT / HOST_CHAR_BIT;
-		  next_element = extract_address (buf, sizeof (buf));
+		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
+                     pulls a host sized pointer out of the target and
+                     then extracts that as an address (while assuming
+                     that the address is unsigned)!  */
+		  next_element = extract_unsigned_integer (buf, sizeof (buf));
 		  if (next_element != element)
 		    break;
 		}
@@ -468,7 +476,8 @@
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if we ARE using
 	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
-	  print_address_demangle (extract_address (valaddr, TYPE_LENGTH (type)),
+	  /* Extract an address, assume that it is unsigned.  */
+	  print_address_demangle (extract_unsigned_integer (valaddr, TYPE_LENGTH (type)),
 				  stream, demangle);
 	  break;
 	}
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 087d0bb..fbbac63 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -77,13 +77,13 @@
 #endif
 
 
-void m68k_frame_init_saved_regs (struct frame_info *frame_info);
+static void m68k_frame_init_saved_regs (struct frame_info *frame_info);
 
 
 /* gdbarch_breakpoint_from_pc is set to m68k_local_breakpoint_from_pc
    so m68k_remote_breakpoint_from_pc is currently not used.  */
 
-const static unsigned char *
+static const unsigned char *
 m68k_remote_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char break_insn[] = {0x4e, (0x40 | REMOTE_BPT_VECTOR)};
@@ -91,7 +91,7 @@
   return break_insn;
 }
 
-const static unsigned char *
+static const unsigned char *
 m68k_local_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char break_insn[] = {0x4e, (0x40 | BPT_VECTOR)};
@@ -110,13 +110,11 @@
 /* Number of bytes of storage in the actual machine representation
    for register regnum.  On the 68000, all regs are 4 bytes
    except the floating point regs which are 12 bytes.  */
-/* Note that the unsigned cast here forces the result of the
-   subtraction to very high positive values if regnum < FP0_REGNUM */
 
 static int
 m68k_register_raw_size (int regnum)
 {
-  return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
+  return (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 8 ? 12 : 4);
 }
 
 /* Number of bytes of storage in the program's representation
@@ -126,7 +124,7 @@
 static int
 m68k_register_virtual_size (int regnum)
 {
-  return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
+  return (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 8 ? 12 : 4);
 }
 
 /* Return the GDB type object for the "standard" data type of data in
@@ -178,14 +176,6 @@
     return register_names[regnum];
 }
 
-/* Stack must be kept short aligned when doing function calls.  */
-
-static CORE_ADDR
-m68k_stack_align (CORE_ADDR addr)
-{
-  return ((addr + 1) & ~1);
-}
-
 /* Index within `registers' of the first byte of the space for
    register regnum.  */
 
@@ -296,28 +286,6 @@
 }
 
 
-/* The only reason this is here is the tm-altos.h reference below.  It
-   was moved back here from tm-m68k.h.  FIXME? */
-
-extern CORE_ADDR
-altos_skip_prologue (CORE_ADDR pc)
-{
-  register int op = read_memory_unsigned_integer (pc, 2);
-  if (op == P_LINKW_FP)
-    pc += 4;			/* Skip link #word */
-  else if (op == P_LINKL_FP)
-    pc += 6;			/* Skip link #long */
-  /* Not sure why branches are here.  */
-  /* From tm-altos.h */
-  else if (op == 0060000)
-    pc += 4;			/* Skip bra #word */
-  else if (op == 00600377)
-    pc += 6;			/* skip bra #long */
-  else if ((op & 0177400) == 0060000)
-    pc += 2;			/* skip bra #char */
-  return pc;
-}
-
 int
 delta68_in_sigtramp (CORE_ADDR pc, char *name)
 {
@@ -353,31 +321,6 @@
 				       + 4, 4);
 }
 
-/* Return number of args passed to a frame.
-   Can return -1, meaning no way to tell.  */
-
-int
-isi_frame_num_args (struct frame_info *fi)
-{
-  int val;
-  CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
-  int insn = read_memory_unsigned_integer (pc, 2);
-  val = 0;
-  if (insn == 0047757 || insn == 0157374)	/* lea W(sp),sp or addaw #W,sp */
-    val = read_memory_integer (pc + 2, 2);
-  else if ((insn & 0170777) == 0050217	/* addql #N, sp */
-	   || (insn & 0170777) == 0050117)	/* addqw */
-    {
-      val = (insn >> 9) & 7;
-      if (val == 0)
-	val = 8;
-    }
-  else if (insn == 0157774)	/* addal #WW, sp */
-    val = read_memory_integer (pc + 2, 4);
-  val >>= 2;
-  return val;
-}
-
 int
 delta68_frame_num_args (struct frame_info *fi)
 {
@@ -400,33 +343,11 @@
   return val;
 }
 
-int
-news_frame_num_args (struct frame_info *fi)
-{
-  int val;
-  CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
-  int insn = read_memory_unsigned_integer (pc, 2);
-  val = 0;
-  if (insn == 0047757 || insn == 0157374)	/* lea W(sp),sp or addaw #W,sp */
-    val = read_memory_integer (pc + 2, 2);
-  else if ((insn & 0170777) == 0050217	/* addql #N, sp */
-	   || (insn & 0170777) == 0050117)	/* addqw */
-    {
-      val = (insn >> 9) & 7;
-      if (val == 0)
-	val = 8;
-    }
-  else if (insn == 0157774)	/* addal #WW, sp */
-    val = read_memory_integer (pc + 2, 4);
-  val >>= 2;
-  return val;
-}
-
 /* Insert the specified number of args and function address
    into a call sequence of the above form stored at DUMMYNAME.
    We use the BFD routines to store a big-endian value of known size.  */
 
-void
+static void
 m68k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
 		     struct value **args, struct type *type, int gcc_p)
 {
@@ -438,7 +359,7 @@
 
 /* Push an empty stack frame, to record the current PC, etc.  */
 
-void
+static void
 m68k_push_dummy_frame (void)
 {
   register CORE_ADDR sp = read_register (SP_REGNUM);
@@ -468,7 +389,7 @@
 /* Discard from the stack the innermost frame,
    restoring all saved registers.  */
 
-void
+static void
 m68k_pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
@@ -539,7 +460,7 @@
 
  */
 
-CORE_ADDR
+static CORE_ADDR
 m68k_skip_prologue (CORE_ADDR ip)
 {
   register CORE_ADDR limit;
@@ -580,7 +501,7 @@
    ways in the stack frame.  sp is even more special:
    the address we return for it IS the sp for the next frame.  */
 
-void
+static void
 m68k_frame_init_saved_regs (struct frame_info *frame_info)
 {
   register int regnum;
@@ -905,17 +826,19 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into PC.
    This routine returns true on success. */
 
-/* NOTE: cagney/2000-11-08: For this function to be fully multi-arched
-   the macro's JB_PC and JB_ELEMENT_SIZE would need to be moved into
-   the ``struct gdbarch_tdep'' object and then set on a target ISA/ABI
-   dependant basis. */
-
 int
 m68k_get_longjmp_target (CORE_ADDR *pc)
 {
-#if defined (JB_PC) && defined (JB_ELEMENT_SIZE)
   char *buf;
   CORE_ADDR sp, jb_addr;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+  if (tdep->jb_pc < 0)
+    {
+      internal_error (__FILE__, __LINE__,
+		      "m68k_get_longjmp_target: not implemented");
+      return 0;
+    }
 
   buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   sp = read_register (SP_REGNUM);
@@ -926,18 +849,12 @@
 
   jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
 
-  if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
+  if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
 			  TARGET_PTR_BIT / TARGET_CHAR_BIT))
     return 0;
 
   *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
-
   return 1;
-#else
-  internal_error (__FILE__, __LINE__,
-		  "m68k_get_longjmp_target: not implemented");
-  return 0;
-#endif
 }
 
 /* Immediately after a function call, return the saved pc before the frame
@@ -945,7 +862,7 @@
    system call, and if so, we know that Sun pushes the call # on the stack
    prior to doing the trap. */
 
-CORE_ADDR
+static CORE_ADDR
 m68k_saved_pc_after_call (struct frame_info *frame)
 {
 #ifdef SYSCALL_TRAP
@@ -979,11 +896,8 @@
   if (arches != NULL)
     return (arches->gdbarch);
 
-#if 0
-  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
-#endif
- 
-  gdbarch = gdbarch_alloc (&info, 0);
+  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  gdbarch = gdbarch_alloc (&info, tdep);
 
   /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
@@ -1000,8 +914,7 @@
 
   /* Stack grows down. */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  set_gdbarch_stack_align (gdbarch, m68k_stack_align);
-  set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
+  set_gdbarch_parm_boundary (gdbarch, 32);
 
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
@@ -1053,9 +966,22 @@
   /* Should be using push_dummy_call.  */
   set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
 
+#if defined JB_PC && defined JB_ELEMENT_SIZE
+  tdep->jb_pc = JB_PC;
+  tdep->jb_elt_size = JB_ELEMENT_SIZE;
+#else
+  tdep->jb_pc = -1;
+#endif
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
+  /* Now we have tuned the configuration, set a few final things,
+     based on what the OS ABI has told us.  */
+
+  if (tdep->jb_pc >= 0)
+    set_gdbarch_get_longjmp_target (gdbarch, m68k_get_longjmp_target);
+
   return gdbarch;
 }
 
@@ -1063,7 +989,10 @@
 static void
 m68k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
 
+  if (tdep == NULL)
+    return;
 }
 
 void
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index 8da568e..7c499a7 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -1,5 +1,5 @@
 /* Common target dependent code for the Motorola 68000 series.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -44,4 +44,14 @@
   M68K_FPI_REGNUM = 28
 };
 
+/* Target-dependent structure in gdbarch.  */
+struct gdbarch_tdep
+{
+  /* Offset to PC value in the jump buffer.  If this is negative,
+     longjmp support will be disabled.  */
+  int jb_pc;
+  /* The size of each entry in the jump buffer.  */
+  size_t jb_elt_size;
+};
+
 #endif /* M68K_TDEP_H */
diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c
index 8b9193d..612f9fd 100644
--- a/gdb/m68klinux-tdep.c
+++ b/gdb/m68klinux-tdep.c
@@ -27,8 +27,16 @@
 #include "gdb_string.h"
 #include "gdbtypes.h"
 #include "osabi.h"
+#include "regcache.h"
+#include "objfiles.h"
+#include "symtab.h"
 #include "m68k-tdep.h"
 
+/* Offsets (in target ints) into jmp_buf.  */
+
+#define M68K_LINUX_JB_ELEMENT_SIZE 4
+#define M68K_LINUX_JB_PC 7
+
 /* Check whether insn1 and insn2 are parts of a signal trampoline.  */
 
 #define IS_SIGTRAMP(insn1, insn2)					\
@@ -47,8 +55,8 @@
    of m68k_linux_frame_saved_pc we also distinguish between non-RT and RT
    signal trampolines.  */
 
-int
-m68k_linux_in_sigtramp (CORE_ADDR pc)
+static int
+m68k_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
 {
   CORE_ADDR sp;
   char buf[12];
@@ -110,7 +118,7 @@
 
   /* Don't cause a memory_error when accessing sigcontext in case the
      stack layout has changed or the stack is corrupt.  */
-  if (m68k_linux_in_sigtramp (get_frame_pc (frame)) == 2)
+  if (m68k_linux_pc_in_sigtramp (get_frame_pc (frame), 0) == 2)
     target_read_memory (sigcontext_addr + UCONTEXT_PC_OFFSET, buf, ptrbytes);
   else
     target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes);
@@ -189,6 +197,11 @@
 static void
 m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  tdep->jb_pc = M68K_LINUX_JB_PC;
+  tdep->jb_elt_size = M68K_LINUX_JB_ELEMENT_SIZE;
+
   set_gdbarch_deprecated_frame_saved_pc (gdbarch,
 					 m68k_linux_frame_saved_pc);
   set_gdbarch_deprecated_extract_return_value (gdbarch,
@@ -197,6 +210,12 @@
 					     m68k_linux_store_return_value);
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
 						       m68k_linux_extract_struct_value_address);
+
+  set_gdbarch_pc_in_sigtramp (gdbarch, m68k_linux_pc_in_sigtramp);
+
+  /* Shared library handling.  */
+  set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
+  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 }
 
 void
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 0b98a96..c357747 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -44,6 +44,7 @@
 #include "block.h"
 #include "infcall.h"
 #include "valprint.h"
+#include "gdb_assert.h"
 
 #include <ctype.h>
 
@@ -75,38 +76,6 @@
   CORE_ADDR imp;
 };
 
-/* Complaints about ObjC classes, selectors, etc.  */
-
-#if (!defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4))
-#define __CHECK_FUNCTION ((__const char *) 0)
-#else
-#define __CHECK_FUNCTION __PRETTY_FUNCTION__
-#endif
-
-#define CHECK(expression) \
-  ((void) ((expression) ? 0 : gdb_check (#expression, __FILE__, __LINE__, \
-                                         __CHECK_FUNCTION)))
-
-#define CHECK_FATAL(expression) \
-  ((void) ((expression) ? 0 : gdb_check_fatal (#expression, __FILE__, \
-                              __LINE__, __CHECK_FUNCTION)))
-
-static void 
-gdb_check (const char *str, const char *file, 
-	   unsigned int line, const char *func)
-{
-  error ("assertion failure on line %u of \"%s\" in function \"%s\": %s\n",
-	 line, file, func, str);
-}
-
-static void 
-gdb_check_fatal (const char *str, const char *file, 
-		 unsigned int line, const char *func)
-{
-  internal_error (file, line, 
-		  "assertion failure in function \"%s\": %s\n", func, str);
-}
-
 /* Lookup a structure type named "struct NAME", visible in lexical
    block BLOCK.  If NOERR is nonzero, return zero if NAME is not
    suitably defined.  */
@@ -658,7 +627,7 @@
     {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
     {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
     {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
-    {NULL, 0, 0, 0}
+    {NULL, OP_NULL, PREC_NULL, 0}
 };
 
 struct type ** const (objc_builtin_types[]) = 
@@ -1153,7 +1122,7 @@
 
   char *nselector = NULL;
 
-  CHECK (selector != NULL);
+  gdb_assert (selector != NULL);
 
   s1 = method;
 
@@ -1212,10 +1181,10 @@
   char *ncategory = NULL;
   char *nselector = NULL;
 
-  CHECK (type != NULL);
-  CHECK (class != NULL);
-  CHECK (category != NULL);
-  CHECK (selector != NULL);
+  gdb_assert (type != NULL);
+  gdb_assert (class != NULL);
+  gdb_assert (category != NULL);
+  gdb_assert (selector != NULL);
   
   s1 = method;
 
@@ -1325,8 +1294,8 @@
   static char *tmp = NULL;
   static unsigned int tmplen = 0;
 
-  CHECK (nsym != NULL);
-  CHECK (ndebug != NULL);
+  gdb_assert (nsym != NULL);
+  gdb_assert (ndebug != NULL);
 
   if (symtab)
     block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
@@ -1438,8 +1407,8 @@
   char *buf = NULL;
   char *tmp = NULL;
 
-  CHECK (nsym != NULL);
-  CHECK (ndebug != NULL);
+  gdb_assert (nsym != NULL);
+  gdb_assert (ndebug != NULL);
 
   if (nsym != NULL)
     *nsym = 0;
@@ -1826,7 +1795,7 @@
 read_objc_methlist_method (CORE_ADDR addr, unsigned long num, 
 			   struct objc_method *method)
 {
-  CHECK_FATAL (num < read_objc_methlist_nmethods (addr));
+  gdb_assert (num < read_objc_methlist_nmethods (addr));
   read_objc_method (addr + 8 + (12 * num), method);
 }
   
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 84189dd..ddd508a 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -141,7 +141,8 @@
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if we ARE using
 	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
-	  print_address_demangle (extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
+	  /* Extract the address, assume that it is unsigned.  */
+	  print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)),
 				  stream, demangle);
 	  break;
 	}
@@ -272,9 +273,11 @@
       if (addressprint)
 	{
 	  fprintf_filtered (stream, "@");
+	  /* Extract the address, assume that it is unsigned.  */
 	  print_address_numeric
-	    (extract_address (valaddr + embedded_offset,
-			      TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+	    (extract_unsigned_integer (valaddr + embedded_offset,
+				       TARGET_PTR_BIT / HOST_CHAR_BIT),
+	     1, stream);
 	  if (deref_ref)
 	    fputs_filtered (": ", stream);
 	}
@@ -312,10 +315,11 @@
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if NOT using
 	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_PTR.) */
-	  print_address_demangle (extract_address (
-						    valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
-		  TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
-				  stream, demangle);
+	  /* Extract the address, assume that it is unsigned.  */
+	  print_address_demangle
+	    (extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+				       TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+	     stream, demangle);
 	}
       else
 	{
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 6735b08..ab5b973 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -466,13 +466,6 @@
   return ~ (CORE_ADDR) 0;
 }
 
-CORE_ADDR
-sparc_extract_struct_value_address (char *regbuf)
-{
-  return extract_address (regbuf + REGISTER_BYTE (O0_REGNUM),
-			  REGISTER_RAW_SIZE (O0_REGNUM));
-}
-
 /* Find the pc saved in frame FRAME.  */
 
 CORE_ADDR
@@ -2214,6 +2207,124 @@
   return print_insn_sparc (memaddr, info);
 }
 
+
+#define SPARC_F0_REGNUM		FP0_REGNUM	/* %f0 */
+#define SPARC_F1_REGNUM		(FP0_REGNUM + 1)/* %f1 */
+#define SPARC_O0_REGNUM		O0_REGNUM	/* %o0 */
+#define SPARC_O1_REGNUM		O1_REGNUM	/* %o1 */
+
+/* Push the arguments onto the stack and into the appropriate registers.  */
+
+static CORE_ADDR
+sparc32_do_push_arguments (struct regcache *regcache, int nargs,
+			   struct value **args, CORE_ADDR sp)
+{
+  CORE_ADDR *addr;
+  int size = 0;
+  int i;
+
+  /* Structure, union and quad-precision arguments are passed by
+     reference.  We allocate space for these arguments on the stack
+     and record their addresses in an array.  Array elements for
+     arguments that are passed by value will be set to zero.*/
+  addr = alloca (nargs * sizeof (CORE_ADDR));
+
+  for (i = nargs - 1; i >= 0; i--)
+    {
+      struct type *type = VALUE_ENCLOSING_TYPE (args[i]);
+      enum type_code code = TYPE_CODE (type);
+      int len = TYPE_LENGTH (type);
+
+      /* Push the contents of structure, union and quad-precision
+	 arguments on the stack.  */
+      if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION || len > 8)
+	{
+	  /* Keep the stack doubleword aligned.  */
+	  sp -= (len + 7) & ~7;
+	  write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
+	  addr[i] = sp;
+	  size += 4;
+	}
+      else
+	{
+	  addr[i] = 0;
+	  size += (len > 4) ? 8 : 4;
+	}
+    }
+
+  /* The needed space for outgoing arguments should be a multiple of 4.  */
+  gdb_assert (size % 4 == 0);
+
+  /* Make sure we reserve space for the first six words of arguments
+     in the stack frame, even if we don't need them.  */
+  if (size < 24)
+    sp -= (24 - size);
+
+  /* Make sure we end up with a doubleword aligned stack in the end.
+     Reserve an extra word if necessary in order to accomplish this.  */
+  if ((sp - size) % 8 == 0)
+    sp -= 4;
+
+  /* Now push the arguments onto the stack.  */
+  for (i = nargs - 1; i >=0; i--)
+    {
+      char buf[8];
+      int len;
+
+      if (addr[i])
+	{
+	  store_unsigned_integer (buf, 4, addr[i]);
+	  len = 4;
+	}
+      else
+	{
+	  struct value *arg = args[i];
+
+	  len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
+
+	  /* Expand signed and unsigned bytes and halfwords as needed.  */
+	  if (len < 4)
+	    {
+	      arg = value_cast (builtin_type_long, arg);
+	      len = 4;
+	    }
+	  else if (len > 4 && len < 8)
+	    {
+	      arg = value_cast (builtin_type_long_long, arg);
+	      len = 4;
+	    }
+
+	  gdb_assert (len == 4 || len == 8);
+	  memcpy (buf, VALUE_CONTENTS_ALL (arg), len);
+	}
+
+      /* We always write the argument word on the stack.  */
+      sp -= len;
+      write_memory (sp, buf, len);
+
+      /* If this argument occupies one of the first 6 words, write it
+         into the appropriate register too.  */
+      size -= len;
+      if (size < 24)
+	{
+	  int regnum = SPARC_O0_REGNUM + (size / 4);
+
+	  regcache_cooked_write (regcache, regnum, buf);
+	  if (len == 8 && size < 20)
+	    regcache_cooked_write (regcache, regnum + 1, buf + 4);
+	}
+    }
+
+  /* Reserve space for the struct/union return value pointer.  */
+  sp -= 4;
+
+  /* Stack should be doubleword aligned at this point.  */
+  gdb_assert (sp % 8 == 0);
+
+  /* Return the adjusted stack pointer.  */
+  return sp;
+}
+
 /* The SPARC passes the arguments on the stack; arguments smaller
    than an int are promoted to an int.  The first 6 words worth of 
    args are also passed in registers o0 - o5.  */
@@ -2222,93 +2333,133 @@
 sparc32_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 			int struct_return, CORE_ADDR struct_addr)
 {
-  int i, j, oregnum;
-  int accumulate_size = 0;
-  struct sparc_arg
-    {
-      char *contents;
-      int len;
-      int offset;
-    };
-  struct sparc_arg *sparc_args =
-    (struct sparc_arg *) alloca (nargs * sizeof (struct sparc_arg));
-  struct sparc_arg *m_arg;
+  sp = sparc32_do_push_arguments (current_regcache, nargs, args, sp);
 
-  /* Promote arguments if necessary, and calculate their stack offsets
-     and sizes. */
-  for (i = 0, m_arg = sparc_args; i < nargs; i++, m_arg++)
+  /* FIXME: kettenis/20030525: We don't let this function set the
+     struct/union return pointer just yet.  */
+#if 0
+  if (struct_return)
     {
-      struct value *arg = args[i];
-      struct type *arg_type = check_typedef (VALUE_TYPE (arg));
-      /* Cast argument to long if necessary as the compiler does it too.  */
-      switch (TYPE_CODE (arg_type))
-	{
-	case TYPE_CODE_INT:
-	case TYPE_CODE_BOOL:
-	case TYPE_CODE_CHAR:
-	case TYPE_CODE_RANGE:
-	case TYPE_CODE_ENUM:
-	  if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long))
-	    {
-	      arg_type = builtin_type_long;
-	      arg = value_cast (arg_type, arg);
-	    }
-	  break;
-	default:
-	  break;
-	}
-      m_arg->len = TYPE_LENGTH (arg_type);
-      m_arg->offset = accumulate_size;
-      accumulate_size = (accumulate_size + m_arg->len + 3) & ~3;
-      m_arg->contents = VALUE_CONTENTS (arg);
-    }
+      char buf[4];
 
-  /* Make room for the arguments on the stack.  */
-  accumulate_size += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
-  sp = ((sp - accumulate_size) & ~7) + DEPRECATED_CALL_DUMMY_STACK_ADJUST;
-
-  /* `Push' arguments on the stack.  */
-  for (i = 0, oregnum = 0, m_arg = sparc_args; 
-       i < nargs;
-       i++, m_arg++)
-    {
-      write_memory (sp + m_arg->offset, m_arg->contents, m_arg->len);
-      for (j = 0; 
-	   j < m_arg->len && oregnum < 6; 
-	   j += SPARC_INTREG_SIZE, oregnum++)
-	deprecated_write_register_gen (O0_REGNUM + oregnum, m_arg->contents + j);
+      /* The space for the struct/union return value pointer has
+         already been reserved.  */
+      store_unsigned_integer (buf, 4, struct_addr);
+      write (sp, buf, 4);
     }
 
   return sp;
+#else
+  return sp + 4;
+#endif
 }
 
+/* Extract from REGCACHE a function return value of type TYPE and copy
+   that into VALBUF.
 
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  */
+   Note that REGCACHE specifies the register values for the frame of
+   the calling function.  This means that we need to fetch the value
+   form %o0 and %o1, which correspond to %i0 and %i1 in the frame of
+   the called function.  */
 
 void
-sparc32_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+sparc32_extract_return_value (struct type *type, struct regcache *regcache,
+			      void *valbuf)
 {
-  int typelen = TYPE_LENGTH (type);
-  int regsize = REGISTER_RAW_SIZE (O0_REGNUM);
+  int len = TYPE_LENGTH (type);
+  char buf[8];
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT && SPARC_HAS_FPU)
-    memcpy (valbuf, &regbuf[REGISTER_BYTE (FP0_REGNUM)], typelen);
+    {
+      if (len == 4 || len == 8)
+	{
+	  regcache_cooked_read (regcache, SPARC_F0_REGNUM, buf);
+	  regcache_cooked_read (regcache, SPARC_F1_REGNUM, buf + 4);
+	  memcpy (valbuf, buf, len);
+	  return;
+	}
+      else
+	internal_error (__FILE__, __LINE__, "\
+Cannot extract floating-point return value of %d bytes long.", len);
+    }
+
+  if (len <= 4)
+    {
+      regcache_cooked_read (regcache, SPARC_O0_REGNUM, buf);
+      memcpy (valbuf, buf + 4 - len, len);
+    }
+  else if (len <= 8)
+    {
+      regcache_cooked_read (regcache, SPARC_O0_REGNUM, buf);
+      regcache_cooked_read (regcache, SPARC_O1_REGNUM, buf + 4);
+      memcpy (valbuf, buf + 8 - len, len);
+    }
   else
-    memcpy (valbuf,
-	    &regbuf[O0_REGNUM * regsize +
-		    (typelen >= regsize
-		     || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE ? 0
-		     : regsize - typelen)],
-	    typelen);
+    internal_error (__FILE__, __LINE__,
+		    "Cannot extract return value of %d bytes long.", len);
 }
 
+/* Write into REGBUF a function return value VALBUF of type TYPE.  */
 
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format.  On SPARCs with FPUs,
-   float values are returned in %f0 (and %f1).  In all other cases,
-   values are returned in register %o0.  */
+void
+sparc32_store_return_value (struct type *type, struct regcache *regcache,
+			    const void *valbuf)
+{
+  int len = TYPE_LENGTH (type);
+  char buf[8];
+
+  if (TYPE_CODE (type) == TYPE_CODE_FLT && SPARC_HAS_FPU)
+    {
+      const char *buf = valbuf;
+
+      if (len == 4)
+	{
+	  regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf);
+	  return;
+	}
+      else if (len == 8)
+	{
+	  regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf);
+	  regcache_cooked_write (regcache, SPARC_F1_REGNUM, buf + 4);
+	  return;
+	}
+      else
+	internal_error (__FILE__, __LINE__, "\
+Cannot extract floating-point return value of %d bytes long.", len);
+    }
+
+  /* Add leading zeros to the value.  */
+  memset (buf, 0, sizeof buf);
+
+  if (len <= 4)
+    {
+      memcpy (buf + 4 - len, valbuf, len);
+      regcache_cooked_write (regcache, SPARC_O0_REGNUM, buf);
+    }
+  else if (len <= 8)
+    {
+      memcpy (buf + 8 - len, valbuf, len);
+      regcache_cooked_write (regcache, SPARC_O0_REGNUM, buf);
+      regcache_cooked_write (regcache, SPARC_O1_REGNUM, buf);
+    }
+  else
+    internal_error (__FILE__, __LINE__,
+		    "Cannot extract return value of %d bytes long.", len);
+}
+
+/* Extract from REGCACHE the address in which a function should return
+   its structure value.  */
+
+CORE_ADDR
+sparc_extract_struct_value_address (struct regcache *regcache)
+{
+  ULONGEST addr;
+
+  regcache_cooked_read_unsigned (regcache, SPARC_O0_REGNUM, &addr);
+  return addr;
+}
+
+/* FIXME: kettenis/2003/05/24: Still used for sparc64.  */
 
 void
 sparc_store_return_value (struct type *type, char *valbuf)
@@ -3164,7 +3315,8 @@
   set_gdbarch_breakpoint_from_pc (gdbarch, sparc_breakpoint_from_pc);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address);
+  set_gdbarch_extract_struct_value_address (gdbarch,
+					   sparc_extract_struct_value_address);
   set_gdbarch_deprecated_fix_call_dummy (gdbarch, sparc_gdbarch_fix_call_dummy);
   set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_deprecated_fp_regnum (gdbarch, SPARC_FP_REGNUM);
@@ -3379,11 +3531,11 @@
   switch (info.bfd_arch_info->mach)
     {
     case bfd_mach_sparc:
-      set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_store_return_value (gdbarch, sparc32_store_return_value);
       set_gdbarch_num_regs (gdbarch, 72);
       set_gdbarch_deprecated_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
       set_gdbarch_register_name (gdbarch, sparc32_register_name);
-      set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
 #if 0
       // OBSOLETE       tdep->has_fpu = 1;	/* (all but sparclet and sparclite) */
 #endif
@@ -3415,11 +3567,11 @@
       // OBSOLETE       break;
 #endif
     case bfd_mach_sparc_v8plus:
-      set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_store_return_value (gdbarch, sparc32_store_return_value);
       set_gdbarch_num_regs (gdbarch, 72);
       set_gdbarch_deprecated_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
       set_gdbarch_register_name (gdbarch, sparc32_register_name);
-      set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
       tdep->print_insn_mach = bfd_mach_sparc;
       tdep->fp_register_bytes = 32 * 4;
 #if 0
@@ -3427,11 +3579,11 @@
 #endif
       break;
     case bfd_mach_sparc_v8plusa:
-      set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+      set_gdbarch_store_return_value (gdbarch, sparc32_store_return_value);
       set_gdbarch_num_regs (gdbarch, 72);
       set_gdbarch_deprecated_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
       set_gdbarch_register_name (gdbarch, sparc32_register_name);
-      set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
 #if 0
       // OBSOLETE       tdep->has_fpu = 1;	/* (all but sparclet and sparclite) */
 #endif
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index ab984ff..1299d06 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -1,5 +1,5 @@
 /* Target-dependent code for SPARC systems running NetBSD.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -26,6 +26,8 @@
 #include "value.h"
 #include "osabi.h"
 
+#include "gdb_string.h"
+
 #include "sparcnbsd-tdep.h"
 #include "nbsd-tdep.h"
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index e0c88aa..d49c583 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -105,6 +105,8 @@
 
 static int read_type_number (char **, int *);
 
+static struct type *read_type (char **, struct objfile *);
+
 static struct type *read_range_type (char **, int[2], struct objfile *);
 
 static struct type *read_sun_builtin_type (char **, int[2], struct objfile *);
@@ -146,6 +148,8 @@
 
 static struct field *read_args (char **, int, struct objfile *, int *, int *);
 
+static void add_undefined_type (struct type *);
+
 static int
 read_cpp_abbrev (struct field_info *, char **, struct type *,
 		 struct objfile *);
@@ -248,7 +252,7 @@
    This can be used for finding the type associated with that pair
    or for associating a new type with the pair.  */
 
-struct type **
+static struct type **
 dbx_lookup_type (int typenums[2])
 {
   register int filenum = typenums[0];
@@ -2259,7 +2263,7 @@
    assume that type information starts with a digit, '-', or '(' in
    deciding whether to call read_type.  */
 
-struct type *
+static struct type *
 read_type (register char **pp, struct objfile *objfile)
 {
   register struct type *type = 0;
@@ -5128,7 +5132,7 @@
 /* Add a type to the list of undefined types to be checked through
    once this file has been read in.  */
 
-void
+static void
 add_undefined_type (struct type *type)
 {
   if (undef_types_length == undef_types_allocated)
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index b70f162..91db978 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -130,16 +130,10 @@
 
 EXTERN int n_allocated_this_object_header_files;
 
-extern struct type *read_type (char **, struct objfile *);
-
 extern void cleanup_undefined_types (void);
 
-extern struct type **dbx_lookup_type (int[2]);
-
 extern long read_number (char **, int);
 
-extern void add_undefined_type (struct type *);
-
 extern struct symbol *define_symbol (CORE_ADDR, char *, int, int,
 				     struct objfile *);
 
diff --git a/gdb/stack.c b/gdb/stack.c
index e865270..a0bd7a4 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -818,7 +818,10 @@
 	    CORE_ADDR sp;
 	    frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
 				   &realnum, value);
-	    sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM));
+	    /* NOTE: cagney/2003-05-22: This is assuming that the
+               stack pointer was packed as an unsigned integer.  That
+               may or may not be valid.  */
+	    sp = extract_unsigned_integer (value, REGISTER_RAW_SIZE (SP_REGNUM));
 	    printf_filtered (" Previous frame's sp is ");
 	    print_address_numeric (sp, 1, gdb_stdout);
 	    printf_filtered ("\n");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8f11876..f0e5d82 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-22  Jim Blandy  <jimb@redhat.com>
+
+	* gdb.base/corefile.exp: Tolerate stuff after argument parens in
+	backtrace.
+	
 2003-05-20  David Carlton  <carlton@math.stanford.edu>
 
 	* gdb.c++/namespace1.cc: Actually do 'cvs add' before committing
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index e25c03c..7321777 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -227,6 +227,6 @@
 
 gdb_load ${binfile}
 setup_xfail "*-*-*" CLLbs17002
-gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp (reinit)"
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)"
 
 gdb_test "core" "No core file now."
diff --git a/gdb/version.in b/gdb/version.in
index 8379ea3..4c17a67 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2003-05-21-cvs
+2003-05-28-cvs
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 48004d0..9514813 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,11 +1,26 @@
+2003-05-23  Jason Eckhardt  <jle@rice.edu>
+
+	* i860.h (expand_type): Add XP_ONLY.
+	(scyc.b): New XP instruction.
+	(ldio.l): Likewise.
+	(ldio.s): Likewise.
+	(ldio.b): Likewise.
+	(ldint.l): Likewise.
+	(ldint.s): Likewise.
+	(ldint.b): Likewise.
+	(stio.l): Likewise.
+	(stio.s): Likewise.
+	(stio.b): Likewise.
+	(pfld.q): Likewise.
+
 2003-05-20  Jason Eckhardt  <jle@rice.edu>
 
-	opcode/i860.h (flush): Set lower 3 bits properly and use 'L'
+	* i860.h (flush): Set lower 3 bits properly and use 'L'
 	for the immediate operand type instead of 'i'.
 
 2003-05-20  Jason Eckhardt  <jle@rice.edu>
 
-	opcode/i860.h (fzchks): Both S and R bits must be set.
+	* i860.h (fzchks): Both S and R bits must be set.
 	(pfzchks): Likewise.
 	(faddp): Likewise.
 	(pfaddp): Likewise.
diff --git a/include/opcode/i860.h b/include/opcode/i860.h
index 6fdcdba..6e2a683 100644
--- a/include/opcode/i860.h
+++ b/include/opcode/i860.h
@@ -40,7 +40,7 @@
 
 enum expand_type
 {
-    E_MOV = 1, E_ADDR, E_U32, E_AND, E_S32, E_DELAY
+    E_MOV = 1, E_ADDR, E_U32, E_AND, E_S32, E_DELAY, XP_ONLY
 };
 
 
@@ -135,6 +135,10 @@
 { "pfld.d",	0x64000000, 0x98000007, "L(2),g", E_ADDR },	/* pfld.d #const(isrc2),fdest */
 { "pfld.d",	0x60000001, 0x9c000006, "1(2)++,g", 0 },	/* pfld.d isrc1(isrc2)++,fdest */
 { "pfld.d",	0x64000001, 0x98000006, "L(2)++,g", E_ADDR },	/* pfld.d #const(isrc2)++,fdest */
+{ "pfld.q",	0x60000004, 0x9c000003, "1(2),g", XP_ONLY },	/* pfld.q isrc1(isrc2),fdest */
+{ "pfld.q",	0x64000004, 0x98000003, "L(2),g", XP_ONLY },	/* pfld.q #const(isrc2),fdest */
+{ "pfld.q",	0x60000005, 0x9c000002, "1(2)++,g", XP_ONLY },	/* pfld.q isrc1(isrc2)++,fdest */
+{ "pfld.q",	0x64000005, 0x98000002, "L(2)++,g", XP_ONLY },	/* pfld.q #const(isrc2)++,fdest */
 
 { "fst.l",	0x28000002, 0xd4000001, "g,1(2)", 0 },	/* fst.l fdest,isrc1(isrc2) */
 { "fst.l",	0x2c000002, 0xd0000001, "g,K(2)", E_ADDR },	/* fst.l fdest,#const(isrc2) */
@@ -204,6 +208,16 @@
 { "calli",	0x4c000002, 0xb000001d, "1", E_DELAY },	/* calli isrc1ni */
 { "intovr",	0x4c000004, 0xb000001b, "", 0 },	/* intovr trap on integer overflow */
 { "unlock",	0x4c000007, 0xb0000018, "", 0 },	/* unlock clear BL in dirbase */
+{ "ldio.l",	0x4c000408, 0xb00003f7, "2,d", XP_ONLY },	/* ldio.l isrc2,idest */
+{ "ldio.s",	0x4c000208, 0xb00005f7, "2,d", XP_ONLY },	/* ldio.s isrc2,idest */
+{ "ldio.b",	0x4c000008, 0xb00007f7, "2,d", XP_ONLY },	/* ldio.b isrc2,idest */
+{ "stio.l",	0x4c000409, 0xb00003f6, "1,2", XP_ONLY },	/* stio.l isrc1ni,isrc2 */
+{ "stio.s",	0x4c000209, 0xb00005f6, "1,2", XP_ONLY },	/* stio.s isrc1ni,isrc2 */
+{ "stio.b",	0x4c000009, 0xb00007f6, "1,2", XP_ONLY },	/* stio.b isrc1ni,isrc2 */
+{ "ldint.l",	0x4c00040a, 0xb00003f5, "2,d", XP_ONLY },	/* ldint.l isrc2,idest */
+{ "ldint.s",	0x4c00020a, 0xb00005f5, "2,d", XP_ONLY },	/* ldint.s isrc2,idest */
+{ "ldint.b",	0x4c00000a, 0xb00007f5, "2,d", XP_ONLY },	/* ldint.b isrc2,idest */
+{ "scyc.b",	0x4c00000b, 0xb00007f4, "2", XP_ONLY },		/* scyc.b isrc2 */
 
 /* CTRL-Format Instructions */
 { "br",		0x68000000, 0x94000000, "l", E_DELAY },	/* br lbroff */
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index de8f363..cbdcc3c 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-23  Jason Eckhardt  <jle@rice.edu>
+
+	* i860-dis.c (crnames): Add bear, ccr, p0, p1, p2, p3.
+	(print_insn_i860): Grab 4 bits of the control register field
+	instead of 3.
+
 2003-05-18  Jason Eckhardt  <jle@rice.edu>
 
 	* i860-dis.c (print_insn_i860): Instruction shrd has a dual bit,
diff --git a/opcodes/i860-dis.c b/opcodes/i860-dis.c
index 69a106d..a3e87b0 100644
--- a/opcodes/i860-dis.c
+++ b/opcodes/i860-dis.c
@@ -1,5 +1,5 @@
 /* Disassembler for the i860.
-   Copyright 2000 Free Software Foundation, Inc.
+   Copyright 2000, 2003 Free Software Foundation, Inc.
 
    Contributed by Jason Eckhardt <jle@cygnus.com>.
 
@@ -37,9 +37,11 @@
   "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
   "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"};
 
-/* Control/status register names (encoded as 0..5 in the instruction).  */
+/* Control/status register names (encoded as 0..11 in the instruction).
+   Registers bear, ccr, p0, p1, p2 and p3 are XP only.  */
 static const char *const crnames[] = 
- {"fir", "psr", "dirbase", "db", "fsr", "epsr", "", ""};
+ {"fir", "psr", "dirbase", "db", "fsr", "epsr", "bear", "ccr",
+  "p0", "p1", "p2", "p3", "--", "--", "--", "--" };
 
 
 /* Prototypes.  */
@@ -190,7 +192,7 @@
 	    /* Control register.  */
 	    case 'c':
 	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
-				     crnames[(insn >> 21) & 0x7]);
+				     crnames[(insn >> 21) & 0xf]);
 	      break;
 
 	    /* 16-bit immediate (sign extend, except for bitwise ops).  */
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 28376b7..3cb58e2 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,8 @@
+2003-05-25  Mark Kettenis  <kettenis@gnu.org>
+
+	* aclocal.m4: Don't add wcwidth.o if we don't have wchar.h.
+	* configure: Regenerate.
+
 2003-05-13  Andreas Jaeger  <aj@suse.de>
 
         * support/config.guess: Update to 2003-05-09 version.
diff --git a/readline/aclocal.m4 b/readline/aclocal.m4
index bc43d8d..a87e2dc 100644
--- a/readline/aclocal.m4
+++ b/readline/aclocal.m4
@@ -1654,13 +1654,13 @@
 
 AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
-AC_CHECK_FUNC(wcwidth, have_wcwidth=yes)
-if test "$have_wcwidth" = yes; then
-  AC_DEFINE(HAVE_WCWIDTH)
-  AC_SUBST(WCWIDTH_OBJ,)
+AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
+if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
+  WCWIDTH_OBJ=wcwidth.o
 else
-  AC_SUBST(WCWIDTH_OBJ,wcwidth.o)
+  WCWIDTH_OBJ=
 fi
+AC_SUBST(WCWIDTH_OBJ)
 
 AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
 [AC_TRY_RUN([
diff --git a/readline/configure b/readline/configure
index b5c2e8d..236327c 100755
--- a/readline/configure
+++ b/readline/configure
@@ -6235,20 +6235,19 @@
 echo "$as_me:$LINENO: result: $ac_cv_func_wcwidth" >&5
 echo "${ECHO_T}$ac_cv_func_wcwidth" >&6
 if test $ac_cv_func_wcwidth = yes; then
-  have_wcwidth=yes
-fi
-
-if test "$have_wcwidth" = yes; then
   cat >>confdefs.h <<\_ACEOF
 #define HAVE_WCWIDTH 1
 _ACEOF
 
-
-else
-  WCWIDTH_OBJ=wcwidth.o
-
 fi
 
+if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
+  WCWIDTH_OBJ=wcwidth.o
+else
+  WCWIDTH_OBJ=
+fi
+
+
 echo "$as_me:$LINENO: checking for mbstate_t" >&5
 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
 if test "${bash_cv_have_mbstate_t+set}" = set; then